Learn R Programming

geocausal (version 0.3.2)

get_cate: Generate a Hajek estimator for heterogeneity analysis

Description

A function that returns a Hajek estimator of CATE for a spatial or spatio-temporal effect modifier

Usage

get_cate(
  obs,
  cf1,
  cf2,
  treat,
  pixel_count_out,
  lag,
  trunc_level = 0.95,
  time_after = TRUE,
  entire_window = NULL,
  em = NULL,
  E_mat = NULL,
  nbase = 6,
  spline_type = "ns",
  intercept = TRUE,
  eval_values = NULL,
  eval_mat = NULL,
  test_beta = NULL,
  bound = 1,
  save_weights = TRUE,
  ...
)

Value

list of the following: `est_beta`: estimated regression coefficient `V_beta`: estimated asymptotic covariance matrix of regression coefficient (normalized by total time periods) `chisq_stat`: observed chi-square statistics for the hypothesis test `p.value`: observed chi-square statistics for the hypothesis test `specification`: information about the specification of the spline basis and the values on which the CATE is estimated `est_eval`: estimated CATE evaluted at chosen values `V_eval`: estimated asymptotic covariance matrix of the estimated CATE values (normalized by total time periods) `mean_effect`: Mean of the pseudo pixel effect `total_effect`: Mean of the pseudo effect for the window `entire_window`. It is equal to mean effect times the total number of pixels inside the chosen window

Arguments

obs

observed density

cf1

counterfactual density 1

cf2

counterfactual density 2

treat

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

pixel_count_out

column of a hyperframe that summarizes the number of outcome events in each pixel

lag

integer that specifies lags to calculate causal estimates.

trunc_level

the level of truncation for the weights (0-1).

time_after

whether to include one unit time difference between treatment and outcome. By default = TRUE

entire_window

owin object (the entire region of interest)

em

treat column of a hyperframe that summarizes the effect modifier data. In the form of `hyperframe$column`. It can be NULL if E_mat is provided.

E_mat

optional covariance matrix (excluding the intercept) for the effect modifier. If provided, then the regression model will be based on this matrix. If `intercept = TRUE`, then a column of 1 will be add to `E_mat`.

nbase

number of bases for splines

spline_type

type of splines. Either `"ns"` or `"bs"`.

intercept

whether to include intercept in the regression model. Default is TRUE.

eval_values

a vector of values of the effect modifier for which CATE will be evaluated. Default is a `seq(a,b,length.out=20)` where `a` and `b` are minimum and maximum values of the effect modifier.

eval_mat

evaluated spline basis (excluding the intercept) matrix at `eval_values`. If `intercept = TRUE`, then a column of 1 will be add to `eval_mat`.

test_beta

a vector of integers contain the indices of the coefficients that are included in the hypothesis test. By default, the null hypothesis is that all coefficient (except the intercept is 0). See details below

bound

either `1` or `2` specifying which bound estimator will be used. Default is `1`

save_weights

whether to save weights. Default is `TRUE`

...

arguments passed onto the function

Details

`E_mat` should be a matrix or array of dimensions \(n\) by \(m\) where \(n\) is the product of image dimensions and number of time period, and \(m\) is `nbase`-`intercept`. If you want to construct your own covariate matrix `E_mat`, you should use `get_em_vec()` to convert the effect modifer(usually a column of a hyperframe) to a vector, and then construct the splines basis based on the vector. The covariate matrix`E_mat` should not the column for intercept. The function `get_cate()` will conduct a hypothesis testing on whether all the selected coefficients are 0. `test_beta` is a vector of positive integers specifying the indices of the chosen beta. The coefficients (except the intercept) are indexed by `1,2,...,nbase-intercept`. By default, it test whether all the coefficients(except the intercept) are 0, and this is testing the the heterogeneity effect of the effect modifier.