General polynomial estimator of the regression discontinuity

Description

Compute RDD estimate allowing a locally kernel weighted version of any estimation function possibly on the range specified by bandwidth

Usage

1
2
3
4
rdd_gen_reg(rdd_object, fun = glm, covariates = NULL, order = 1,
  bw = NULL, slope = c("separate", "same"), covar.opt = list(strategy =
  c("include", "residual"), slope = c("same", "separate"), bw = NULL), weights,
  ...)

Arguments

rdd_object

Object of class rdd_data created by rdd_data

fun

The function to estimate the parameters

covariates

Formula to include covariates

order

Order of the polynomial regression.

bw

A bandwidth to specify the subset on which the kernel weighted regression is estimated

slope

Whether slopes should be different on left or right (separate), or the same.

covar.opt

Options for the inclusion of covariates. Way to include covariates, either in the main regression (include) or as regressors of y in a first step (residual).

weights

Optional weights to pass to the lm function. Note this cannot be entered together with bw

...

Further arguments passed to fun. See the example.

Details

This function allows the user to use a custom estimating function, instead of the traditional lm(). It is assumed that the custom funciton has following behaviour:

  1. A formula interface, together with a data argument

  2. A weight argument

  3. A coef(summary(x)) returning a data-frame containing a column Estimate

Note that for the last requirement, this can be accomodated by writing a specific rdd_coef function for the class of the object returned by fun.

Value

An object of class rdd_reg_lm and class lm, with specific print and plot methods

References

TODO

Examples

1
2
3
4
5
6
7
8
9
## Step 0: prepare data
data(house)
house_rdd <- rdd_data(y=house$y, x=house$x, cutpoint=0)

## Estimate a local probit:
house_rdd$y <- with(house_rdd, ifelse(y<quantile(y, 0.25), 0,1))
reg_bin_glm <- rdd_gen_reg(rdd_object=house_rdd, fun= glm, family=binomial(link='probit'))
print(reg_bin_glm)
summary(reg_bin_glm)