s-news
[Top] [All Lists]

Re: constrained multinom()

To: 'Prof Brian Ripley' <ripley@stats.ox.ac.uk>
Subject: Re: constrained multinom()
From: Gianluca Severi <Gianluca.Severi@cancervic.org.au>
Date: Wed, 18 Aug 2004 17:42:37 +1000
Cc: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
The example provided is not the best example. Anyway, let's assume that X
has some effect and I want to test whether this effect is different for
CASES A (vs CONTROLS) and for CASES B (vs CONTROL). How do I test this?

Gianluca
 

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk]
Sent: Wednesday, 18 August 2004 5:15 PM
To: Gianluca Severi
Cc: 's-news@lists.biostat.wustl.edu'
Subject: Re: [S] constrained multinom()


I think you misunderstand the model.  You have case A vs control and case
B vs control.  Neither has a significant X coefficient, and so you almost
certainly have nothing significant.

On Wed, 18 Aug 2004, Gianluca Severi wrote:

> 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?

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

<Prev in Thread] Current Thread [Next in Thread>