sprinter {sprintr} | R Documentation |
Sparse Reluctant Interaction Modeling
Description
This is the main function that fits interaction models with a path of tuning parameters (for Step 3).
Usage
sprinter(x, y, num_keep = NULL, square = FALSE, lambda = NULL,
nlam = 100, lam_min_ratio = ifelse(nrow(x) < ncol(x), 0.01, 1e-04))
Arguments
x |
An |
y |
A response vector of size |
num_keep |
Number of candidate interactions to keep in Step 2. If |
square |
Indicator of whether squared effects should be fitted in Step 1. Default to be FALSE. |
lambda |
A user specified list of tuning parameter. Default to be NULL, and the program will compute its own |
nlam |
The number of |
lam_min_ratio |
The ratio of the smallest and the largest values in |
Value
An object of S3 class "sprinter
".
n
The sample size.
p
The number of main effects.
a0
Estimate of intercept.
coef
Estimate of regression coefficients.
idx
Indices of all main effects and interactions in Step 3.
fitted
Fitted response value. It is a
n
-by-nlam
matrix, with each column representing a fitted response vector for a value of lambda.lambda
The sequence of
lambda
values used.call
Function call.
See Also
Examples
set.seed(123)
n <- 100
p <- 200
x <- matrix(rnorm(n * p), n, p)
y <- x[, 1] - 2 * x[, 2] + 3 * x[, 1] * x[, 3] - 4 * x[, 4] * x[, 5] + rnorm(n)
mod <- sprinter(x = x, y = y)