How can I test contrasts in are using glht?

How can I test contrasts in are using glht?

There are other ways in which the contrasts to be tested can be expressed in glht. For the details of these other matrix-less methods, see this glht vignette. This approach works for other types of model objects, including glm and lme.

How to create a contrast of interest in multcomp?

We can do so by defining a contrast of interest and testing it with the glht (generalized linear hypothesis test) command in the multcomp package. To define the contrast, we can look at the order in which the coefficients are presented in the output, then create a vector the length of the coefficient list (including the intercept).

How can I test differences of differences in R?

To test “differences of differences”–is the difference between ses = 2 and ses = 3 different for female = 0 vs. female = 1– we can define our contrast as the difference in the vectors we defined above and test this using glht: Above is the resulting vector of contrast coefficients to test this difference of differences.

How can I test all possible pairwise combinations?

We can also test all possible pairwise combinations. To make this easier, we will first create an “interaction” variable (using the function, interaction ) whose levels are created as a combination of the levels of ses and female.

How are multiple comparisons specified in glht model?

a specification of the linear hypotheses to be tested. Linear functions can be specified by either the matrix of coefficients or by symbolic descriptions of one or more linear hypotheses. Multiple comparisons in AN (C)OVA models are specified by objects returned from function mcp.

Can You Help me understand the glht function?

If I try using glht with interaction_average=FALSE I get more reasonable results but with a warning message: Can someone help me to understand what I am doing wrong? Thank-you!!! This is because the glht function is only evaluating differences among treatments, as specified.

Why does the glht function print a warning?

This is because the glht function is only evaluating differences among treatments, as specified. It prints a warning because the interaction term in your model implies that it can’t just compare means by level of treatment in a straightforward manner. I would suggest you add another column to your data set that combines site by treatment.