compute_deriv_nn {GPCERF}R Documentation

Calculate derivatives of CERF for nnGP

Description

Calculates the posterior mean of the derivative of CERF at a given exposure level with nnGP.

Usage

compute_deriv_nn(
  w,
  w_obs,
  gps_m,
  y_obs,
  hyperparam,
  n_neighbor,
  block_size,
  kernel_fn = function(x) exp(-x),
  kernel_deriv_fn = function(x) -exp(-x)
)

Arguments

w

A scalar of exposure level of interest.

w_obs

A vector of observed exposure levels of all samples.

gps_m

An S3 gps object including: gps: A data.frame of GPS vectors. - Column 1: GPS - Column 2: Prediction of exposure for covariate of each data sample (e_gps_pred). - Column 3: Standard deviation of e_gps (e_gps_std) used_params: - dnorm_log: TRUE or FALSE

y_obs

A vector of observed outcome values.

hyperparam

A vector of hyper-parameters in the GP model.

n_neighbor

The number of nearest neighbors on one side.

block_size

The number of samples included in a computation block. Mainly used to balance the speed and memory requirement. Larger block_size is faster, but requires more memory.

kernel_fn

The covariance function. The input is the square of Euclidean distance.

kernel_deriv_fn

The partial derivative of the covariance function. The input is the square of Euclidean distance.

Value

A scalar of estimated derivative of CERF at w in nnGP.


[Package GPCERF version 0.2.4 Index]