Learn R Programming

geocausal (version 0.3.2)

get_weighted_surf: Generate average weighted surfaces

Description

A function that returns averaged weighted surfaces (both IPW and Hajek) along with weights

Usage

get_weighted_surf(
  obs_dens,
  cf_dens,
  mediation = FALSE,
  cate = FALSE,
  obs_med_log_sum_dens,
  cf_med_log_sum_dens,
  treatment_data,
  smoothed_outcome,
  lag,
  entire_window,
  time_after,
  truncation_level = truncation_level
)

Value

list of an average weighted surface (`avarage_surf`, an `im` object), a Hajek average weighted surface (`average_weighted_surf_haj`, an `im` object), weights, and smoothed outcomes

Arguments

obs_dens

observed density

cf_dens

counterfactual density

mediation

whether to perform causal mediation analysis. By default, FALSE.

cate

whether to perform the heterogeneity analysis. By default, FALSE.

obs_med_log_sum_dens

sum of log densities of mediators for the observed (if `mediation = TRUE`)

cf_med_log_sum_dens

sum of log densities of mediators for counterfactual (if `mediation = TRUE`)

treatment_data

column of a hyperframe that summarizes treatment data. In the form of `hyperframe$column`.

smoothed_outcome

column of a hyperframe that summarizes the smoothed outcome data

lag

integer that specifies lags to calculate causal estimates

entire_window

owin object (the entire region of interest)

time_after

whether to include one unit time difference between treatment and outcome

truncation_level

the level at which the weights are truncated (see `get_estimates()`)

Details

`get_weighted_surf()` is an internal function to `get_estimates()` function. If `time_after` is TRUE, then this function uses treatment data and weights from lag to nrow(data)-1, and outcome data from lag+1 to nrow(data).