Many thanks.


Another question:
model<- glm(count ~ drug*result, family = poisson)


> anova(model,test="Chisq")
         Df Deviance Resid. Df Resid. Dev  Pr(>Chi)    
NULL                            3     47.522              
drug         1    0.032         2     47.491   0.85858    
result       1   41.187         1      6.304 1.383e-10 ***
drug:result  1    6.304         0      0.000   0.01205 *  


The pvalue of drug is 0.85858,which indicates that the total count of drug1 and drug2 are not significantly different at 0.05 level.


But:


> summary(model)
Coefficients:
              Estimate Std. Error z value Pr(>|z|)    
(Intercept)     2.0794     0.3536   5.882 4.06e-09 ***
drug2           0.9163     0.4183   2.190   0.0285 *  
result2         1.9095     0.3788   5.041 4.64e-07 ***
drug2:result2  -1.1211     0.4650  -2.411   0.0159 *  


The pvalue of drug2 is  0.0285 *  ,which indicates that the total count of drug2 is significantly different from drug1 at 0.05 level,which contradict to the result of anova.


Can you give me some help about that ?


Many thanks.




Best












At 2013-05-13 18:56:01,"Achim Zeileis" <Achim.Zeileis@uibk.ac.at> wrote:
>On Mon, 13 May 2013, meng wrote:
>
>> Hi all:
>> I have a question about poisson regression.
>>
>> My data:
>> drug result count
>> 1       1          8
>> 1       2        54
>> 2       1       20
>> 2       2      44
>>
>> My model:
>> model<- glm(count ~ drug*result, family = poisson)
>>
>> My result:
>> summary(model)
>>
>> Coefficients:
>>              Estimate Std. Error z value Pr(>|z|)
>> (Intercept)     2.0794     0.3536   5.882 4.06e-09 ***
>> drug2           0.9163     0.4183   2.190   0.0285 *
>> result2         1.9095     0.3788   5.041 4.64e-07 ***
>> drug2:result2  -1.1211     0.4650  -2.411   0.0159 *
>>
>> Calculation of coefficients:
>> Intercept: drug=1 and result=1,the corresponding count is 8.So log(8) is 2.079442 which is Intercept.
>>
>> My question: How is drug2 calculated? log(64)-log(62) or something like 
>> that(indicates the difference between drug2 and drug1) ? I've searched 
>> and tried many times for all possible solutions,but the result is not 
>> 0.9163.So,how is drug2 calculated ?
>
>It's the drug2 effect (on a log-scale) for result=1, i.e.,
>log(20) - log(8).
>
>The four coefficients are:
>
>R> y <- c(8, 20, 54, 44)
>R> c(log(y[1]), log(y[2]) - log(y[1]), log(y[3]) - log(y[1]),
>+    (log(y[4]) - log(y[3])) - (log(y[2]) - log(y[1])))
>[1]  2.0794415  0.9162907  1.9095425 -1.1210851
>
>> Many thanks!
>>
>>
>> Best
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>

	[[alternative HTML version deleted]]

