lamho86 / phylolm

GNU General Public License v2.0
30 stars 12 forks source link

Phyloglm univariate case: testing for phylogenetic signal #50

Closed gcjarvis closed 2 years ago

gcjarvis commented 2 years ago

Hello,

I am interested in testing the strength of phylogenetic signal in my residuals (alpha term in phyloglm summary output) in my model for a numeric, binary response, in the absence of independent variables (sensu Ives and Garland [2010]). Is this possible in R? I attempted to run this as a null model (which may not even be what I want!), but that model returned the following error message:

model: model <- phyloglm(response ~ -1, data = data, boot = 1000, phy = tree, method = 'logistic_MPLE', btol = 50)

error message: Error in x[, ii] : subscript out of bounds

Any advice on how to code this model as a univariate model in R would be extremely helpful.

If any of this is unclear, I'd be happy to provide more information. Thanks so much for your time, I very much appreciate this package, and your work on this topic.

cecileane commented 2 years ago

Why did you use -1 in the formula? Could you use 1 instead, like this:

model <- phyloglm(response ~ 1, data = data, boot = 1000, phy = tree, method = 'logistic_MPLE', btol = 50)
gcjarvis commented 2 years ago

Admittedly, I didn't know what to put in the formula, but when I use '1' instead, I get an error message:

Error in rbinTrait(n = boot, phy = phy, beta = results$coefficients, alpha = results$alpha, : The design matrix is not needed when the coefficient is a scalar.

lamho86 commented 2 years ago

Do you need bootstrap? The error seems to be in the bootstrap procedue. If you set boot = 0, the error may go away. However, I don't understand why this can happen. Did you use the most up-to-date version (can be installed from this github)?

gcjarvis commented 2 years ago

That worked! After I removed the bootstrap argument (or set boot = 0), the error disappeared, the model ran, and I was able to view the parameter estimates of the model with the summary function.

original model (produced error): model <- phyloglm(response ~ 1, data = data, boot = 1000, phy = tree, method = 'logistic_MPLE', btol = 50)

revised model (no error): model1 <- phyloglm(response ~ 1, data = data, phy = tree, method = 'logistic_MPLE', btol = 50)

I ran this with 'phylolm' v.2.6.2. Thank you both for your help.