Skip to content

Commit

Permalink
sim ann shows release in intramandibulars
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed May 6, 2011
1 parent 296b2f1 commit 9edfeab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions demos/loop_models_traits_regimes.R
Expand Up @@ -37,16 +37,19 @@ fit_all <- function(models, traits, regimes, tree){
## Reporting, optional
# print(paste("model = ", models[[i]], "trait = ", names(traits[j]),
# "regime=", names(regimes[k])))


## use hansen to start with good parameters
hansen <- try(fit("hansen", traits[j], regimes[[k]], tree=tree,
maxit=5000))
## hansen will sometimes give very large or negative


## Fit one of the generalized models using the initial guess from hansen
out[[i]] <- try( fit(models[[i]], traits[j], regimes[[k]],
tree=tree, alpha=c(0.1,5),
#(min(10, hansen@sqrt.alpha^2)),
sigma=hansen@sigma, control=list(maxit=5000)))
sigma=hansen@sigma, method ="SANN" ))

## If errors, attempt default starting conditions
if(is(out[[i]], "try-error")){
out[[i]] <- try( fit(models[[i]], traits[j], regimes[[k]],
Expand Down
5 changes: 4 additions & 1 deletion demos/parrotfish.R
Expand Up @@ -10,7 +10,10 @@ source("loop_models_traits_regimes.R")
model_list <- list("brown", "hansen", "ouch", "brownie", "wright", "release_constraint")
regime_list <- list(intramandibular=intramandibular)

test <- fit_all(model_list, labrid$data, regime_list, labrid$tree)
#test <- fit_all(model_list, labrid$data, regime_list, labrid$tree)

test <- fit_all(model_list[c(4,5,6)], labrid$data[10:11], regime_list, labrid$tree)

conv(test)


Expand Down

0 comments on commit 9edfeab

Please sign in to comment.