Description
Usage
Arguments
Details
Value
Examples
View source: R/predict.R
Prediction Method for HAL Conditional Density Estimation
 ## S3 method for class 'haldensify'
(
object,
,
new_A,
new_W,
trim = ,
trim_min = 1/((new_A)),
lambda_select = ("cv", "undersmooth", "all")
)

object 
An object of class haldensify , containing the
results of fitting the highly adaptive lasso for conditional density
estimation, as produced by a call to haldensify .

... 
Additional arguments passed to predict as necessary.

new_A 
The numeric vector or similar of the observed values for
which a conditional density estimate is to be generated.

new_W 
A data.frame , matrix , or similar giving the
values of baseline covariates (potential confounders) for the conditioning
set of the observed values A .

trim 
A logical indicating whether estimates of the conditional
density below the value indicated in trim_min should be truncated.

trim_min 
A numeric indicating the minimum allowed value of the
resultant density predictions. Any predicted density values below this
tolerance threshold are set to the indicated minimum. The default is to use
the inverse of the square root of the sample size of the prediction set,
i.e., 1/sqrt(n); another notable choice is 1/sqrt(n)/log(n). If there are
observations in the prediction set with values of new_A outside of
the support of the training set (i.e., provided in the argument A to
haldensify ), their predictions are similarly truncated.

lambda_select 
A character indicating whether to return the
predicted density for the value of the regularization parameter chosen by
the global crossvalidation selector or whether to return an undersmoothed
sequence (which starts with the crossvalidation selector's choice but also
includes all values in the sequence that are less restrictive). The default
is "cv" for the global crossvalidation selector. Setting the choice
to "undersmooth" returns a matrix of predicted densities, with each
column corresponding to a value of the regularization parameter less than
or equal to the choice made by the global crossvalidation selector. When
"all" is set, predictions are returned for the full sequence of the
regularization parameter on which the HAL model object was fitted.

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
15  # simulate data: W ~ U[4, 4] and AW ~ N(mu = W, sd = 0.5)
n_train < 50
w < (n_train, 4, 4)
a < (n_train, w, 0.5)
# HALbased density estimator of AW
haldensify_fit < (
A = a, W = w, n_bins = 10L, lambda_seq = ((1, 10, = 100)),
# the following arguments are passed to hal9001::fit_hal()
max_degree = 5, smoothness_orders = 0, num_knots = ,
reduce_basis = 1 / ((a))
)
# predictions to recover conditional density of AW
new_a < (4, 4, = 0.1)
new_w < (0, (new_a))
pred_dens < (haldensify_fit, new_A = new_a, new_W = new_w)

nhejazi/haldensify documentation built on May 7, 2021, 12:10 a.m.