[R] stepAIC on lm() where response is a matrix..

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 28 07:24:25 CEST 2007


On Wed, 27 Jun 2007, Spencer Graves wrote:

>      I see several options for you:
>
>      1.  Write a function 'dropterm.mlm', copying 'dropterm.lm' and
> modifying it as you think appropriate.  The function 'dropterm.lm' is
> hidden in a namespace, which you can see from 'methods(dropterm)'.  To
> get it, either use getAnywhere("dropterm.lm") or "MASS:::dropterm.lm".

To do so you would have to decide what the AIC was for the mlm model.  If 
the two responses are regarded as independent, this would be easy, but mlm 
is also the basis of 'manova' models: see ?anova.mlm and ?summary.manova. 
Given Spencer's point 2, independence is not normally what people intend 
when fitting a multivariate linear model: more likely they are fitting a 
model with correlated observations not by maximum likelihood (and hence 
AIC is not appropriate).

>      2.  Use 'stepAIC' in the univariate mode.  If they both select the
> same model, it would strongly suggest that you would get the same answer
> from a multivariate version.  Fit that multivariate version and be happy.
>
>      3.  If univariate analyses produce different models and you want a
> common one, take the models you get, and interpolate manually a list of
> alternative plausible models between the two best univariate models.
> Then fit those manually and select the one with the smallest AIC.
>
>      Hope this helps.
>      Spencer Graves
>
> vinod gullu wrote:
>> dear R users,
>>
>> I have fit the lm() on a mtrix of responses.
>> i.e M1 = lm(cbind(R1,R2)~ X+Y+0). When i use
>> summary(M1), it shows details for R1 and R2
>> separately. Now i want to use stepAIC on these models.
>> But when i use stepAIC(M1) an error message  comes
>> saying that dropterm.mlm is not implemented. What is
>> the way out to use stepAIC in such cases.
>>
>> regards,

-- 
Brian D. Ripley,                  ripley at 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



More information about the R-help mailing list