Title: | The Scalable Highly Adaptive Lasso |
---|---|
Description: | A scalable implementation of the highly adaptive lasso algorithm, including routines for constructing sparse matrices of basis functions of the observed data, as well as a custom implementation of Lasso regression tailored to enhance efficiency when the matrix of predictors is composed exclusively of indicator functions. For ease of use and increased flexibility, the Lasso fitting routines invoke code from the 'glmnet' package by default. The highly adaptive lasso was first formulated and described by MJ van der Laan (2017) <doi:10.1515/ijb-2015-0097>, with practical demonstrations of its performance given by Benkeser and van der Laan (2016) <doi:10.1109/DSAA.2016.93>. This implementation of the highly adaptive lasso algorithm was described by Hejazi, Coyle, and van der Laan (2020) <doi:10.21105/joss.02526>. |
Authors: | Jeremy Coyle [aut, cre] , Nima Hejazi [aut] , Rachael Phillips [aut] , Lars van der Laan [aut], David Benkeser [ctb] , Oleg Sofrygin [ctb], Weixin Cai [ctb] , Mark van der Laan [aut, cph, ths] |
Maintainer: | Jeremy Coyle <[email protected]> |
License: | GPL-3 |
Version: | 0.4.6 |
Built: | 2024-11-19 20:23:48 UTC |
Source: | https://github.com/tlverse/hal9001 |
HAL Formula addition: Adding formula term object together into a single formula object term.
## S3 method for class 'formula_hal9001' x + y
## S3 method for class 'formula_hal9001' x + y
x |
A |
y |
A |
OR duplicate training set columns together
apply_copy_map(X, copy_map)
apply_copy_map(X, copy_map)
X |
Sparse matrix containing columns of indicator functions. |
copy_map |
the copy map |
A dgCMatrix
sparse matrix corresponding to the design matrix
for a zero-th order highly adaptive lasso, but with all duplicated columns
(basis functions) removed.
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X) x_basis <- make_design_matrix(X, basis_list) copy_map <- make_copy_map(x_basis) x_basis_uniq <- apply_copy_map(x_basis, copy_map)
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X) x_basis <- make_design_matrix(X, basis_list) copy_map <- make_copy_map(x_basis) x_basis_uniq <- apply_copy_map(x_basis, copy_map)
Fast and efficient coercion of standard matrix objects to sparse matrices. Borrowed from http://gallery.rcpp.org/articles/sparse-matrix-coercion/. INTERNAL USE ONLY.
as_dgCMatrix(XX_)
as_dgCMatrix(XX_)
XX_ |
An object of class |
An object of class dgCMatrix
, coerced from input XX_
.
Build a list of basis functions from a set of columns
basis_list_cols( cols, x, smoothness_orders, include_zero_order, include_lower_order = FALSE )
basis_list_cols( cols, x, smoothness_orders, include_zero_order, include_lower_order = FALSE )
cols |
Index or indices (as |
x |
A |
smoothness_orders |
An integer vector of length |
include_zero_order |
A |
include_lower_order |
A |
A list
containing the basis functions generated from a set of
input columns.
Find the full list of basis functions up to a particular degree
basis_of_degree( x, degree, smoothness_orders, include_zero_order, include_lower_order )
basis_of_degree( x, degree, smoothness_orders, include_zero_order, include_lower_order )
x |
An input |
degree |
The highest order of interaction terms for which the basis
functions ought to be generated. The default ( |
smoothness_orders |
An integer vector of length |
include_zero_order |
A |
include_lower_order |
A |
A list
containing basis functions and cutoffs generated from
a set of input columns up to a particular pre-specified degree.
Generate basis functions for all covariates and interaction terms thereof up to a specified order/degree.
enumerate_basis( x, max_degree = NULL, smoothness_orders = rep(0, ncol(x)), include_zero_order = FALSE, include_lower_order = FALSE, num_knots = NULL )
enumerate_basis( x, max_degree = NULL, smoothness_orders = rep(0, ncol(x)), include_zero_order = FALSE, include_lower_order = FALSE, num_knots = NULL )
x |
An input |
max_degree |
The highest order of interaction terms for which the basis
functions ought to be generated. The default ( |
smoothness_orders |
An integer vector of length |
include_zero_order |
A |
include_lower_order |
A |
num_knots |
A vector of length |
A list
of basis functions generated for all covariates and
interaction thereof up to a pre-specified degree.
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X)
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X)
Populates a column (indexed by basis_col) of x_basis with basis indicators.
evaluate_basis(basis, X, x_basis, basis_col)
evaluate_basis(basis, X, x_basis, basis_col)
basis |
The basis function. |
X |
The design matrix, containing the original data. |
x_basis |
The HAL design matrix, containing indicator functions. |
basis_col |
Numeric indicating which column to populate. |
Formula Helpers
fill_dots(var_names, .)
fill_dots(var_names, .)
var_names |
A |
. |
Specification of variables for use in the formula.
This function takes a character vector |
Estimation procedure for HAL, the Highly Adaptive Lasso
fit_hal( X, Y, formula = NULL, X_unpenalized = NULL, max_degree = ifelse(ncol(X) >= 20, 2, 3), smoothness_orders = 1, num_knots = num_knots_generator(max_degree = max_degree, smoothness_orders = smoothness_orders, base_num_knots_0 = 20, base_num_knots_1 = 10), reduce_basis = NULL, family = c("gaussian", "binomial", "poisson", "cox", "mgaussian"), lambda = NULL, id = NULL, weights = NULL, offset = NULL, fit_control = list(cv_select = TRUE, use_min = TRUE, lambda.min.ratio = 1e-04, prediction_bounds = "default"), basis_list = NULL, return_lasso = TRUE, return_x_basis = FALSE, yolo = FALSE )
fit_hal( X, Y, formula = NULL, X_unpenalized = NULL, max_degree = ifelse(ncol(X) >= 20, 2, 3), smoothness_orders = 1, num_knots = num_knots_generator(max_degree = max_degree, smoothness_orders = smoothness_orders, base_num_knots_0 = 20, base_num_knots_1 = 10), reduce_basis = NULL, family = c("gaussian", "binomial", "poisson", "cox", "mgaussian"), lambda = NULL, id = NULL, weights = NULL, offset = NULL, fit_control = list(cv_select = TRUE, use_min = TRUE, lambda.min.ratio = 1e-04, prediction_bounds = "default"), basis_list = NULL, return_lasso = TRUE, return_x_basis = FALSE, yolo = FALSE )
X |
An input |
Y |
A |
formula |
A character string formula to be used in
|
X_unpenalized |
An input |
max_degree |
The highest order of interaction terms for which basis functions ought to be generated. |
smoothness_orders |
An |
num_knots |
An |
reduce_basis |
Am optional |
family |
A |
lambda |
User-specified sequence of values of the regularization
parameter for the lasso L1 regression. If |
id |
A vector of ID values that is used to generate cross-validation
folds for |
weights |
observation weights; defaults to 1 per observation. |
offset |
a vector of offset values, used in fitting. |
fit_control |
List of arguments, including the following, and any
others to be passed to
|
basis_list |
The full set of basis functions generated from |
return_lasso |
A |
return_x_basis |
A |
yolo |
A |
The procedure uses a custom C++ implementation to generate a design
matrix of spline basis functions of covariates and interactions of
covariates. The lasso regression is fit to this design matrix via
cv.glmnet
or a custom implementation derived from
origami. The maximum dimension of the design matrix is -by-
, where where
is the number of observations and
is the number of covariates.
For smoothness_orders = 0
, only zero-order splines (piece-wise
constant) are generated, which assume the true regression function has no
smoothness or continuity. When smoothness_orders = 1
, first-order
splines (piece-wise linear) are generated, which assume continuity of the
true regression function. When smoothness_orders = 2
, second-order
splines (piece-wise quadratic and linear terms) are generated, which assume
a the true regression function has a single order of differentiability.
num_knots
argument specifies the number of knot points for each
covariate and for each max_degree
. Fewer knot points can
significantly decrease runtime, but might be overly simplistic. When
considering smoothness_orders = 0
, too few knot points (e.g., < 50)
can significantly reduce performance. When smoothness_orders = 1
or
higher, then fewer knot points (e.g., 10-30) is actually better for
performance. We recommend specifying num_knots
with respect to
smoothness_orders
, and as a vector of length max_degree
with
values decreasing exponentially. This prevents combinatorial explosions in
the number of higher-degree basis functions generated. The default behavior
of num_knots
follows this logic — for smoothness_orders = 0
,
num_knots
is set to , and for
smoothness_orders = 1
or higher, num_knots
is set to
, where
is the interaction degree. We also
include some other suitable settings for
num_knots
below, all of
which are less complex than default num_knots
and will thus result
in a faster runtime:
Some good settings for little to no cost in performance:
If smoothness_orders = 0
and max_degree = 3
,
num_knots = c(400, 200, 100)
.
If smoothness_orders = 1+
and max_degree = 3
,
num_knots = c(100, 75, 50)
.
Recommended settings for fairly fast runtime:
If smoothness_orders = 0
and max_degree = 3
,
num_knots = c(200, 100, 50)
.
If smoothness_orders = 1+
and max_degree = 3
,
num_knots = c(50, 25, 15)
.
Recommended settings for fast runtime:
If smoothness_orders = 0
and max_degree = 3
,
num_knots = c(100, 50, 25)
.
If smoothness_orders = 1+
and max_degree = 3
,
num_knots = c(40, 15, 10)
.
Recommended settings for very fast runtime:
If smoothness_orders = 0
and max_degree = 3
,
num_knots = c(50, 25, 10)
.
If smoothness_orders = 1+
and max_degree = 3
,
num_knots = c(25, 10, 5)
.
Object of class hal9001
, containing a list of basis
functions, a copy map, coefficients estimated for basis functions, and
timing results (for assessing computational efficiency).
n <- 100 p <- 3 x <- xmat <- matrix(rnorm(n * p), n, p) y_prob <- plogis(3 * sin(x[, 1]) + sin(x[, 2])) y <- rbinom(n = n, size = 1, prob = y_prob) hal_fit <- fit_hal(X = x, Y = y, family = "binomial") preds <- predict(hal_fit, new_data = x)
n <- 100 p <- 3 x <- xmat <- matrix(rnorm(n * p), n, p) y_prob <- plogis(3 * sin(x[, 1]) + sin(x[, 2])) y <- rbinom(n = n, size = 1, prob = y_prob) hal_fit <- fit_hal(X = x, Y = y, family = "binomial") preds <- predict(hal_fit, new_data = x)
formula_HAL
object.HAL Formula: Convert formula or string to formula_HAL
object.
formula_hal(formula, smoothness_orders, num_knots, X = NULL)
formula_hal(formula, smoothness_orders, num_knots, X = NULL)
formula |
A |
smoothness_orders |
A default value for |
num_knots |
A default value for |
X |
Controls inheritance of the variable |
HAL Formula term: Generate a single term of the HAL basis
h( ..., k = NULL, s = NULL, pf = 1, monotone = c("none", "i", "d"), . = NULL, dot_args_as_string = FALSE, X = NULL )
h( ..., k = NULL, s = NULL, pf = 1, monotone = c("none", "i", "d"), . = NULL, dot_args_as_string = FALSE, X = NULL )
... |
Variables for which to generate multivariate interaction basis
function where the variables can be found in a matrix |
k |
The number of knots for each univariate basis function used to
generate the tensor product basis functions. If a single value then this
value is used for the univariate basis functions for each variable.
Otherwise, this should be a variable named list that specifies for each
variable how many knots points should be used.
|
s |
The |
pf |
A |
monotone |
Whether the basis functions should enforce monotonicity of
the interaction term. If |
. |
Just like with |
dot_args_as_string |
Whether the arguments |
X |
An optional design matrix where the variables given in |
Curated selection of quotes from the HAL9000 computer, from the critically acclaimed epic science-fiction film "2001: A Space Odyssey" (1968).
hal_quotes
hal_quotes
A vector of quotes.
Prints a quote from the HAL 9000 robot from 2001: A Space Odyssey
hal9000()
hal9000()
Index vector that, for each column in X, indicates the index of the first copy of that column
index_first_copy(X)
index_first_copy(X)
X |
Sparse matrix containing columns of indicator functions. |
Build a sorted list of unique basis functions based on columns, where each basis function is a list
make_basis_list(X_sub, cols, order_map)
make_basis_list(X_sub, cols, order_map)
X_sub |
A subset of the columns of X, the original design matrix. |
cols |
An index of the columns that were reduced to by sub-setting. |
order_map |
A vector with length the original unsubsetted matrix X which specifies the smoothness of the function in each covariate. |
Note that sorting of columns is performed such that the basis order equals cols.length() and each basis function is a list(cols, cutoffs).
Build Copy Maps
make_copy_map(x_basis)
make_copy_map(x_basis)
x_basis |
A design matrix consisting of basis (indicator) functions for covariates (X) and terms for interactions thereof. |
A list
of numeric
vectors indicating indices of basis
functions that are identical in the training set.
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X) x_basis <- make_design_matrix(X, basis_list) copy_map <- make_copy_map(x_basis)
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X) x_basis <- make_design_matrix(X, basis_list) copy_map <- make_copy_map(x_basis)
Make a HAL design matrix based on original design matrix X and a list of basis functions in argument blist
make_design_matrix(X, blist, p_reserve = 0.5)
make_design_matrix(X, blist, p_reserve = 0.5)
X |
Matrix of covariates containing observed data in the columns. |
blist |
List of basis functions with which to build HAL design matrix. |
p_reserve |
Sparse matrix pre-allocation proportion. Default value is 0.5. If one expects a dense HAL design matrix, it is useful to set p_reserve to a higher value. |
A dgCMatrix
sparse matrix of indicator basis functions
corresponding to the design matrix in a zero-order highly adaptive lasso.
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X) x_basis <- make_design_matrix(X, basis_list)
gendata <- function(n) { W1 <- runif(n, -3, 3) W2 <- rnorm(n) W3 <- runif(n) W4 <- rnorm(n) g0 <- plogis(0.5 * (-0.8 * W1 + 0.39 * W2 + 0.08 * W3 - 0.12 * W4)) A <- rbinom(n, 1, g0) Q0 <- plogis(0.15 * (2 * A + 2 * A * W1 + 6 * A * W3 * W4 - 3)) Y <- rbinom(n, 1, Q0) data.frame(A, W1, W2, W3, W4, Y) } set.seed(1234) data <- gendata(100) covars <- setdiff(names(data), "Y") X <- as.matrix(data[, covars, drop = FALSE]) basis_list <- enumerate_basis(X) x_basis <- make_design_matrix(X, basis_list)
A helper function that finds which basis functions to keep (and equivalently which to discard) based on the proportion of 1's (observations, i.e., "mass") included in a given basis function.
make_reduced_basis_map(x_basis, reduce_basis_crit)
make_reduced_basis_map(x_basis, reduce_basis_crit)
x_basis |
A matrix of basis functions with all redundant basis functions already removed. |
reduce_basis_crit |
A scalar |
A binary numeric
vector indicating which columns of the
matrix of basis functions to keep (given a one) and which to discard (given
a zero).
Computes and returns the indicator value for the basis described by cols and cutoffs for a given row of X
meets_basis(X, row_num, cols, cutoffs, orders)
meets_basis(X, row_num, cols, cutoffs, orders)
X |
The design matrix, containing the original data. |
row_num |
Numeri for a row index over which to evaluate. |
cols |
Numeric for the column indices of the basis function. |
cutoffs |
Numeric providing thresholds. |
orders |
Numeric providing smoothness orders |
Prediction from HAL fits
## S3 method for class 'hal9001' predict( object, new_data, new_X_unpenalized = NULL, offset = NULL, type = c("response", "link"), ... )
## S3 method for class 'hal9001' predict( object, new_data, new_X_unpenalized = NULL, offset = NULL, type = c("response", "link"), ... )
object |
An object of class |
new_data |
A |
new_X_unpenalized |
If the user supplied |
offset |
A vector of offsets. Must be provided if provided at training. |
type |
Either "response" for predictions of the response, or "link" for un-transformed predictions (on the scale of the link function). |
... |
Additional arguments passed to |
Method for computing and extracting predictions from fits of the
Highly Adaptive Lasso estimator, returned as a single S3 objects of class
hal9001
.
A numeric
vector of predictions from a hal9001
object.
This prediction method does not function similarly to the equivalent
method from glmnet. In particular, this procedure will not return a
subset of lambdas originally specified in calling fit_hal
nor result in re-fitting. Instead, it will return predictions for all of
the lambdas specified in the call to fit_hal
that constructs
object
, when fit_control
's cv_select
is set to
FALSE
. When fit_control
's cv_select
is set to
TRUE
, predictions will only be returned for the value of lambda
selected by cross-validation.
Predict method for objects of class SL.hal9001
## S3 method for class 'SL.hal9001' predict(object, newdata, ...)
## S3 method for class 'SL.hal9001' predict(object, newdata, ...)
object |
A fitted object of class |
newdata |
A matrix of new observations on which to obtain predictions. |
... |
Not used. |
A numeric
vector of predictions from a SL.hal9001
object based on the provide newdata
.
Print formula_hal9001 object
## S3 method for class 'formula_hal9001' print(x, ...)
## S3 method for class 'formula_hal9001' print(x, ...)
x |
A formula_hal9001 object. |
... |
Other arguments (ignored). |
Print Method for Summary Class of HAL fits
## S3 method for class 'summary.hal9001' print(x, length = NULL, ...)
## S3 method for class 'summary.hal9001' print(x, length = NULL, ...)
x |
An object of class |
length |
The number of ranked coefficients to be summarized. |
... |
Other arguments (ignored). |
Wrapper for SuperLearner for objects of class hal9001
SL.hal9001( Y, X, newX, family, obsWeights, id, max_degree = 2, smoothness_orders = 1, num_knots = 5, ... )
SL.hal9001( Y, X, newX, family, obsWeights, id, max_degree = 2, smoothness_orders = 1, num_knots = 5, ... )
Y |
A |
X |
An input |
newX |
A matrix of new observations on which to obtain predictions. The
default of |
family |
A |
obsWeights |
A |
id |
A |
max_degree |
The highest order of interaction terms for which basis functions ought to be generated. |
smoothness_orders |
An |
num_knots |
An |
... |
Additional arguments to |
An object of class SL.hal9001
with a fitted hal9001
object and corresponding predictions based on the input data.
Reduce footprint by dropping basis functions with coefficients of zero
squash_hal_fit(object)
squash_hal_fit(object)
object |
An object of class |
Object of class hal9001
, similar to the input object but
reduced such that coefficients belonging to bases with coefficients equal
to zero removed.
# generate simple test data n <- 100 p <- 3 x <- matrix(rnorm(n * p), n, p) y <- sin(x[, 1]) * sin(x[, 2]) + rnorm(n, mean = 0, sd = 0.2) # fit HAL model and squash resulting object to reduce footprint hal_fit <- fit_hal(X = x, Y = y, yolo = FALSE) squashed <- squash_hal_fit(hal_fit)
# generate simple test data n <- 100 p <- 3 x <- matrix(rnorm(n * p), n, p) y <- sin(x[, 1]) * sin(x[, 2]) + rnorm(n, mean = 0, sd = 0.2) # fit HAL model and squash resulting object to reduce footprint hal_fit <- fit_hal(X = x, Y = y, yolo = FALSE) squashed <- squash_hal_fit(hal_fit)
Summary Method for HAL fit objects
## S3 method for class 'hal9001' summary( object, lambda = NULL, only_nonzero_coefs = TRUE, include_redundant_terms = FALSE, round_cutoffs = 3, ... )
## S3 method for class 'hal9001' summary( object, lambda = NULL, only_nonzero_coefs = TRUE, include_redundant_terms = FALSE, round_cutoffs = 3, ... )
object |
An object of class |
lambda |
Optional |
only_nonzero_coefs |
A |
include_redundant_terms |
A |
round_cutoffs |
An |
... |
Additional arguments passed to |
Method for summarizing the coefficients of the Highly Adaptive
Lasso estimator in terms of the basis functions corresponding to covariates
and interactions of covariates, returned as a single S3 object of class
hal9001
.
Due to the nature of the basis function terms, the summary tables can be
extremely wide. The R environment might not be the optimal location to view
the summary. Tables can be exported from R to LaTeX with xtable
package (or similar). Here's an example:
print(xtable(summary(fit)$table, type = "latex"), file = "dt.tex")
.
A list summarizing a hal9001
object's coefficients.