Learn R Programming

rddapp (version 1.2.1)

rd_type: Determine Type of Regression Discontinuity Design

Description

rd_type cross-tabulates observations based on (1) a binary treatment and (2) one or two assignments and their cutoff values. This is an internal function and is typically not directly invoked by the user. It can be accessed using the triple colon, as in rddapp:::rd_type().

Usage

rd_type(
  data,
  treat,
  assign_1,
  cutoff_1,
  operator_1 = NULL,
  assign_2 = NULL,
  cutoff_2 = NULL,
  operator_2 = NULL
)

Arguments

data

A data.frame with each row representing an observation.

treat

The name of a numeric variable (treated = positive values).

assign_1

The variable name of the primary assignment.

cutoff_1

The cutoff value of the primary assignment.

operator_1

The operator for the primary assignment.

assign_2

The variable name of the secondary assignment.

cutoff_2

The cutoff value of the secondary assignment.

operator_2

The operator for the secondary assignment.

Value

A list of two elements:

crosstab

The cross-table as a data.frame.

type

The type of design as a string.

Examples

Run this code
# NOT RUN {
x <- runif(1000, -1, 1)
cov <- rnorm(1000)
y <- 3 + 2 * x + 3 * cov + 10 * (x >= 0) + rnorm(1000)
df <- data.frame(cbind(y, x, t = x>=0))
rddapp:::rd_type(df, 't', 'x', 0, 'geq')
# }

Run the code above in your browser using DataLab