Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotConf for lmer models #4

Closed
bozenne opened this issue May 2, 2017 · 1 comment
Closed

plotConf for lmer models #4

bozenne opened this issue May 2, 2017 · 1 comment

Comments

@bozenne
Copy link
Collaborator

bozenne commented May 2, 2017

Hi Klaus,

Melanie would like to use the plotConf function for mixed models (e.g. lmer object).
But she gets the following error:
"Error in if (fixed.only) { : argument is of length zero"

example:

library(lme4)
library(lava)
n <- 100
x0 <- rnorm(n)
x1 <- seq(-3,3, length.out=n)
x2 <- factor(rep(c(1,2),each=n/2), labels=c("A","B"))
y <- 5 + 2*x0 + 0.5*x1 + -1*(x2=="B")*x1 + 0.5*(x2=="B") + rnorm(n, sd=0.25)
dd <- data.frame(y=y, x1=x1, x2=x2)
dd$Id <- rbinom(n, size = 3, prob = 0.3)
lmer0 <- lmer(y ~ x0 + x1*x2 + (1|Id), dd)
plotConf(lmer0, var1="x1", `var2="x2")

I think this is because lme4:::model.frame.merMod has an additional argument fixed.only compare to the standard stats:::model.frame.lm
I have tried to fixed, as well as another error due to the fact that when extracting the covariance matrix in lmer we get an object and not a matrix (so I have applied as.matrix to it).
In the following file you will find the change that I suggest:
plotConf.txt
(it should be an .R file but I could not load it so I converted it to a .txt file)

Thanks

@kkholst
Copy link
Owner

kkholst commented May 7, 2017

Thanks. Merged into the develop branch.

@kkholst kkholst closed this as completed May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants