This assumes a continuous response, so that the out-of-sample MSE can be used to estimate the outcome variability sigma.
Arguments
- fits
The fitted 'glmnet' package model model from which to draw samples.
- newdata
A data.frame containing new inputs from which to sample responses. If NULL, defaults to the data used to estimate fit.
- indices
The coordinates of the response from which to draw samples.
- lambda_ix
A regularization strength parameter used to maintain consistency with estimation. Not used during sampling.
- ...
Additional parameters to pass to predict.glmnet
Examples
m <- glmnet_model()
fit <- estimator(m)(mpg ~ hp + wt, data = mtcars)
glmnet_sampler(fit, mtcars)
#> # A tibble: 32 × 1
#> mpg
#> <dbl>
#> 1 -65.9
#> 2 -372.
#> 3 47.0
#> 4 -44.1
#> 5 249.
#> 6 -89.1
#> 7 96.4
#> 8 -13.9
#> 9 -16.7
#> 10 37.3
#> # ℹ 22 more rows
plm <- parallelize(glmnetUtils::glmnet)
fit <- plm(mpg + disp ~ hp + wt, data = mtcars)
glmnet_sampler(fit, mtcars)
#> # A tibble: 32 × 2
#> mpg disp
#> <dbl> <dbl>
#> 1 116. -20097.
#> 2 47.9 3203.
#> 3 10.6 16823.
#> 4 20.8 3062.
#> 5 12.6 6750.
#> 6 74.2 3885.
#> 7 12.7 -4374.
#> 8 15.1 -1077.
#> 9 1.93 4027.
#> 10 29.6 93.0
#> # ℹ 22 more rows