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

Fixed scheffe.test for mixed models #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesgj
Copy link

@jesgj jesgj commented Oct 16, 2023

I was working with the "mixlm" package, utilizing the lm() function to construct a mixed model, which consists of two factors one fixed and the other random. However, when I attempted to perform the Scheffe test using scheffe.test(mixed_model, trt = "fixed_factor"), I encountered the following error: "Error in anova(y)[trt, 4]: incorrect number of dimensions."

The model was: lm(response ~ fixed_factor + r(random_factor) + fixed_factor:r(random_factor), unrestricted = F)

I identified that this error comes from the disparity in the output of anova(mixed_model), which is distinct from the output of a model with two fixed factors. This discrepancy affects the localization of the F-value.

To address this issue, I added a new argument, mixm, to the function. By default, mixm is set to FALSE.

When mixm is set to FALSE, the F-value is located as follows: Fc <- anova(y)[trt, 4]
When mixm is set to TRUE, the F-value is located as follows: Fc <- anova(y)$anova[trt, 4] (for mixed models)

This modification ensures that the F-value is accurately retrieved based on the user's choice of the mixm parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant