rdd_pred: RDD coefficient prediction

Description Usage Arguments Details Value References Examples

View source: R/rdd_pred.R

Description

Function to predict the RDD coefficient in presence of covariate (without covariates, returns the same than rdd_coef)

Usage

1
2
3
4
5
6
7
8
9
rdd_pred(
  object,
  covdata,
  se.fit = TRUE,
  vcov. = NULL,
  newdata,
  stat = c("identity", "sum", "mean"),
  weights
)

Arguments

object

A RDD regression object

covdata

New data.frame specifying the values of the covariates, can have multiple rows.

se.fit

A switch indicating if standard errors are required.

vcov.

Specific covariance function (see package sandwich ), by default uses the vcov

newdata

Another data on which to evaluate the x/D variables. Useful in very few cases.

stat

The statistic to use if there are multiple predictions, 'identity' just returns the single values, 'mean' averages them

weights

Eventual weights for the averaging of the predicted values.

Details

The function rdd_pred does a simple prediction of the RDD effect

RDDeffect= μ(x, z, D=1) - μ(x, z, D=0)

When there are no covariates (and z is irrelevant in the equation above), this amounts exactly to the usual RDD coefficient, shown in the outputs, or obtained with rdd_coef. If there were covariates, and if these covariates were estimated using the “include” strategy and with different coefficients left and right to the cutoff (i.e. had argument slope = “separate”), than the RDD effect is also dependent on the value of the covariate(s). rdd_pred allows to set the value of the covariate(s) at which to evaluate the RDD effect, by providing a data.frame with the values for the covariates. Note that the effect can be evaluated at multiple points, if you provide multiple rows of covdata.

In pressence of covariate-specific RDD effect, one may wish to estimate an average effect. This can be done by setting the argument stat='mean'. Weights can additionally be added, with the argument weights, to obtain a weighted-average of the predictions. Note however that in most cases, this will be equivalent to provide covariates at their (weighted) mean value, which will be much faster also!

Standard errors, obtained setting the argument se.fit=TRUE, are computed using following formula:

x_i Ω x_i^{'}

where Ω is the estimated variance-covariance matrix ( by default σ^2(X^{'}X)^{-1} using vcov) and x_i is the input data (a mix of covdata and input data). If one wishes individual predictions, standard errors are simply obtained as the square of that diagonal matrix, whereas for mean/sum, covariances are taken into account.

Value

Returns the predicted value(s), and, if se.fit=TRUE, their standard errors.

References

Froehlich (2007) Regression discontinuity design with covariates, IZA discussion paper 3024

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Load data, add (artificial) covariates:
data(house)
n_Lee <- nrow(house)
z1 <- runif(n_Lee)
house_rdd <- rdd_data(y=y, x=x, data=house, covar=z1, cutpoint=0)

# estimation without covariates: rdd_pred is the same than rdd_coef:
reg_para <- rdd_reg_lm(rdd_object=house_rdd)

rdd_pred(reg_para)
rdd_coef(reg_para, allInfo=TRUE)

# estimation with covariates: 
reg_para_cov <- rdd_reg_lm(rdd_object=house_rdd,
                          covariates='z1',
                          covar.opt=list(slope='separate') )

# should obtain same result as with RDestimate                             
rdd_pred(reg_para_cov, covdata=data.frame(z1=0)) 
  
# evaluate at mean of z1 (as comes from uniform)
rdd_pred(reg_para_cov, covdata=data.frame(z1=0.5))

rddtools documentation built on Jan. 10, 2022, 5:07 p.m.