| fit_haldensify | R Documentation | 
Fit Conditional Density Estimation over a Sequence of HAL Models
fit_haldensify(
  A,
  W,
  wts = rep(1, length(A)),
  grid_type = "equal_range",
  n_bins = round(c(0.5, 1, 1.5, 2) * sqrt(length(A))),
  cv_folds = 5L,
  lambda_seq = exp(seq(-1, -13, length = 1000L)),
  smoothness_orders = 0L,
  ...
)
A | 
 The   | 
W | 
 A   | 
wts | 
 A   | 
grid_type | 
 A   | 
n_bins | 
 This   | 
cv_folds | 
 A   | 
lambda_seq | 
 A   | 
smoothness_orders | 
 A   | 
... | 
 Additional (optional) arguments of   | 
Estimation of the conditional density of A|W via a cross-validated highly adaptive lasso, used to estimate the conditional hazard of failure in a given bin over the support of A.
A list, containing density predictions for the sequence of
fitted HAL models; the index and value of the L1 regularization parameter
minimizing the density loss; and the sequence of empirical risks for the
sequence of fitted HAL models.
# simulate data: W ~ U[-4, 4] and A|W ~ N(mu = W, sd = 0.5)
set.seed(11249)
n_train <- 50
w <- runif(n_train, -4, 4)
a <- rnorm(n_train, w, 0.5)
# fit cross-validated HAL-based density estimator of A|W
haldensify_cvfit <- fit_haldensify(
  A = a, W = w, n_bins = 10L, lambda_seq = exp(seq(-1, -10, length = 100)),
  # the following arguments are passed to hal9001::fit_hal()
  max_degree = 3, reduce_basis = 1 / sqrt(length(a))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.