Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.