[R-sig-ME] How to compare two coefficent estimates in a multilevel model?
Thierry Onkelinx
thierry.onkelinx at inbo.be
Mon Jan 29 09:52:37 CET 2018
Dear Blazej,
Yes, contrasts are what you are looking for.
And please only cross post if you don't get a reactie within a few days.
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx op inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be
///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////
2018-01-29 9:47 GMT+01:00 Blazej Mrozinski <blazej.mrozinski op gmail.com>:
> Good Morning Thierry,
> yes - that was my goal in this example.
> Although I'm not what should I do if there where mode (say 3 or 4) fixed
> effect estimates. I'd be guessing (based on Ben Bolker suggestion given on
> StackOverflow) that contrasts set by hand are the right approach.
> I already sorted out how to do it (with 2 estimates), in order to match
> results from HLM software - that is
> by using linearHypothesis function from car package:
>
> library(car)
> linearHypothesis(model, "score1=score2")
> Linear hypothesis test
>
> Hypothesis:
> score1 - score2 = 0
>
> Model 1: restricted model
> Model 2: Reaction ~ score1 + score2 + (1 | Subject)
>
> Df Chisq Pr(>Chisq)
> 1
> 2 1 2.8187 0.09317 .
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
> https://stats.stackexchange.com/a/325502/133561
>
> Best Regards,
> Blazej
>
> Blazej Mrozinski
>
> 2018-01-29 9:40 GMT+01:00 Thierry Onkelinx <thierry.onkelinx op inbo.be>:
>>
>> Dear Blazej,
>>
>> Your question is not clear to me. What is the hypothesis that you want
>> to test? H_0: \gamma_{01} = \gamma_{02} ?
>>
>> Best regards,
>>
>> ir. Thierry Onkelinx
>> Statisticus / Statistician
>>
>> Vlaamse Overheid / Government of Flanders
>> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
>> AND FOREST
>> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
>> thierry.onkelinx op inbo.be
>> Havenlaan 88 bus 73, 1000 Brussel
>> www.inbo.be
>>
>>
>> ///////////////////////////////////////////////////////////////////////////////////////////
>> To call in the statistician after the experiment is done may be no
>> more than asking him to perform a post-mortem examination: he may be
>> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
>> The plural of anecdote is not data. ~ Roger Brinner
>> The combination of some data and an aching desire for an answer does
>> not ensure that a reasonable answer can be extracted from a given body
>> of data. ~ John Tukey
>>
>> ///////////////////////////////////////////////////////////////////////////////////////////
>>
>>
>>
>>
>> 2018-01-28 17:43 GMT+01:00 Blazej Mrozinski <blazej.mrozinski op gmail.com>:
>> > Greetings,
>> >
>> > Could anyone help me in answering the following question:
>> >
>> > How can I compare two coefficient estimates from a lme4 or nlme model?
>> >
>> > In HLM7 (software I'm more familiar with) such comparisons are evaluated
>> > with χ2 tests. I can't find out what function in lme4, nlme or just base
>> > can do the same.
>> >
>> > An imaginary example I'm working with, is a modified sleepstudy dataset
>> > -
>> > with two score variables added at level 2. The model being tested is
>> > this:
>> >
>> > Level1:
>> > Reaction=β0+r
>> >
>> > Level2:
>> > β0=γ00+γ01(score1)+γ02(score2)+u0j
>> >
>> > I'm looking for a χ2 comparing both level 2 coefficients (or 3+ if there
>> > are more of them)
>> >
>> > Here is my modified dataset:
>> >
>> > library(lme4)
>> >
>> > set.seed(123)
>> > score1=NULL
>> > score2=NULLfor(i in 1:18) {
>> > x1 = rep(sample(1:5, size = 1), 10)
>> > score1 = c(score1, x1)
>> > x2 = rep(sample(1:5, size = 1), 10)
>> > score2 = c(score2, x2)}
>> >
>> > sleepstudy$score1 <- score1
>> > sleepstudy$score2 <- score2
>> >
>> > model <-lmer(Reaction ~ score1 + score2 + (1|Subject), data=sleepstudy)
>> >
>> > Best regards,
>> > Blazej Mrozinski
>> >
>> > ps. this question was posted on CrossValidated:
>> >
>> > https://stats.stackexchange.com/questions/325302/how-to-compare-two-coefficent-estimates-in-a-multilevel-model
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > _______________________________________________
>> > R-sig-mixed-models op r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
More information about the R-sig-mixed-models
mailing list