# Re: [R] p value for coefficients in multinomial model

From: John Fox <jfox_at_mcmaster.ca>
Date: Thu 05 Apr 2007 - 14:08:54 GMT

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,
John

John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@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;
> run;
>
> In R, I tried this:
> library(car)
> library(nnet)
> b <- as.data.frame(lapply(a[,c("A","B","C","Y")], as.factor))
> mod.mul<- (Y~A+B+C,data=b)
> summary(mod.mul,cor=F,Wald=T)
> Anova(mod.mul,type="III")
>
> 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
> Diseases
> Institute for Nutritional Sciences,
> Shanghai Institutes of Biological Sciences,
> Chinese Academy of Sciences
> P.O.Box 32
> 294 Taiyuan Road
> Shanghai 200031
> P.R.CHINA
>
>

R-help@stat.math.ethz.ch 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. Received on Fri Apr 06 01:04:09 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 05 Apr 2007 - 15:30:47 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.