It's the (typical) na.action = na.omit problem. You have missing values
in your data, so the number of observations differs between models using
different variables.

BTW with the recent lme4 package, your code throws a lot of warnings
about the use of lmer with non-gaussian family and ignored REML
argument. Also, consider using "update" rather than rewriting the models
each time.

kamil

On 2013-11-15 17:10, Lilly Dethier wrote:
Of course! Here's my data file and R code file. Thanks so much for your
help!!


Lilly Dethier


On Fri, Nov 15, 2013 at 8:14 AM, Kamil Bartoń <k.bar...@abdn.ac.uk
<mailto:k.bar...@abdn.ac.uk>> wrote:

    works ok with mock-up data. Can you give some code to reproduce this
    error?

    kamil



    On 2013-11-15 11:00, r-help-requ...@r-project.org
    <mailto:r-help-requ...@r-project.org> wrote:

        Message: 56
        Date: Thu, 14 Nov 2013 18:01:27 -0800
        From: Lilly Dethier<lillydeth...@gmail.com
        <mailto:lillydeth...@gmail.com>__>
        To:r-help@r-project.org <mailto:to%3ar-h...@r-project.org>
        Subject: [R] Error in MuMIn "models are not all fitted to the same
               data"
        Message-ID:

        <CAOK+e=Z_0pMEFKdPxZ5Eub+__DYhHFjzGk3Lcqczsa9TimAP4n_w@__mail.gmail.com
        <mailto:z_0pmefkdpxz5eub%2bdyhhfjzgk3lcqczsa9timap4...@mail.gmail.com>>
        Content-Type: text/plain

        I'm pretty new to GLMMs and model averaging, but think I'm
        getting some
        understanding of it all through lots of reading. However, I keep
        receiving
        an error message when trying to average models that I don't
        understand and
        can't find any resources about. I'm doing science education
        research trying
        to evaluate population demographic factors that predict biology
        student
        math performance. I have a lot of factors and so I tested a lot
        of models.
        6 of my models had pretty similar AIC values (and evidence
        ratios of less
        than 2.7) so I'm trying to average them. I keep receiving an
        error message
        that says the models are not fitted to the same data, but I have
        no idea
        how this is possible because all the models are from the same
        set of data
        (same file and same variables)...strangely it seems to work when
        I try to
        average MEx7, MEx10, & MEx22 only OR MEx24, MEx29, and MEx47
        only. My code
        is below. Any ideas? Thanks for any advice you can offer!!

        library(MuMIn)
        MEx7=lmer(cbind(c.score, w.score) ~ year + transfer + gender +
        p.math +
        (1|section) + (1|quarter), family=binomial, data=survey.full,
        REML=F)
        MEx10=lmer(cbind(c.score, w.score) ~ transfer + gender + p.math
        + Pmajor +
        (1|section) + (1|quarter), family=binomial, data=survey.full,
        REML=F)
        MEx22=lmer(cbind(c.score, w.score) ~ year + transfer + p.math +
        (1|section)
        + (1|quarter), family=binomial, data=survey.full, REML=F)
        MEx24=lmer(cbind(c.score, w.score) ~ transfer + gender + p.math +
        (1|section) + (1|quarter), family=binomial, data=survey.full,
        REML=F)
        MEx29=lmer(cbind(c.score, w.score) ~ transfer + p.math + Pmajor +
        (1|section) + (1|quarter), family=binomial, data=survey.full,
        REML=F)
        MEx47=lmer(cbind(c.score, w.score) ~ transfer + p.math +
        (1|section) +
        (1|quarter), family=binomial, data=survey.full, REML=F)
        MExAvg=model.avg(rank=AIC, MEx24, MEx7, MEx10, MEx47, MEx29, MEx22)

        Error in model.avg.default(rank = AIC, MEx24, MEx7, MEx10,
        MEx47, MEx29,  :
            models are not all fitted to the same data
        Lilly Dethier







The University of Aberdeen is a charity registered in Scotland, No SC013683.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to