This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Help with plotting diversification rates using LASER

Hi,

I have been trying to use the LASER package in R to plot rates of diversification for my data. However, I am running into the following error.

plotRate(v,pars)
Error in pars$lam0 : $ operator is invalid for atomic vectors

v is my numeric vector of branch lengths, pars is a list with the 4 parameters (lam0, k, mu0, z) that I entered manually after fitting the different models - fitSPVAR, fitEXVAR, fitBOTHVAR and checking the values I get each time.

Is there anything inconsistent with the kind of data I should be entering? I'd be grateful if anyone can point me in the right direction.

laser phylogenetics r

What happens if you try to access pars$lam0? e.g summary(pars$lam0) or head(pars$lam0). And how did you created pars?

I created pars as a list. pars=c(lam0, k, mu0, z) where the 4 parameters are all numeric values

1 answer

According to your comment, you did not create a list, just a vector. Try this:

pars <- as.list( c( lam0 = 1, k = 2, mu0 = 3, z = 4 ) )

Log in to answer this question.