Re: [R] best subset selection on random effects model

2012-02-14 Thread ilai
I don't know of any package that will do it (or if violating the
marginality principle by having non-nested models even makes sense)
but you could always build your own search through all possible
models. Problem is for a large number of fixed effects this can take a
good bit of time...
Here is a piece of code I had from a few of years back. There may be
more elegant solutions that will reduce run time such as using
update.lme. Basically my code finds all possible combinations of model
terms with ?combn and than fits them.

require(nlme)
fm - lme(distance ~age*Sex, random = ~ 1|Subject,data=Orthodont,method='ML')
Terms - terms(fm)
todrop -  1:length(attr(Terms,'term.labels'))
subs - unlist(sapply(todrop,function(p)
combn(todrop,p,simplify=F)),recursive =F)
fm.subList - lapply(subs[-length(subs)],function(s,...){
  newf- formula(drop.terms(terms(fm),s,keep.response = TRUE))
  update(fm,newf)
})
names(fm.subList) - sapply(fm.subList, function(x) paste('fm',attr(
terms(x),'term.labels'),sep='.'))
sort(sapply(fm.subList,BIC))   # 1st is best based on BIC

Cheers


On Tue, Feb 14, 2012 at 11:25 AM, Tao Zhang zt020...@gmail.com wrote:
 The models are not nested. I would like to consider all the possible
 subsets.
 I hope to output a table, where each row of the table indicates a best
 subset of the fixed effects for a particular model size.

 Thank you,
 Tao


 2012/2/13 ilai ke...@math.montana.edu

 The question is where do your models come from? Passing nested models
 to ?anova.lme in nlme package or lme4 results in a likelihood ratio
 test. Are you looking for something else/more ?


 On Sun, Feb 12, 2012 at 8:02 PM, Tao Zhang zt020...@gmail.com wrote:
  Hi,
      I know leaps() computes the best subset selection for linear model,
  and the bestglm() computes the best subset selection for generalized
  linear
  model.
  Is there any package for best subset selection on random effects model,
  or
  mixed effects model?
 
  Thank you so much.
 
  Tao
 
         [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org 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.



__
R-help@r-project.org 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.


Re: [R] best subset selection on random effects model

2012-02-13 Thread ilai
The question is where do your models come from? Passing nested models
to ?anova.lme in nlme package or lme4 results in a likelihood ratio
test. Are you looking for something else/more ?


On Sun, Feb 12, 2012 at 8:02 PM, Tao Zhang zt020...@gmail.com wrote:
 Hi,
     I know leaps() computes the best subset selection for linear model,
 and the bestglm() computes the best subset selection for generalized linear
 model.
 Is there any package for best subset selection on random effects model, or
 mixed effects model?

 Thank you so much.

 Tao

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.

__
R-help@r-project.org 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.


[R] best subset selection on random effects model

2012-02-12 Thread Tao Zhang
Hi,
 I know leaps() computes the best subset selection for linear model,
and the bestglm() computes the best subset selection for generalized linear
model.
Is there any package for best subset selection on random effects model, or
mixed effects model?

Thank you so much.

Tao

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.