Skip to content

Can't estimate grand mean when there's an offset #666

Description

@capnrefsmmat

I was debugging another issue with offsets and created a simple example to test, and ran into this problem:

> library(modelbased)
> fit <- lm(mpg ~ disp + offset(cyl), data=mtcars)
> estimate_means(fit)
Error: Model contains no categorical predictor. Please specify `by`. Or use `by
  = NULL` to predict the grand mean.
> estimate_means(fit, by=NULL)
Error in startsWith(my_args$by, model_offset) : non-character object(s)

That check comes from here. If there's no offset() term, it works.

I don't know if there's an actual use case for this -- I was just figuring out what was wrong with my other offset() issue, and I may file a bug about it if I narrow it down -- but it's unexpected that the error message tells you to do something that immediately doesn't work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions