Michael Just
2011-Jul-13 23:01 UTC
[R] Sum weights of independent variables across models (AIC)
Hello, I'd like to sum the weights of each independent variable across linear models that have been evaluated using AIC. For example:> library(MuMIn) > data(Cement) > lm1 <- lm(y ~ ., data = Cement) > dd <- dredge(lm1, beta = TRUE, eval = TRUE, rank = "AICc") > get.models(dd, subset = delta <4)There are 5 models with a Delta AIC Score of less than 4. I would like to sum the weights for each of the independent variables across the five models. How can I do that? Thanks, Mike
Kamil BartoĊ
2011-Jul-14 10:40 UTC
[R] Re: Sum weights of independent variables across models (AIC)
?model.avg Look at "relative importance".> Message: 102 > Date: Wed, 13 Jul 2011 18:01:14 -0500 > From: Michael Just <mgjust at gmail.com> > To: r-help <r-help at r-project.org> > Subject: [R] Sum weights of independent variables across models (AIC) > Message-ID: > <CAHdFeLNoQBAHYL=CJ3dB=jbCuLDPyCGk03dNcyPF2obvkcAD+Q at mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hello, > I'd like to sum the weights of each independent variable across linear > models that have been evaluated using AIC. > > For example: > >> > library(MuMIn) >> > data(Cement) >> > lm1 <- lm(y ~ ., data = Cement) >> > dd <- dredge(lm1, beta = TRUE, eval = TRUE, rank = "AICc") >> > get.models(dd, subset = delta <4) > There are 5 models with a Delta AIC Score of less than 4. I would > like to sum the weights for each of the independent variables across > the five models.
Michael Just
2011-Jul-14 14:39 UTC
[R] Sum weights of independent variables across models (AIC)
This is what I was looking for. When I initially read about model.avg I didn't recognize it also provided variable scores. Thank you kindly, Mike
Frank Harrell
2011-Jul-14 20:03 UTC
[R] Sum weights of independent variables across models (AIC)
Why go to so much trouble? Why not fit a single full model and use it? Even better why not use a quadratic penalty on the full model to get optimum cross-validation? Frank nofunsally wrote:> > Hello, > I'd like to sum the weights of each independent variable across linear > models that have been evaluated using AIC. > > For example: > >> library(MuMIn) >> data(Cement) >> lm1 <- lm(y ~ ., data = Cement) >> dd <- dredge(lm1, beta = TRUE, eval = TRUE, rank = "AICc") >> get.models(dd, subset = delta <4) > > There are 5 models with a Delta AIC Score of less than 4. I would > like to sum the weights for each of the independent variables across > the five models. > > How can I do that? > > Thanks, > Mike > > ______________________________________________ > R-help at 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. >----- Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Sum-weights-of-independent-variables-across-models-AIC-tp3666306p3668513.html Sent from the R help mailing list archive at Nabble.com.