Description Usage Arguments Details Value Examples
Prediction Method for HAL Conditional Density Estimation
1 2 3 4 5 6 7 8 9 10 |
object |
An object of class |
... |
Additional arguments passed to |
new_A |
The |
new_W |
A |
trim |
A |
trim_min |
A |
lambda_select |
A |
Method for computing and extracting predictions of the conditional
density estimates based on the highly adaptive lasso estimator, returned as
an S3 object of class haldensify
from haldensify
.
A numeric
vector of predicted conditional density values from
a fitted haldensify
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # simulate data: W ~ U[-4, 4] and A|W ~ N(mu = W, sd = 0.5)
n_train <- 50
w <- runif(n_train, -4, 4)
a <- rnorm(n_train, w, 0.5)
# HAL-based density estimator of A|W
haldensify_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))
)
# predictions to recover conditional density of A|W
new_a <- seq(-4, 4, by = 0.1)
new_w <- rep(0, length(new_a))
pred_dens <- predict(haldensify_fit, new_A = new_a, new_W = new_w)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.