[R] p value for coefficients in multinomial model
jfox at mcmaster.ca
Thu Apr 5 16:08:54 CEST 2007
Dear Xingwang Ye,
As it says on the help page for Anova(), "Be very careful in formulating the
model for type-III tests, or the hypotheses tested will not make sense."
It looks as if you fit the model with the default contrast coding for the
factors, contr.treatment. To get sensible "Type-III" sums of squares, you
have to use contrasts that are orthogonal in the row basis of the model
matrix, such as contr.sum.
SAS takes a different approach from R, using a deficient-rank
parametrization of the model, and then in effect placing a restriction on
the parameters that is equivalent to contr.treatment; it calculates
sums-of-squares in a manner that's independent of the parametrization, while
Anova() does not.
I hope this helps,
Department of Sociology
Canada L8S 4M4
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Xingwang Ye
> Sent: Thursday, April 05, 2007 9:01 AM
> To: r-help
> Subject: [R] p value for coefficients in multinomial model
> Dear all,
> 1)how can I easily get p value for the coefficients of
> factors in a multinomial model?
> 2)why the p values for "type III" test with Anova are not
> identical to that from SAS?
> for example:
> A,B and C are categorical variables,but the proportions of
> each level in each categorical variables are not balance. Y
> is a nominal variables(>=3 categories);
> To do multinomial logistic regression in SAS, I tried proc
> logistic data=a;
> class A B C Y/param = ref ref = first;
> model Y=A B C/link=logit;
> In R, I tried this:
> b <- as.data.frame(lapply(a[,c("A","B","C","Y")], as.factor))
> mod.mul<- (Y~A+B+C,data=b)
> I can get the identical coefficients and std.errors in R as
> in SAS. how can I easily get the p value for each
> coeefficients? However,the "LR Chisq" for each variables are
> similar but not identical to that from SAS, why?
> BTW,please forward your kind answers to my email. Thank you.
> Best wishes
> yours, sincerely
> Xingwang Ye
> PhD candidate
> Research Group of Nutrition Related Cancers and Other Chronic
> Institute for Nutritional Sciences,
> Shanghai Institutes of Biological Sciences,
> Chinese Academy of Sciences
> P.O.Box 32
> 294 Taiyuan Road
> Shanghai 200031
More information about the R-help