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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 28 Jun 2007 06:24:25 +0100 (BST)

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

______________________________________________
R-help_at_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 Thu 28 Jun 2007 - 05:32:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Jun 2007 - 06:32:34 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.