lamho86 / phylolm

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

boot parameter is silently ignored for Poisson glm, and summary yields an error #13

Open Ax3man opened 6 years ago

Ax3man commented 6 years ago

From the help, but with Poisson:

set.seed(123456)
tre = rtree(50)
x = rTrait(n=1,phy=tre)
X = cbind(rep(1,50),x)
y = rbinTrait(n=1,phy=tre, beta=c(-1,0.5), alpha=1 ,X=X)
dat = data.frame(trait01 = y, predictor = x)

fit = phyloglm(trait01~predictor,phy=tre,data=dat,boot=100, method = 'poisson_GEE')
summary(fit)

phyloglm doesn't do anything with the bootstrapping for Poisson models, but does run the model normally. Asking for the summary then returns an error from print.summary.phyloglm:

Error in if (x$bootNrep > 0) cat("      Parametric bootstrap results based on",  : 
  argument is of length zero

presumably since it is looking for bootstrap results that aren't actually there.

lamho86 commented 6 years ago

You are right. We haven't implemented bootstrap for Poisson models yet. I will do it soon.

Ax3man commented 6 years ago

Not a problem of course! Just mentioning it here since it is perhaps not so clear to users what is going on when this fails.

lauterbur commented 2 years ago

Is the bootstrap for Poisson models still in the plan? It would be a great help for evaluating these models!

ra-barber commented 2 years ago

Was bootstrapping ever done for these models? I'm using the bootstrap for normal phylolm and it'd be great to plot model results alongside with same method. Or is it easy to code up from inspecting the function?

lamho86 commented 2 years ago

Coding bootstrap for Poisson glm is straightforward. All you need is a function to simulate from the Poisson model (similar to the rTrait/rbinTrait functions). Then, you can integrate it into phyloglm just like the boostraps for logistic regression. I've got a lot on my plate, so I couldn't do it right now. Please do a pull request if you code up something and would like to add them to our package.