Help with understanding my GLM code

Good afternoon,

I have a code that I am supposed to use but I do not understand it, could someone take 2 minutes just to describe what is happening here?

Thank you so much!!

model <- lm(VegetationGrowth + Fire + Rain + Area + Damage * Rain + (1|Site) + (1|Species), data = Vegetation)

I know my variables, that data is to add my data sheet, that + are for adding the different variables, but I'm still confused

That does not seem like a valid call to lm(). First, there is no dependent variable in the formula. I would expect something like

model <- lm(y ~ VegetationGrowth + Fire + Rain + Area + Damage * Rain + (1|Site) + (1|Species), data = Vegetation)

so that lm() fits y as a function of all the listed variables.
Second, I do not think that (1|Site) and (1|Species) are valid in lm(). In some other functions like lmer from the lme4 package, that notation allows the model to have a different intercept for every value of Site and every value of Species.
The notation Damage * Rain is valid in lm() and it means the same as

Damage + Rain + Damage:Rain

The damage and Rain terms contribute to the model as normal variables and Damage:Rain designates the interaction of Damage and Rain.

What you have then, is a model that fits some unspecified dependent variable against VegetationGrowth, Fire, Rain, Area, Damage, Rain, and the interaction of Damage and Rain, and the model intercept can be different for each value of Site and Species. As I said, I do not think the varying intercepts are allowed in lm().

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.