How family attribute affect the logistic model in R

r
logistic_regression

#1

I an currently working on logistic model in R and while building my model I am getting different values of all varible when I am using family attribute in model

without family attribute in model
model1<-glm(formula=vs~wt+disp,data=mtcars)

Call: glm(formula = vs ~ wt + disp, data = mtcars)

Coefficients:
(Intercept) wt disp
0.808237 0.184911 -0.004185

Degrees of Freedom: 31 Total (i.e. Null); 29 Residual
Null Deviance: 7.875
Residual Deviance: 3.686 AIC: 29.65

with family attribute
model1<-glm(formula=vs~wt+disp,data=mtcars,family=“binomial”)

Call: glm(formula = vs ~ wt + disp, family = “binomial”, data = mtcars)

Coefficients:
(Intercept) wt disp
1.60859 1.62635 -0.03443

Degrees of Freedom: 31 Total (i.e. Null); 29 Residual
Null Deviance: 43.86
Residual Deviance: 21.4 AIC: 27.4

I am not able how family attribute affect the model


#2

Hello,

The family attribute refers to the function with which we are trying to fit on the data. When the family attribute wasn’t added the glm function took the default gaussian family, that is it fitted a gaussian model on the data. When you changed the family to binomial it now fitted a binomial function to the data. Hence the difference.

Regards