stepKSPM: Choose a model by AIC or BIC in a Stepwise Algorithm

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/stepKspm.R

Description

Performs stepwise model selection for Kernel Semi Parametric Model by AIC or BIC.

Usage

1
2
3
stepKSPM(object, data = NULL, linear.lower = NULL,
  linear.upper = NULL, kernel.lower = NULL, kernel.upper = NULL,
  direction = "both", k = 2, kernel.param = "fixed", trace = TRUE)

Arguments

object

an object of class "kspm" with only one kernel.

data

data.

linear.lower

one side formula corresponding to the smallest set of variables that should be included in the linear part of the model.

linear.upper

one side formula corresponding to the largest set of variables that may be included in the linear part of the model.

kernel.lower

one side formula corresponding to the smallest set of variables that should be included in the kernel part of the model.

kernel.upper

one side formula corresponding to the largest set of variables that may be included in the kernel part of the model.

direction

the mode of stepwise search, can be one of "both" (default), "backward", or "forward".

k

type of information criteria used for the variable selection. If k=2 AIC is used (default), if k=log(n), BIC is used instead.

kernel.param

define if hyperparameters should be fixed ("fixed") or reestimated at each iteration ("change"). Tu use the last option, hyperparameter of model provided in object should have been estimated by the model.

trace

integer. If positive, information is printed during the running of step.kspm. Larger values may give more information on the fitting process.

Details

This procedure may be done on kspm object defined with only one kernel part and for which a data frame including all variables was provided. Selection may be done on linear part only, on kernel part only or on both at the same time. To perform selection on linear (resp. kernel) part only, kernel.lower and kernel.upper (resp. linear.lower and linear.upper) should contain all the variables that should stay in the model for kernel (resp. linear) part.

Value

stepKSPM returns the selected model.

Author(s)

Catherine Schramm, Aurelie Labbe, Celia Greenwood

See Also

extractAIC.kspm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- 1:15
z1 <- runif(15, 1, 6)
z2 <- rnorm(15, 1, 4)
z3 <- rnorm(15, 6, 2)
z4 <- runif(15, -10, 2)
y <- 3*x + (z1 + z2)^2 + rnorm(15, 0, 2)
dfrm <- data.frame(x = x, z1 = z1, z2 = z2, z3 = z3, z4 = z4, y = y)
fit <- kspm(y, linear = ~ x, kernel = ~ Kernel(~ z1 + z2 + z3 + z4,
kernel.function = "polynomial", d= 2, rho = 1, gamma = 0), data = dfrm)
stepKSPM(fit, k = 2, data = dfrm)

KSPM documentation built on Aug. 10, 2020, 5:07 p.m.