Description Usage Arguments Value See Also Examples
This is the main function that fits interaction models with a path of tuning parameters (for Step 3).
1 2 3 4 5 6 7 8 9 10 11 12 13 |
x |
An |
y |
A response vector of size |
square |
Indicator of whether squared effects should be fitted in Step 1. Default to be FALSE. |
num_keep |
A user specified number of candidate interactions to keep in Step 2. If |
lambda1 |
Tuning parameter values for Step 1. |
lambda3 |
Tuning parameter values for Step 3. |
cv_step1 |
Indicator of whether cross-validation of |
nlam1 |
the number of values in |
nlam3 |
the number of values in each column of |
lam_min_ratio |
The ratio of the smallest and the largest values in |
... |
other arguments to be passed to the |
An object of S3 class "sprinter
".
square
The square
parameter passed into sprinter
n
The number of observations in the dataset
p
The number of main effects
step1
The output from fitting Step 1
lambda1
The path of tuning parameters passed into / computed for fitting Step 1
step2
The output from the screening Step 2
num_keep
The path of tuning parameters for Step 2
step3
The output from fitting Step 3
lambda3
The path of tuning parameters passed into / computed for fitting Step 3
main_center
Column centers of the input main effects
main_scale
Column scales of the input main effects
call
Function call.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(123)
n <- 100
p <- 100
# dense input
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)
# sparse input
library(Matrix)
x <- Matrix::Matrix(0, n, p)
idx <- cbind(sample(seq(n), size = 10, replace = TRUE), sample(seq(p), size = 10, replace = TRUE))
x[idx] <- 1
y <- x[, 1] - 2 * x[, 2] + 3 * x[, 1] * x[, 3] - 4 * x[, 4] * x[, 5] + rnorm(n)
mod <- sprinter(x = x, y = y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.