Message-ID: <15703.29395.194946.482401@gargle.gargle.HOWL>
Date: 2002-08-12T08:33:23Z
From: Martin Maechler
Subject: GLM Contingency table regressions
In-Reply-To: <001201c240a0$89607420$345c5242@p800>
>>>>> "PaulMJ" == Paul M Jacobson <pmj at jciconsult.com>
>>>>> on Sat, 10 Aug 2002 15:02:55 -0400 writes:
PaulMJ> I have a contingency table with a 0/1 variable (fwr)
PaulMJ> that flags a particular condition, a weight variable
PaulMJ> (cnt) and other variables (e.g. zz) characterizing
PaulMJ> that observation of the table. I am trying to use
PaulMJ> GLM. By converting the variables to factors and
PaulMJ> running the following regression:
PaulMJ> fwr1<-factor(fwr)
PaulMJ> zz1<-factor(zz1)
PaulMJ> res1<-glm(fwr1 ~ zz1,weights=cnt)
(spaces around "<-" would improve readibility}
PaulMJ> Is that appropriate?
not quite.
Assuming that you really want to predict (a function of) the
probability P[ fwr = 1 | zz1 ]
you need at least to add
family = binomial
to your glm() arguments.
The thing you did above was least-squares regression with a 0/1 variable
which is probably not what you wanted.
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._