Troubleshooting RPANDA code


#1

I’m trying to test maximum likelihood fit of environmental birth death model specified in Helen Morlone’s paper.

Using the code given in the manual:

data(a)
tot_time<-max(node.age(a)$ages)
data(InfTemp)
dof<-smooth.spline(InfTemp[,1], InfTemp[,2])$df

f.lamb <-function(t,x,y){y[1] * exp(y[2] * x)}
f.mu<-function(t,x,y){0}
lamb_par<-c(0.10, 0.01)
mu_par<-c()
result_exp <-fit_env(Cetacea,InfTemp,tot_time,f.lamb,f.mu,lamb_par,mu_par, f=21/40,fix.mu=TRUE,df=dof,dt=1e-3)

This code gives me the following error.

Error in optim(init, optimLH, method = meth) : function cannot be evaluated at initial parameters.

What should I modify in my code to troubleshoot this?


#2

It is hard to troubleshoot this without a working example. What is a above? Does it correspond with the Cetacea data? If not, that would explain the failure.