rdd_data: Construct rdd_data

View source: R/rdd_data.R

rdd_dataR Documentation

Construct rdd_data

Description

Construct the base RDD object, containing x, y and the cutpoint, eventuallay covariates.

Usage

rdd_data(y, x, covar, cutpoint, z, labels, data)

Arguments

y

Output

x

Forcing variable

covar

Exogeneous variables

cutpoint

Cutpoint

z

Assignment variable for the fuzzy case. Should be 0/1 or TRUE/FALSE variable.

labels

Additional labels to provide as list (with entries x, y, and eventually vector covar). Unused currently.

data

A data-frame for the x and y variables. If this is provided, the column names can be entered directly for argument x, y and covar. For covar, should be a character vector.

Details

Arguments x, y (and eventually covar) can be either given as:

  • vectors (eventually data-frame for covar)

  • quote/character when data is also provided. For multiple covar, use a vector of characters

Value

Object of class rdd_data, inheriting from data.frame

Author(s)

Matthieu Stigler Matthieu.Stigler@gmail.com

Examples

data(house)
rd <- rdd_data(x=house$x, y=house$y, cutpoint=0)
rd2 <- rdd_data(x=x, y=y, data=house, cutpoint=0)

# The print() function is the same as the print.data.frame:
rd

# The summary() and plot() function are specific to rdd_data
summary(rd)
plot(rd)

# for the fuzzy case, you need to specify the assignment variable z:
rd_dat_fakefuzzy <- rdd_data(x=house$x, y=house$y, 
                             z=ifelse(house$x>0+rnorm(nrow(house), sd=0.05),1,0), 
                             cutpoint=0)
summary(rd_dat_fakefuzzy)

bquast/RDDtools documentation built on Nov. 16, 2023, 3:28 a.m.