Closed elslabbert closed 3 years ago
Sorry, I can't reproduce the error. The following works fine for me:
library(visreg)
X <- matrix(rnorm(100*3), 100, 3)
colnames(X) <- sprintf('V%d', 1:3)
DF <- data.frame(X, Site=factor(sample(LETTERS[1:5], 100, replace=TRUE)), y=rnorm(100))
fit <- nlme::lme(y ~ V1 + scale(V2) + scale(V3), random = ~1|Site, data=DF)
visreg(fit, 'V2', type='contrast')
Maybe you need to update your version of visreg?
Thanks for the feedback.
I back tracked and found that the lme model was not working properly - random effect was not properly accounted for. So perhaps the error was more related to that issue. Changing to the lme4 package fixed this issue and then visreg worked just fine. Thank you!
I would like to use the
<visreg>
package for a mixed effects model but have run into an error about unused formula argument that I is baffling me. I have read over the post on https://rdrr.io/cran/visreg/man/visreg-faq.html, and this ones special topics section for mixed models (https://pbreheny.github.io/visreg/gg.html), but still getting this error despite making various adjustments.My model structure is as follows:
This gives me the following error: Error in lme.formula(fixed = mean_multidiversity ~ mass_fl_pa + scale(C_mg.100g) + : unused argument (formula = formula(fit))
I checked the
<visreg>
code and don't see this error message specified there. So I suppose its from another embedded function, but I don't know where to start looking to resolved the issue.Some advice on how to solve the issue would be much appreciated.