lost student
lost student

Reputation: 11

what does a colon (:) do in a linear mixed effects model analysis?

Let me clarify that I am a complete beginner at R.

I'm working on a problem and having a bit of trouble understanding a formula I'm supposed to use in a linear mixed effects model analysis of a dataset, more specifically this formula,

ModelName <- lmer(outcome ~ predictor1 + predictor2 + predictor1:predictor2 + (random_structure), data = DatasetName)

I don't know what the predictor1:predictor2 part of it means, could anyone please help me understand or link to something I can read to understand?

I've run the code and it gives an additional output for the predictor2 part of the formula which doesnt happen when you dont include that part.

Upvotes: 1

Views: 670

Answers (1)

Karl Edwards
Karl Edwards

Reputation: 335

Wow! You may be new to R, but you ask a great question!

As you probably know already, the + operator separates terms in a model.

Y ~ a + b + c means that the response is modeled by a linear combination of a, b, and c.

The colon operator denotes interaction between the items it separates, for example:

Y ~ a + b + a:b means that the response is modeled by a linear combination of a, b, and the interaction between a and b.

I hope this helps!

Rose Hartman explains how interactions affect linear models, and why it’s important to consider them in Understanding Interactions in Linear Models https://education.arcus.chop.edu/understanding-interactions/

Upvotes: 2

Related Questions