gprd: Gaussian Process Regression for Regression Discontinuity

Description Usage Arguments Value See Also

View source: R/gprd.R

Description

Gaussian Process Regression for Regression Discontinuity

Usage

1
2
3
4
5
6
7
8
9
gprd(
  x,
  y,
  cutoff = 0,
  estimator = "piecewise",
  hypers = list(list(b = c(0, 0), B = diag(10, nrow = 2), sigma_y = 1, sigma_f = 1, ell
    = 1), list(b = c(0, 0), B = diag(10, nrow = 2), sigma_y = 1, sigma_f = 1, ell = 1)),
  ci_width = 0.95
)

Arguments

x

A numeric vector giving the observations of the explanatory variable

y

A numeric vector giving the observations of the outcome

cutoff

A numeric vector of length one giving the discontinutiy cutoff; the default is 0.

estimator

A character vector of length one giving the estimation strategy; should be one of "global" (one unknown function for all observations, with dummy variable added to indicate treatment) or "piecewise" (different unknown functions for observations to the left of the cutoff and to the right). The default is "piecewise".

hypers

A list giving the hyperparameters of the model. If estimator = "piecewise", should be a list of length two, where each element is itself a list giving the hyperparameters for the functions to each side of the cutoff. The list(s) of hypers should have elements "b" (a numeric vector giving the coefficients' prior mean), "B" (a numeric matrix giving the coefficients' prior covariance), "sigma_y" (a numeric vector of length one giving the output variance), "sigma_f" (a numeric vector of length one giving the function variance), and "ell" (a numeric vector giving the length scale(s)).

ci_width

A numeric vector of length one between 0 and 1 giving the width of the confidence interval for the treatment effect.

Value

A list of length five with class gprd and elements

tau_mean

The treatment effect estimate

tau_ci

A named numeric ector of length two giving the requested confidence interval (the names are the confidence interval quantiles)

cutoff

A numeric vector of length one giving the cutoff

estimator

A character vector of length one giving the estimation strategy

f

A list where each element is an object of class gpr with information on the posterior over the relevant function; if estimator = "global", the list will be of length one, giving the posterior over the global mapping from x to y, while if estimator = "piecewise", the list will be of length two with elements f_l (giving the posterior over the function to the left of the cutoff) and f_r (giving the posterior over the function to the right of the cutoff)

An object of class gpr is a list of length eight with the following elements:

predictive_mean

The mean of the predictive distribution at test cases test_input; in this case, the cutoff

predictive_var

The variance of the predictive distribution at test cases test_input; in this case, the cutoff

beta_bar

The mean of the posterior of the linear mean coefficients

training_input

The input variable obervations for training cases

training_outcomes

The outcome observations for training cases

test_input

The input variable observations predictions were provided for

prior_covariance

The covariance function evaluated for the training inputs, with observation noise added

prior_cov_inverse

The inverse of prior_covariance; having this available is useful for generating other predictions

hyperparameters

The hyperparameters used for the GP regression, provided in a list of length five: beta_prior_cov, giving the beta prior covariance; beta_prior_mean, giving the beta prior mean; sigma_f, giving the scale factor for the GP prior; ell, giving the length scale for the GP prior; and sigma_y, giving the outcome observation noise (the likelihood hyper).

See Also

plot.gprd


duckmayr/gprd documentation built on Dec. 27, 2020, 7:33 a.m.