The whole variable selection procedure for mean structure in GLM
Source:R/model_selection.R
ELCIC.glm.Rd
The function ELCIC.glm
provides the overall procedure for variable selection in GLM.
Arguments
- x
A matrix containing covariates. The first column should contain all ones corresponding to the intercept if the intercept is expected in the mean structure.
- y
A vector containing outcomes.
- candidate.sets
A list containing index corresponding to candidate covariates in each candidate model. See more in details section.
- name.var.sets
A list containing names of candidate covariates corresponding to each candidate model. The names should be subset of column names of the x matrix. See more in details section.
- dist
A specified distribution. It can be "gaussian", "poisson",and "binomial".
Value
A matrix with each element containing ELCIC value for each candidate model (in columns) and (in rows)
Details
"x" and "y" should be all observed. The corresponding individual data will be deleted if any missingness is detected.
Either arguments "candidate.sets" or "name.var.sets" is used to identify the set of candidate mean model. If both arguments are provided, only the argument "name.var.sets" will be used.
Examples
## tests
# load data
data(glmsimdata)
x<-glmsimdata$x
y<-glmsimdata$y
#candidate model index
candidate.sets<-list(c(1,2),c(1,2,3),c(1,2,3,4))
criteria<-ELCIC.glm(x, y, candidate.sets, name.var.sets = NULL, dist="poisson")
criteria
#> c(1, 2) c(1, 2, 3) c(1, 2, 3, 4)
#> ELCIC 40.43524 15.22388 18.42068
#> AIC 472.85184 430.12784 430.10169
#> BIC 478.06218 437.94335 440.52237
#> GIC 483.63120 441.65275 442.77467