[R-lang] Re: % of total variance accounted for by each predictor?

T. Florian Jaeger tiflo@csli.stanford.edu
Tue Aug 3 21:10:21 PDT 2010


Hi Xiao,

I am traveling but if you let me know what the problem is I will try to
help. Since I can't tell from this email what type of model you're running,
let me be clear about one thing: To calculate an R-square for *linear* mixed
models, you don't need that function - it's for mixed logit models (and, as
I think I not on that page, I am actually a it skeptical as to the
usefulness of the Nagelkerke R2).

To calculate R2s for linear mixed models you only need to correlate the
predictions against the actual outcome and square the results (=cor(outcome,
fitted(lmer(outcome ~ .....)))^2). But be careful in the interpretation of
the numbers. Most likely most of the variance the model captures will be due
to the random participant intercepts. It's not uncommon that for, e.g. an R2
of 50%, 45%+ of that come from the random intercept, while the remaining
percent are due to the combined effect of the fixed effect predictors.

The same, of course, applies to the Nagelkerke R2. If you really need such a
measure, you might want to have a look at the following paper for an example
of how one might report the results (though I am curious about what other
people think of this):

*Jaeger, T.F.* 2010. Redundancy and reduction: Speakers manage syntactic
information density. *Cognitive Psychology 61(1), 23-62. *

There is a footnote on the Nagelkerke R2.

Florian

On Tue, Aug 3, 2010 at 6:38 PM, Alex Fine <afine@bcs.rochester.edu> wrote:

> Hey Xiao,
>
> Basically, yes, I think that's what the function requires.  There could be
> something non-obvious about how the formula has to be specified.   That's
> all I can think of....Probably the best thing to do would be to post a reply
> on the blog, let dear florian answer it when he gets a chance, and then
> future users who run into similar problems will see the answer there.  You
> could probably just post your last message, verbatim.
>
> alex
>
>
> Xiao He wrote:
>
>> Hi Alex
>>
>> Sorry that I didn't include any information about my data or code that I
>> used :)
>>
>> I did look at the codes on the page, but they are bit opaque to me.
>> Mainly, I don't understand the syntax of the codes. For example, what
>> exactly should the "f" look like? For example, I have a data sheet where the
>> column "correct" corresponds to the binary responses obtained from
>> participants, and "iv1", "iv2, "iv3", and "iv4" are four columns
>> corresponding to the 4 predictors that I want to evaluate, and "subject" and
>> "item" are the two columns for the random effects. The name of the data
>> sheet is "data".
>>
>> Do I need to do the following? =>  my.lmer.nagelkerke
>> (correct~iv1+iv2+iv3+iv4 + (1|subject) + (1|item), data)
>>
>> This is what I did, but it is wrong. I hope you can help me with this.
>> Thank you :)
>>
>>
>> Best,
>> Xiao
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.ucsd.edu/mailman/private/ling-r-lang-l/attachments/20100804/475ec5ab/attachment.html 


More information about the ling-r-lang-L mailing list