Skip to content

Contrast with interaction terms #5

@alanocallaghan

Description

@alanocallaghan

From John Sorkin via email

Does the package automatically handle an interaction term, e.g. for the model and contrast statement below,

fit1 <- lm(y~ x + z + x*z)

contrast(x=10, z=10)

Will the contrast statement include in its calculation the x*z interaction? Some testing I have done suggests it does not.

If I am correct (that the contrast statement written above does NOT include the interaction term in its computation), is there a way to specify the interaction in the contrast statement?

I have tried contrast(x=10, z=10, xz=100), contrast(x=10, z=10, xz=100), contrast(x=10, z=10, “xz”=100) none of which run; all produce an error message.

In a model with an offset, will the contrast statement work and include the offset in its computation, for example

fit2 <- lm(y~ x + z + x*z + offset=offset)

contrast(fit2, x=10, y=10)

Some experimentation suggests the contrast function does not account for the offset.

Assuming I am correct, that the offset term is NOT honored in the contrast statement, is there a way to write a contrast statement that will work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions