- This message: [ Message body ] [ More options ]
- Related messages: [ Next message ] [ Previous message ] [ Next in thread ] [ Replies ]

From: Maciej Bliziński <m.blizinski_at_wsisiz.edu.pl>

Date: Wed 04 May 2005 - 17:23:17 EST

> mymodel = glm(factor_var ~ real_var, family = 'binomial', data = mydata)

> summary(mymodel)

Date: Wed 04 May 2005 - 17:23:17 EST

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)

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

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. ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Wed May 04 17:27:36 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:33 EST
*