Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7436171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:11:47+00:00 2026-05-29T10:11:47+00:00

I have fit my discrete count data using a variety of functions for comparison.

  • 0

I have fit my discrete count data using a variety of functions for comparison. I fit a GEE model using geepack, a linear mixed effect model on the log(count) using lme (nlme), a GLMM using glmer (lme4), and a GAMM using gamm4 (gamm4) in R.

I am interested in comparing these models and would like to plot the expected (predicted) values for a new set of data (predictor variables). My goal is to compare the predicted effects for each model under particular conditions (x variables). Of particular interest is the comparison between marginal (GEE) and conditional estimates.

I think my main problem might be getting the new data in the correct form with the correct labels and attributes and such. I am still very much an R novice and struggle with this stuff (no course on this at my university unfortunately).

I currently have fitted models

gee1 lme1 lmer1 gamm1

and can extract their fixed effect coefficients and standard errors without a problem. I also don’t have a problem converting them from the log scale or estimating confidence intervals accounting for the random effects.

I also have my new dataframe newdat which has 365 observations of 23 variables (average environmental data for each day of the year).

I am stuck on how to predict new count estimates from this. I played around with the model.matrix function but couldn’t get it to work. For example, I tried:

mm = model.matrix(terms(glmm1), newdat) # Error in model.frame.default(object, 
                                        # data, xlev = xlev) : object is not a matrix
newdat$pcount = mm %*% fixef(glmm1)

Any suggestions or good references would be greatly appreciated. Can anyone help with the error above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:11:48+00:00Added an answer on May 29, 2026 at 10:11 am

    Getting predictions for lme() and lmer() is documented on http://glmm.wikidot.com/faq

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed rapache and I am trying to fit a linear model inside
I fit a count model to a vector of actual data and would now
I used model fitting to fit the negative binomial distribution to my discrete data.
I have fit a regression using lme4 thanks to a previous answer . Now
I have a vector of discrete data and I want to simulate from the
I have a web page that doesnt fit screen in normal resolution, so I
I have a wide flash movie (to fit in more screen resolution). I would
I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300)
I have a class that parses very large file (that can't fit in memory)
I have 6 images sized 50x50 that are supposed to fit in a 300px

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.