estimate_npmetric_erf: Estimate Smoothed Exposure-Response Function (ERF) for...

Description Usage Arguments Details Value Examples

View source: R/estimate_npmetric_erf.R

Description

Estimate smoothed exposure-response function (ERF) for matched and weighted data set using non-parametric models.

Usage

1
2
3
4
5
6
7
8
estimate_npmetric_erf(
  matched_Y,
  matched_w,
  matched_counter = NULL,
  bw_seq = seq(0.2, 2, 0.2),
  w_vals,
  nthread
)

Arguments

matched_Y

a vector of outcome variable in the matched set.

matched_w

a vector of continuous exposure variable in the matched set.

matched_counter

a vector of counter variable in the matched set.

bw_seq

a vector of bandwidth values (Default is seq(0.2,2,0.2)).

w_vals

a vector of values that you want to calculate the values of the ERF at.

nthread

number of available cores.

Details

Estimate Functions Using Local Polynomial kernel regression Package: ‘KernSmooth’.

Value

The function returns a gpsm_erf object. The object includes the following attributes:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
m_d <- generate_syn_data(sample_size = 100)
pseudo_pop <- generate_pseudo_pop(m_d$Y,
                                  m_d$treat,
                                  m_d[c("cf1","cf2","cf3","cf4","cf5","cf6")],
                                  ci_appr = "matching",
                                  pred_model = "sl",
                                  sl_lib = c("m_xgboost"),
                                  params = list(xgb_nrounds=c(10,20,30),
                                   xgb_eta=c(0.1,0.2,0.3)),
                                  nthread = 1,
                                  covar_bl_method = "absolute",
                                  covar_bl_trs = 0.1,
                                  covar_bl_trs_type="mean",
                                  max_attempt = 1,
                                  matching_fun = "matching_l1",
                                  delta_n = 1,
                                  scale = 0.5)

erf_obj <- estimate_npmetric_erf(pseudo_pop$pseudo_pop$Y,
                                 pseudo_pop$pseudo_pop$w,
                                 bw_seq=seq(0.2,2,0.2),
                                 w_vals = seq(2,20,0.5),
                                 nthread = 1)

CausalGPS documentation built on Feb. 7, 2022, 5:12 p.m.