# [R] How to intepret a factor response model?

Maciej Bliziński m.blizinski at wsisiz.edu.pl
Wed May 4 09:23:17 CEST 2005

```Hello,

I'd like to create a model with a factor-type response variable. This is
an example:

> mydata <- data.frame(factor_var = as.factor(c(rep('one', 100), rep('two', 100), rep('three', 100))), real_var = c(rnorm(150), rnorm(150) + 5))
> summary(mydata)
factor_var     real_var
one  :100   Min.   :-2.742877
three:100   1st Qu.:-0.009493
two  :100   Median : 2.361669
Mean   : 2.490411
3rd Qu.: 4.822394
Max.   : 6.924588
> mymodel = glm(factor_var ~ real_var, family = 'binomial', data = mydata)
> summary(mymodel)

Call:
glm(formula = factor_var ~ real_var, family = "binomial", data = mydata)

Deviance Residuals:
Min       1Q   Median       3Q      Max
-1.7442  -0.6774   0.1849   0.3133   2.1187

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)  -0.6798     0.1882  -3.613 0.000303 ***
real_var      0.8971     0.1066   8.417  < 2e-16 ***
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 381.91  on 299  degrees of freedom
Residual deviance: 213.31  on 298  degrees of freedom
AIC: 217.31

Number of Fisher Scoring iterations: 6

---------------------------------------------------------------------

For models with real-type response variable it's easy to figure out,
what's the equation for the response variable (in the model). But here
- how do I interpret the model?

--
God made the world in six days, and was arrested on the seventh.

```