fcboucher / BBM

Fitting the bounded Brownian motion model to phylogenetic comparative data
0 stars 1 forks source link

Error when bounds is a vector #3

Open rafmarcondes opened 7 years ago

rafmarcondes commented 7 years ago

Hi Florian,

I'm getting an error when I try to fit the BBM model with bounds specified as numeric vector. It runs fine when bounds='Fixed'. I'm running R 3.3.3 and the functions downloaded from this repository. I have attached my tr and dat objects. Thank you for any help!

BBM=fit_BBM_model_uncertainty(tree=tr, trait=dat, Npts=200, bounds=c(0,1)) Error in P %% expD %% tP %*% X : non-conformable arguments In addition: Warning message: In if (bounds == "Fixed") { : the condition has length > 1 and only the first element will be used Called from: ConvProp_bounds(X = tree_formatted2$Pos[[tree_formatted2$tab[i, 2]]], t = tree_formatted2$tab[i, 3], dCoeff = dCoeff, dMat = dMat, bounds)

tr.R.zip dat.R.zip

fcboucher commented 7 years ago

Hi Rafael,

I had a look at your data and it seems that your trait values range from 1 to 67. If you impose bounds between 0 and 1 the model is not defined since you have traits values at the tips of the tree which fall outside of the trait interval: this is why you got an error message. I tried the same code as you with bounds=c(0,100) and it worked.

By the way, your data look quite skewed and might be better fit by the more general BBM+V model, which is basically bounded BM + deterministic forces. You can find R functions to fit this model as well as a tutorial in the following Github repository. BBM+V includes BBM as a special case so that you can fit this model along with more complex ones.

I hope this helps. Cheers,

Florian

fcboucher commented 7 years ago

Hi Rafael,

I had a look at your data and it seems that your trait values range from 1 to 67. If you impose bounds between 0 and 1 the model is not defined since you have traits values at the tips of the tree which fall outside of the trait interval: this is why you got an error message. I tried the same code as you with bounds=c(0,100) and it worked.

By the way, your data look quite skewed and might be better fit by the more general BBM+V model, which is basically bounded BM + deterministic forces. You can find R functions to fit this model as well as a tutorial in the following Github repository. BBM+V includes BBM as a special case so that you can fit this model along with more complex ones.

I hope this helps. Cheers,

Florian

2017-09-06 18:17 GMT+02:00 Rafael Marcondes notifications@github.com:

Hi Florian,

I'm getting an error when I try to fit the BBM model with bounds specified as numeric vector. It runs fine when bounds='Fixed'. I'm running R 3.3.3 and the functions downloaded from this repository. I have attached my tr and dat objects. Thank you for any help!

BBM=fit_BBM_model_uncertainty(tree=tr, trait=dat, Npts=200, bounds=c(0,1)) Error in P %% expD %% tP %*% X : non-conformable arguments In addition: Warning message: In if (bounds == "Fixed") { : the condition has length > 1 and only the first element will be used Called from: ConvProp_bounds(X = treeformatted2$Pos[[tree formatted2$tab[i, 2]]], t = tree_formatted2$tab[i, 3], dCoeff = dCoeff, dMat = dMat, bounds)

tr.R.zip https://github.com/fcboucher/BBM/files/1281787/tr.R.zip dat.R.zip https://github.com/fcboucher/BBM/files/1281788/dat.R.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fcboucher/BBM/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AOU-kU3XXotHH9_JIFbPSpDJwz4UC082ks5sfsWhgaJpZM4POoEe .

rafmarcondes commented 7 years ago

Hi Florian,

Thanks for the fast reply, and my apologies. I didn't triple-check the data carefully enough before submitting my help request. The trait values shouldn't go up to 67. My trait is a proportion and should vary from 0 to

  1. I fixed my workflow and now the BBM model is running fine.

I didn't realize there was a BBM+V model. I'll be sure to read the pre-print and try it. Seems like it may be adequate for my data. So far, I've fitted BBM and all the models available in OUwie. The OUMVA model has the most support for almost all my traits.

Thanks,

-- Rafael Sobral Marcondes PhD Candidate (Systematics, Ecology and Evolution/Ornithology)

Museum of Natural Science http://sites01.lsu.edu/wp/mns/ Louisiana State University 119 Foster Hall Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes https://twitter.com/rafmarcondes

On Thu, Sep 7, 2017 at 1:47 AM, Florian Boucher notifications@github.com wrote:

Hi Rafael,

I had a look at your data and it seems that your trait values range from 1 to 67. If you impose bounds between 0 and 1 the model is not defined since you have traits values at the tips of the tree which fall outside of the trait interval: this is why you got an error message. I tried the same code as you with bounds=c(0,100) and it worked.

By the way, your data look quite skewed and might be better fit by the more general BBM+V model, which is basically bounded BM + deterministic forces. You can find R functions to fit this model as well as a tutorial in the following Github repository https://github.com/fcboucher/BBMV. BBM+V includes BBM as a special case so that you can fit this model along with more complex ones.

I hope this helps. Cheers,

Florian

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fcboucher/BBM/issues/3#issuecomment-327703695, or mute the thread https://github.com/notifications/unsubscribe-auth/AKD7UiTariLwOUugFb6kZ6jICZ7SQFuwks5sf5GagaJpZM4POoEe .

fcboucher commented 7 years ago

Yes, it will be difficult to get a better fit that OUMVA, especially on large trees. Good luck with that!