Description Usage Arguments Details See Also Examples
Extractor methods for mcsSubset
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## S3 method for class 'mcsSubset'
variable.names(object, size = NULL, best = 1,
..., .full = FALSE, .neg = FALSE)
## S3 method for class 'mcsSubset'
formula(x, ...)
## S3 method for class 'mcsSubset'
model.frame(formula, ...)
## S3 method for class 'mcsSubset'
model.matrix(object, size = NULL, best = 1, ...)
## S3 method for class 'mcsSubset'
refit(object, ...)
## S3 method for class 'mcsSubset'
coef(object, ...)
## S3 method for class 'mcsSubset'
vcov(object, ...)
## S3 method for class 'mcsSubset'
fitted(object, ...)
## S3 method for class 'mcsSubset'
residuals(object, ...)
## S3 method for class 'mcsSubset'
deviance(object, size = NULL, best = 1, ...)
## S3 method for class 'mcsSubset'
logLik(object, size = NULL, best = 1, ..., df)
## S3 method for class 'mcsSubset'
AIC(object, size = NULL, best = 1, ..., k = NULL)
## S3 method for class 'mcsSubset'
BIC(object, size = NULL, best = 1, ...)
|
object, formula, x |
An object of class |
size |
The subset size. |
best |
The subset rank. |
df |
Degrees of freedom. |
k |
AIC penalty. |
... |
Forwarded arguments. |
.full |
For internal use. |
.neg |
For internal use. |
The extractor methods work for mcsSubset
objects that
have been generated using the formula interface.
The information is extracted from the model refitted to a given size.
If a method is not available, refit
can always be called
explicitly to obtain a new lm
object of the desired size or
rank. In some cases, the size
and best
arguments may be
a vector specifying multiple values.
The method refit
returns an lm
object fitted to the
desired size and rank.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## load data
data("AirPollution", package = "mcsSubset")
## fit subsets (5 best subsets per size)
xs <- mcsSubset(mortality ~ ., data = AirPollution, nbest = 5)
## extract information (for subset of size 3)
coef(xs, size = 3)
vcov(xs, size = 3)
residuals(xs, size = 3)
fitted(xs, size = 3)
model.matrix(xs, size = 3)
## summarize (BIC)
sx <- summary(xs, penalty = log(nrow(AirPollution)))
## extract information (for best BIC subset)
deviance(sx)
logLik(sx)
AIC(sx)
## refit model
lm5 <- refit(sx, size=5)
summary(lm5)
## (Note that the p-values are not valid due to model selection.)
## select 5 best subsets using AIC
xs <- mcsSubset(mortality ~ ., data = AirPollution, penalty = 2, nbest = 5)
## summarize
summary(xs)
## extract deviance for best subset
deviance(xs)
## extract BIC for all subsets
BIC(xs, best = 1:5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.