DHARMa
DHARMa copied to clipboard
Add support for phylolm to DHARMa
A user requests support for https://github.com/lamho86/phylolm
Perspective for this request: Currently, the package does not allow to simulate from the fitted model, which prevents an easy integration into DHARMa. Support could be added if the package developers implement a simulate function, see here
Interim solution for users that, for some reason, have to urgently use DHARMa with this package: take your fitted model, create a simulate function for this model structure yourself, and then use createDHARMa (see help), this will allow most options of the package to be run. See further comments on support of new packages in here. Note that the vignette has some further comments / examples on creating custom simulation functions and reading them into DHARMa
See also comments here: https://github.com/lamho86/phylolm/issues/27
Started to address this in https://github.com/florianhartig/DHARMa/tree/129-phylolm
Hi @florianhartig , I want to do exactly what you are working on this branch, I've seen your discussion here, https://github.com/lamho86/phylolm/issues/27
I tried to install your dev branch 129-phylolm
devtools::install_github(repo = "florianhartig/DHARMa", subdir = "DHARMa", ref = "129-phylolm",
dependencies = T, build_vignettes = T, force = TRUE)
but i can not run your test
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)
summary(fit)
coef(fit)
vcov(fit)
DHARMa::simulateResiduals(fit, plot = T)
here is the error:
Error in nobs.default(fittedModel) : no 'nobs' method is available
In addition: Warning message:
In checkModel(fittedModel) :
DHARMa: fittedModel not in class of supported models. Absolutely no guarantee that this will work!
Can you help me figure out please ?