Title: | Post-Selection Inference for Generalized Linear Models |
---|---|
Description: | Calculates (unconditional) post-selection confidence intervals and p-values for the coefficients of (generalized) linear models. |
Authors: | Marco Cattaneo [aut, cre] |
Maintainer: | Marco Cattaneo <[email protected]> |
License: | GPL-3 |
Version: | 1.0 |
Built: | 2024-11-16 06:34:09 UTC |
Source: | CRAN |
selcorr
returns (unconditional) post-selection confidence intervals and p-values
for the coefficients of (generalized) linear models.
selcorr( object, fixed.vars = NULL, further.vars = NULL, boot.repl = 0, k = 2, conf.level = 0.95, quiet = FALSE )
selcorr( object, fixed.vars = NULL, further.vars = NULL, boot.repl = 0, k = 2, conf.level = 0.95, quiet = FALSE )
object |
an object representing a model of an appropriate class. This is used as the initial model in a (bidirectional) stepwise model selection. |
fixed.vars |
the names of all independent variables that must be included in the selected model. The default is none. |
further.vars |
the names of all independent variables that can be included
in the selected model, but are not part of |
boot.repl |
a number or list of bootstrap replicates. The default is no bootstrapping. See Details and Examples for clarification. |
k |
the multiple of the number of degrees of freedom used as penalty in the model selection.
The default |
conf.level |
the level of the confidence intervals. |
quiet |
if |
When boot.repl = 0
, an approximate asymptotic distribution of the test statistic
is used to calculate p-values and calibrate the profile-likelihood confidence intervals.
This approach is faster, but p-values and confidence intervals can be more precisely calibrated
by parametrically bootstrapping the test statistic (with boot.repl
the number of replicates).
Parallel computing can be used to speed up the bootstrapping: see Examples.
the selected model is returned, without correction for model-selection,
but with up to two additional components. There is an output
component corresponding to
the post-selection inference, which is also printed unless quiet = TRUE
.
When boot.repl
is not 0
, there is also a boot.repl
component
corresponding to the bootstrap replicates.
## linear regression: selcorr(lm(Fertility ~ ., swiss)) ## logistic regression: swiss.lr = within(swiss, Fertility <- (Fertility > 70)) selcorr(glm(Fertility ~ ., binomial, swiss.lr)) ## parallel bootstrapping: ## Not run: library(future.apply) plan(multisession) boot.repl = future_replicate(8, selcorr(lm(Fertility ~ ., swiss), boot.repl = 1000, quiet = TRUE)$boot.repl, simplify = FALSE) plan(sequential) selcorr(lm(Fertility ~ ., swiss), boot.repl = do.call("rbind", boot.repl)) ## End(Not run)
## linear regression: selcorr(lm(Fertility ~ ., swiss)) ## logistic regression: swiss.lr = within(swiss, Fertility <- (Fertility > 70)) selcorr(glm(Fertility ~ ., binomial, swiss.lr)) ## parallel bootstrapping: ## Not run: library(future.apply) plan(multisession) boot.repl = future_replicate(8, selcorr(lm(Fertility ~ ., swiss), boot.repl = 1000, quiet = TRUE)$boot.repl, simplify = FALSE) plan(sequential) selcorr(lm(Fertility ~ ., swiss), boot.repl = do.call("rbind", boot.repl)) ## End(Not run)