[R] ANCOVA/glm missing/ignored interaction combinations
Mark Difford
mark_difford at yahoo.co.uk
Wed Sep 3 12:51:21 CEST 2008
And perhaps I should also have added: fit your model without an intercept and
look at your coefficients. You should be able to work it out from there
quite easily. Anyway, you now have the main pieces.
Regards, Mark.
Mark Difford wrote:
>
> Hi Lara,
>
>>> And I cant for the life of me work out why category one (semio1) is
>>> being ignored, missing
>>> etc.
>
> Nothing is being ignored Lara --- but you are ignoring the fact that your
> factors have been coded using the default contrasts in R, viz so-called
> treatment or Dunnett contrasts. That is, your intercept is semio1 and the
> other coefficients are calculated off it, hence the name treatment
> contrasts.
>
> In general this type of coding is recommended for GLM models (but this can
> raise deep divisions, as some don't consider them to be proper contrasts
> because they are not orthogonal). Perhaps you should read up on how dummy
> variables are coded.
>
> To really understand this you will have to move away from ?contrasts as a
> source. It might also help you to do the following on a simpler model:
>
> ?dummy.coef
> dummy.coef(saved.glm/lm.model)
>
> This shows how it is worked out.
>
> HTH, Mark.
>
>
> lara harrup (IAH-P) wrote:
>>
>> Hi
>>
>> I am using R version 2.7.2. on a windows XP OS and have a question
>> concerning an analysis of covariance with count data I am trying to do,
>> I will give details of a scaled down version of the analysis (as I have
>> more covariates and need to take account of over-dispersion etc etc) but
>> as I am sure it is only a simple problem but I just can't see how to fix
>> it.
>>
>> I have a data set with count data as the response (total) and two
>> continuous covariates and one categorical explanatory variable (semio).
>> When I run the following lines, after loading the data and assigning
>> 'semio' as a factor, taking into account that I want to consider two way
>> interactions:
>>
>>> model.a<-glm(total~(temperature+humidity+semio)^2,family=poisson)
>>> summary(model.a)
>>
>> I get the output below. But not all interactions are listed there are 4
>> semio categories, 1,2,3 and 4 but only 2,3,and 4 are listed in the
>> summary (semio2,semio3,semio4). And I cant for the life of me work out
>> why category one (semio1) is being ignored, missing etc.
>>
>> Any help or suggestions would be most appreciated. Thanks in advance
>>
>> Lara
>> lara.harrup at bbsrc.ac.uk
>>
>> Call:
>> glm(formula = total ~ (temperature + humidity + semio)^2, family =
>> poisson)
>>
>> Deviance Residuals:
>> Min 1Q Median 3Q Max
>> -22.212 -5.132 -2.484 3.200 18.793
>>
>> Coefficients:
>> Estimate Std. Error z value Pr(>|z|)
>> (Intercept) 23.848754 2.621291 9.098 < 2e-16 ***
>> temperature -1.038284 0.150465 -6.901 5.18e-12 ***
>> humidity -0.264912 0.033928 -7.808 5.81e-15 ***
>> semio2 22.852664 1.291806 17.690 < 2e-16 ***
>> semio3 3.699901 1.349007 2.743 0.0061 **
>> semio4 -1.851163 1.585997 -1.167 0.2431
>> temperature:humidity 0.012983 0.001983 6.545 5.94e-11 ***
>> temperature:semio2 -0.870430 0.037602 -23.149 < 2e-16 ***
>> temperature:semio3 -0.060846 0.038677 -1.573 0.1157
>> temperature:semio4 0.055288 0.046137 1.198 0.2308
>> humidity:semio2 -0.114718 0.013369 -8.581 < 2e-16 ***
>> humidity:semio3 -0.031692 0.013794 -2.298 0.0216 *
>> humidity:semio4 0.008425 0.016020 0.526 0.5990
>> ---
>> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>>
>> (Dispersion parameter for poisson family taken to be 1)
>>
>> Null deviance: 10423.5 on 47 degrees of freedom Residual deviance:
>> 2902.2 on 35 degrees of freedom
>> AIC: 3086.4
>>
>> Number of Fisher Scoring iterations: 7
>>
>> ______________________________________________
>> R-help at 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.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/ANCOVA-glm-missing-ignored-interaction-combinations-tp19285259p19286930.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list