Ben - 1 year ago 89
R Question

# R-Squared of lmer model fit

I have a mixed effects model and I would like to see the R²- and p-value. I thought this is acessible by summary() but it's not. Or at least I don't realize it.

``````> summary(fit1.lme <- lmer(log(log(Amplification)) ~ poly(Voltage, 3) + (1 | Serial_number), data = bdf))
Linear mixed model fit by REML ['lmerMod']
Formula: log(log(Amplification)) ~ poly(Voltage, 3) + (1 | Serial_number)
Data: bdf

REML criterion at convergence: -253237.6

Scaled residuals:
Min       1Q   Median       3Q      Max
-14.8183  -0.4863  -0.0681   0.2941   9.3292

Random effects:
Groups        Name        Variance Std.Dev.
Serial_number (Intercept) 0.008435 0.09184
Residual                  0.001985 0.04456
Number of obs: 76914, groups:  Serial_number, 1270

Fixed effects:
Estimate Std. Error t value
(Intercept)         0.826745   0.002582     320
poly(Voltage, 3)1 286.978430   0.045248    6342
poly(Voltage, 3)2 -74.061993   0.045846   -1615
poly(Voltage, 3)3  39.605454   0.045505     870

Correlation of Fixed Effects:
(Intr) p(V,3)1 p(V,3)2
ply(Vlt,3)1 0.001
ply(Vlt,3)2 0.002  0.021
ply(Vlt,3)3 0.001  0.032   0.028
``````

For the R², you can use `r.squaredGLMM(fit1.lme)` from `‘MuMIn` package. It will returns the marginal and the conditional R².
For the p-value, you can find them by using `summary` with the `lmerTest` package.