[R-sig-ME] Statistical significance of random-effects (lme4 or others)

Simon Harmel @|m@h@rme| @end|ng |rom gm@||@com
Mon Sep 7 05:47:36 CEST 2020


Dear Victor,

I'm looking for the p-value for the "variance components", the variance (or
sd) estimated for random-effects in the 4 models I showed?

For example, for m1 I'm looking for the p-value for the terms shown below.

Linear mixed model fit by REML ['lmerMod']
Formula: math ~ 1 + (1 | sch.id)
   Data: hsb

REML criterion at convergence: 47116.8

Scaled residuals:
    Min      1Q  Median      3Q     Max
-3.0631 -0.7539  0.0267  0.7606  2.7426

Random effects: *************
 Groups   Name        Variance Std.Dev.
 sch.id   (Intercept)  8.614   2.935             *****P-VALUE HERE?****
 Residual             39.148   6.257               **** P_VALUE HERE? ****
Number of obs: 7185, groups:  sch.id, 160

On Sun, Sep 6, 2020 at 10:15 PM Simon Harmel <sim.harmel using gmail.com> wrote:

> Hi Victor,
>
> Thanks for your response. First, as far as I know "lsmeans" has now become
> "emmeans".
>
> Second, all my data and code is 100% reproducible, would you please let me
> know how can I possibly obtain the p-value for the random-effects' variance
> components in any of the 4 models I showed in my original question?
>
> Thanks, Simon
>
> On Sun, Sep 6, 2020 at 9:42 PM Victor Oribamise <
> victor.oribamise using gmail.com> wrote:
>
>> Hey Simon,
>>
>> You can check the lsmeans package in R, you can obtain p values for your
>> models using the package
>>
>> Victor
>>
>> On Sun, Sep 6, 2020 at 9:38 PM Simon Harmel <sim.harmel using gmail.com> wrote:
>>
>>> Dear All,
>>>
>>>
>>>
>>> Most MLM packages (e.g., HLM, SPSS, SAS, STATA) provide a p-value for the
>>>
>>> variance components.
>>>
>>>
>>>
>>> My understanding based on (
>>>
>>>
>>> https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#testing-significance-of-random-effects
>>> )
>>>
>>> is that this is not possible to achieve in R, right?
>>>
>>>
>>>
>>> If not, for my 4 models below, I assume I need to compare, using anova(),
>>>
>>> each model against its OLS equivalent to obtain a likelihood ratio test
>>>
>>> p-value for each model's variance component, correct?
>>>
>>>
>>>
>>> hsb <- read.csv('
>>>
>>> https://raw.githubusercontent.com/rnorouzian/e/master/hsb.csv')
>>>
>>>
>>>
>>> library(lme4)
>>>
>>> m1 <- lmer(math ~ 1 + (1|sch.id), data = hsb)
>>>
>>> m2 <- lmer(math ~ meanses + (1|sch.id), data = hsb)
>>>
>>> m3 <- lmer(math ~ ses + (ses | sch.id), data = hsb)
>>>
>>> m4 <- lmer(math~ ses * meanses + (ses | sch.id ), data = hsb)
>>>
>>>
>>>
>>> ols1 <- lm(math ~ 1, data = hsb)
>>>
>>> ols2 <- lm(math ~ meanses, data = hsb)
>>>
>>> ols3 <- lm(math ~ ses, data = hsb)
>>>
>>> ols4 <- lm(math ~ ses * meanses, data = hsb)
>>>
>>>
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> R-sig-mixed-models using r-project.org mailing list
>>>
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>>

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list