Skip to content

Commit

Permalink
further fix to optimization in ratebytree
Browse files Browse the repository at this point in the history
  • Loading branch information
liamrevell committed Oct 30, 2017
1 parent fe356d2 commit e1ea3ab
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/ratebytree.R
Expand Up @@ -81,8 +81,8 @@ rbt.div<-function(trees,...){
upper=rep(Inf,length(trees)+1))
count<-0
while(!is.finite(obj$objective)&&count<10){
obj<-nlminb(c(init.b,rep(0,length(trees))),lik.eqlam,t=t,rho=rho,
trace=trace,lower=rep(0,length(trees)+1),
obj<-nlminb(runif(n=2,0,2)*c(init.b,rep(0,length(trees))),lik.eqlam,
t=t,rho=rho,trace=trace,lower=rep(0,length(trees)+1),
upper=rep(Inf,length(trees)+1))
count<-count+1
}
Expand All @@ -105,8 +105,9 @@ rbt.div<-function(trees,...){
model=model,trace=trace,lower=c(0,0),upper=rep(Inf,2))
count<-0
while(!is.finite(fit.onerate$objective)&&count<10){
fit.onerate<-nlminb(c(init.b,init.d),lik.onerate,t=t,rho=rho,
model=model,trace=trace,lower=c(0,0),upper=rep(Inf,2))
fit.onerate<-nlminb(runif(n=2,0,2)*c(init.b,init.d),lik.onerate,
t=t,rho=rho,model=model,trace=trace,lower=c(0,0),
upper=rep(Inf,2))
count<-count+1
}
rates.multi<-cbind(sapply(fit.multi,function(x) x$b),
Expand Down

0 comments on commit e1ea3ab

Please sign in to comment.