user2963880
user2963880

Reputation: 65

Error when running glm with family=gamma

I usually use SAS, so I am not too familiar with R so sorry if this is a basic question. I have run a model and it is coming up with the following error

Error in family() : 0 arguments passed to 'gamma' which requires 1

Does anyone know what that means? Have looked everywhere with no success

The code is below:

model1<-glm(heartrate ~ age+age*age+sex, family=gamma, data=df)

Upvotes: 5

Views: 7089

Answers (1)

Thomas
Thomas

Reputation: 44527

The problem here is the difference between gamma and Gamma.

Gamma() is a family object, like binomial, gaussian, etc:

class(Gamma())
? Gamma

Whereas gamma() is a mathematical operation:

gamma(1:10)
? gamma

You want:

model1 <- glm(heartrate ~ age+age*age+sex, family=Gamma, data=df)

Upvotes: 10

Related Questions