> >>
> > Please kindly advise if it is possible to show the singular model with
> > only one certain variable using the command subset. (or maybe others)
> > I tried the command "subset=X3" but it returned multiple models
> > including X3.
> >
> >
> > The above demand might look unnecessary when visual inspection offers
> > the solution with few exp. variables.
> > However, it is of great importance for recognizing AIC for each
> > variable in the model selection with more than 10 variables.
>
> No, there isn't. The object returned by dredge is a data frame so you
> can subset it to your hearts content, but you'll need to select rows
> where you specify that all your variables (except the one you are
> interested in) are missing (NA). Without writing this all out, I don't
> know of a quick way of doing this sort of subsetting.
>
> In effect, you want
>
> data(Cement)
> lm1 <- lm(y ~ ., data = Cement)
> dd <- dredge(lm1, subset = X1)
>
> want <- with(dd, is.na(X) & is.na(X2) & is.na(X3) & is.na(X4))
> want
> ## how many models selected?
> sum(want)
> ## OK selected just 1, show it
> dd[want, , drop = FALSE]
>
> Oh, actually, I suppose you could automate this, so it will return all
> models with single variable:
>
> dd <- dredge(lm1)
> parms <- !is.na(dd[, -c(1, (ncol(dd) - c(0:7)))])
> want <- which(rowSums(parms) == 1)
> dd[want, ]
>
> Having said all this, I don't think this is a good way to do model
> selection.
> =>
>

Thanks for the time-efficient formula.
Actually it is over my current ability to automate it, but it did save a lot
of time already.
Moreover, please kindly explain the command beginning with parms.
data (Cement) was checked but could not ensure why the row and the column
were set to be 1 and (ncol(dd) - c(0:7)).

Elaine

	[[alternative HTML version deleted]]

