compute_weight_gp {GPCERF}R Documentation

Calculate weights for estimation of a point on CERF

Description

Calculates the weights of observed outcomes which is then used to estimate the posterior mean of CERF at a given exposure level.

Usage

compute_weight_gp(
  w,
  w_obs,
  scaled_obs,
  hyperparam,
  inv_sigma_obs,
  gps_m,
  est_sd = FALSE,
  kernel_fn = function(x) exp(-x^2)
)

Arguments

w

A scalar of exposure level of interest.

w_obs

A vector of observed exposure levels of all samples.

scaled_obs

A matrix of two columns.

  • First column is the scaled GPS value of all samples (GPS * 1 / sqrt(alpha))

  • Second column is the scaled exposure value of all samples (w * 1/sqrt(beta))

hyperparam

A vector of hyper-parameters for the GP.

  • First element: alpha

  • Second element: beta

  • Third element: gamma/sigma

inv_sigma_obs

Inverse of the covariance matrix between observed 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 FLASE

est_sd

Should the posterior se be computed (default=FALSE)

kernel_fn

The covariance function of GP.

Value

A list of two elements, weight and standard deviation.


[Package GPCERF version 0.2.4 Index]