Date: Fri, 9 Oct 1998 15:26:28 +0200
Reply-To: Paul Dickman <paul.dickman@ONKPAT.KI.SE>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Paul Dickman <paul.dickman@ONKPAT.KI.SE>
Subject: Re: user-defined deviance in GENMOD
In-Reply-To: <199810091218.OAA23377@e45.it.ki.se>
Content-Type: text/plain; charset="iso-8859-1"
Hi Hans-Peter,
The outcome is the number of successes, not the proportion.
If you define mu=_MEAN_ then you'll need to use v=mu*(1-mu/n).
Alternatively, define mu=_MEAN_/n and use v=n*mu*(1-mu).
If we call O the observed number of successes and E the
expected (fitted) number of successes out of N trials,
then the deviance increment is given by
d=2[O ln (O/E) + (N-O) ln{(N-O)/(N-E)}]
I would suggest the following code:
v=_MEAN_*(1-_MEAN_/n);
d=2*(_y*log(_y/_MEAN_) + (N-_y)*log((N-_y)/(N-_MEAN_)));
I haven't tested this and would be interested to hear if it works.
Cheers
Paul
-----
Paul Dickman (paul.dickman@onkpat.ki.se)
Cancer Epidemiology Unit, Radiumhemmet,
Karolinska Hospital, 171 76 Stockholm, Sweden
Ph: +46 8 5177 5375 Fax: +46 8 326 113
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@AKH-WIEN.AC.AT]On Behalf Of
Hans-Peter Piepho
Sent: Friday, 9 October 1998 12:52
To: SAS-L@AKH-WIEN.AC.AT
Subject: user-defined deviance in GENMOD
Hi all,
I have tried to use the GENMOD options for userdefined deviances and
variance functions. When specifying the binomial deviance and variance
function, I get strange results, which do not coincide with those
obtained
for the "dist=bin link=logit" call. Does someone known whether this is a
bug?
proc genmod;
class t b;
mu=_MEAN_;
_y=_RESP_;
d=-2*(
_y*log(mu/(1-mu)) + log(1-mu) );
v=mu*(1-mu);
deviance dev=d;
variance var=v;
model m/n=b t t*b/link=logit type1;
run;
proc genmod;
class t b;
model m/n=b t b*t/dist=bin link=logit type1;
run;
Hans-Peter
_______________________________________________________________________
Hans-Peter Piepho
Institut f. Nutzpflanzenkunde WWW: http://www.wiz.uni-kassel.de/fts/
Universitaet Kassel Mail: piepho@wiz.uni-kassel.de
Steinstrasse 19 Fax: +49 5542 98 1230
37213 Witzenhausen, Germany Phone: +49 5542 98 1248