[R] predict.glm

John Fox jfox at mcmaster.ca
Wed Dec 29 22:42:22 CET 2004


Dear Raj,

I'm not sure that I'm interpreting your question properly, but I'll give it
a shot: When you use a two-level factor as the response variable in a
binomial GLM, the first level is taken to represent "failure" and the second
"success." See ?glm for details. The default order of levels is
alphabetical, so unless you did something to order the levels differently,
"Male" would correspond to success and "Female" to failure. Thus the fitted
probability would be the probability of "Male."

Is that what you wanted to know?

John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
-------------------------------- 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Rajdeep Das
> Sent: Wednesday, December 29, 2004 1:33 PM
> To: R Help Mailing List
> Subject: [R] predict.glm
> 
> Hi All,
> 
> Sorry for this is a very naive question. 
> 
> I am trying to do binary classification (male vs female)  
> using glm using following data:
> 
> X1    X2    X3    Class
> 2.3    4.5    2.1    Male
> 0.9    3.2   1.6     Male
> 1.7    1.8    2.6    Feamle
> 
> 
> 
> I am trying to use predict.glm for prediction with 
> type="respose" which gives the predicted probabilities as per 
> documentation. 
> 
> My question is: which of the two classes does this 
> probability corresponds to? My understanding is that it is 
> the probability of the class that each of the new data has. 
> Is that correct?
> 
> Thanks.
> 
> Raj
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.html




More information about the R-help mailing list