Dear S-plus users,
I have fitted a polytomous logistic regression model with the function
multinom in the nnet library. I have a response Y with 3 categories and a
predictor with 2 categories. Now I'm interested in testing whether the
effect of X is different according to the type of response. Any idea on how
to do this?
> my.table <- expand.grid(Y=0:2,X= 0:1)
> temp <- c(612,477,209,107,83,42)
> my.table <- apply(my.table,2,function(x){rep(x,temp)})
> my.table <- data.frame( Y =
factor(my.table[,"Y"],labels=c("CONTROL","CASE A","CASE B")),
+ X =
factor(my.table[,"X"],labels=c("NO","YES"))
+ )
> library(nnet)
> library(MASS)
> options(contrasts=c("contr.treatment","contr.poly"))
> fit <- multinom(Y ~ X, data = my.table)
# weights: 9 (4 variable)
initial value 1680.876802
final value 1559.227816
converged
>
>
>
> fit
Call:
multinom(formula = Y ~ X, data = my.table)
Coefficients:
(Intercept) X
CASE A -0.2492187 -0.004772402
CASE B -1.0744047 0.139230847
Residual Deviance: 3118.456
AIC: 3126.456
> summary(fit)$standard.errors
Re-fitting to get Hessian
(Intercept) X
CASE A 0.06107717 0.1585067
CASE B 0.08011675 0.1989328
The effect of X is clearly not different in CASE A and CASE B how can I
formally test this hypothesis? How can I fit the same model constraining the
two coefficients for X to be identical?
Thanks
Gianluca
Gianluca Severi, Ph.D
Senior Research Fellow
Cancer Epidemiology Centre
The Cancer Council Victoria
100 Drummond Street
Carlton Vic 3053
Australia
Tel: +61 3 9635 5412
Mob: +61 0425852860
Fax: +61 3 9635 5330
e-mail: gianluca.severi@cancervic.org.au
|