For one thing your call to glm() is wrong --- didn't you notice the
warning messages about ``non-integer #successes in a binomial glm!''?
You need to do either:
glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data,
offset=log(y), weights=k)
or:
glm(cbind(r,k-r) ~ x, family=binomial(link='cloglog'), data=bin_data,
offset=log(y))
You get the same answer with either, but this answer still does not
agree with your
SAS results. Perhaps you have an error in your SAS syntax as well.
I wouldn't know.
cheers,
Rolf Turner
On 10/09/2008, at 10:37 AM, sandsky wrote:
>
> Hello,
>
> I have different results from these two softwares for a simple
> binomial GLM
> problem.
>> From Genmod in SAS: LogLikelihood=-4.75, coeff(intercept)=-3.59,
> coeff(x)=0.95
>> From glm in R: LogLikelihood=-0.94, coeff(intercept)=-3.99, coeff
>> (x)=1.36
>
> Is there anyone tell me what I did wrong?
>
> Here are the code and results,
>
> 1) SAS Genmod:
>
> % r: # of failure
> % k: size of a risk set
>
> data bin_data;
> input r k y x;
> os=log(y);
> cards;
> 1 3 5 0.5
> 0 2 5 0.5
> 0 2 4 1.0
> 1 2 4 1.0
> ;
> proc genmod data=nelson;
> model r/k = x / dist = binomial link =cloglog offset = os ;
>
> <Results from SAS>
>
> Log Likelihood -4.7514
>
> Parameter DF Estimate Error Limits
> Square Pr > ChiSq
>
> Intercept 1 -3.6652 1.9875 -7.5605 0.2302
> 3.40 0.0652
> x 1 0.8926 2.4900 -3.9877 5.7728
> 0.13 0.7200
> Scale 0 1.0000 0.0000 1.0000 1.0000
>
>
>
> 2) glm in R
>
> bin_data <-
> data.frame(cbind(y=c(5,5,4,4),r=c(1,0,0,1),k=c(3,2,2,2),x=c
> (0.5,0.5,1.0,1.0)))
> glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data,
> offset=log(y))
>
> <Results from R>
> Coefficients:
> (Intercept) x
> -3.991 1.358
>
> 'log Lik.' -0.9400073 (df=2)
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}