Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ranef to ranef.mcpfit #105

Open
JFormoso opened this issue Feb 24, 2021 · 2 comments
Open

Rename ranef to ranef.mcpfit #105

JFormoso opened this issue Feb 24, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@JFormoso
Copy link

Hi!
I was wondering if you could help me with this. When I run this code:

model = list(
acc | trials(N) ~ 1,
1 + (1|id) ~ 0 + numerosity)

fit<- mcp(model, data = df, family = binomial())
summary(fit)
ranef(ift)

I get the following error:

Error in UseMethod("ranef") :
no applicable method for 'ranef' applied to an object of class "mcpfit"

Before that I tried using the following code with a slightly different dataset so I could use the bernoulli family:

model = list(
acc ~ 1,
1 + (1|id) ~ 0 + numerosity
)

fit<- mcp(model, data = df, family = bernoulli())
summary(fit)
ranef(ift)

I got the same error.

Thanks in advance!!

@lindeloev
Copy link
Owner

Did you load lme4 or the like after loading mcp, getting a message like "The following objects are masked from ‘package:mcp fixef ranef’"? It may be trying to use lme4::ranef() on an mcpfit object. It's a bug that mcp defines ranef instead of ranef.mcpfit so thanks for reporting!

It can be temporarily can be solved by inserting

ranef.mcpfit = mcp::ranef
ranef(fit)

(You have a typo in ranef(ift))

@lindeloev lindeloev added the bug Something isn't working label Feb 24, 2021
@lindeloev lindeloev self-assigned this Feb 24, 2021
@JFormoso
Copy link
Author

Did you load lme4 or the like after loading mcp, getting a message like "The following objects are masked from ‘package:mcp fixef ranef’"? It may be trying to use lme4::ranef() on an mcpfit object. It's a bug that mcp defines ranef instead of ranef.mcpfit so thanks for reporting!

It can be temporarily can be solved by inserting

ranef.mcpfit = mcp::ranef
ranef(fit)

(You have a typo in ranef(ift))

Yeessss!! Thank you. That was the problem (the lme4, not the typo).

@lindeloev lindeloev changed the title no applicable method for 'ranef' applied to an object of class "mcpfit" Rename ranef to ranef.mcpfit Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants