eggde43
eggde43

Reputation: 3

Trying to run this generalised linear model to find the effect on mass of crickets by multiple random effects and I am getting this following error

I am trying to run a glm model to check the variation in the mass of cricket which could be affected by age(numeric), altitude(High or low), temperature(two different temperatures) and the incubators(4 different incubators) they are kept it.

I have tried the glm model which seems to be fine theoretically. The data on excel is all checked as well. I am assuming I have to convert some of the data into binary or some sorts.

glm(crick$Mass ~ crick$Altitude*crick$Age + crick$Altitude*crick$suare(Altitude) + 1/crick$Nymph.ID + 1/crick$Population + crick$Temperature*crick$Altitude + 1/crick$Incubator)

This is the code I am trying to run.

Error in eval(predvars, data, env) : attempt to apply non-function this is the error message.

Upvotes: 0

Views: 59

Answers (1)

Roman Luštrik
Roman Luštrik

Reputation: 70653

You need to properly specify the formula (e.g. see examples in ?glm). Try

glm(Mass ~ Altitude*Age + 1/Nymph.ID + 1/Population + Temperature*Altitude + 1/Incubator, data = cricks)

Note that I excluded Altitude*suare(Altitude) which is invalid R syntax for formulas. You'll have to explain more what you're trying to go with here.

Upvotes: 0

Related Questions