rd_type {rddapp} | R Documentation |
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 |
treat |
A string specifying the name of the numeric treatment variable (treated = positive values). |
assign_1 |
A string specifying the variable name of the primary assignment. |
cutoff_1 |
A numeric value containing the cutpoint at which assignment to the treatment is determined, for the primary assignment. |
operator_1 |
The operator specifying the treatment option according to design for the primary assignment.
Options are
|
assign_2 |
An optional string specifying the variable name of the secondary assignment. |
cutoff_2 |
An optional numeric value containing the cutpoint at which assignment to the treatment is determined, for the secondary assignment. |
operator_2 |
The operator specifying the treatment option according to design for the secondary assignment.
Options are
|
Value
rd_type
returns a list of two elements:
crosstab |
The cross-table as a data.frame. Columns in the dataframe include treatment rules, number of observations in the control condition, number of observations in the treatment condition, and the probability of an observation being in treatment or control. |
type |
A string specifying the type of design used, either |
Examples
set.seed(12345)
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')