compute_posterior_m_nn {GPCERF} | R Documentation |
Calculates the posterior mean of a point on the CERF based on the nnGP model. This function also returns the weights assigned to all nearest neighbors when calculating the posterior mean.
compute_posterior_m_nn(
hyperparam,
w,
gps_w,
obs_ord,
y_obs_ord,
kernel_fn = function(x) exp(-x^2),
n_neighbor = 10,
block_size = 10000
)
hyperparam |
A set of hyperparameters in the GP model. |
w |
A scaler representing the exposure level for the point of interest on the CERF. |
gps_w |
The GPS for all samples when their exposure levels are set
at |
obs_ord |
A matrix of two columns. First column is the observed exposure levels of all samples; second is the GPS at the observed exposure levels. The rows are in ascending order for the first column. |
y_obs_ord |
A vector of observed outcome values. The vector is ordered
as |
kernel_fn |
The covariance function of the GP. |
n_neighbor |
The number of nearest neighbors on one side. |
block_size |
Number of samples included in a computation block.
Mainly used to balance the speed and memory requirement.
Larger |
TODO: The first column is the selected index and the second column is weight.
A two-column matrix. The first column is the weights assigned to each
nearest neighbor. The second column is the corresponding observed outcome
value. The weight in the last row of this matrix is NA and the observed
outcome value is the estimated posterior mean of the CERF at point w
,
which is the weighted sum of all observed outcome values of the neighbors.