Permalink
Browse files

further fix to optimization in ratebytree

  • Loading branch information...
liamrevell committed Oct 30, 2017
1 parent fe356d2 commit e1ea3abfd615abdcad12f30316c3dfe22dec7dd6
Showing with 5 additions and 4 deletions.
  1. +5 −4 R/ratebytree.R
View
@@ -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
}
@@ -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),

0 comments on commit e1ea3ab

Please sign in to comment.