gen_data | R Documentation |
Generate Simulation Data for a Sharp RDD with Mismeasured Running Variable
gen_data(n, sigma, cutoff, lower = FALSE, u_dist = c("gauss", "lap"),
x_dist = c("gauss", "exp", "unif", "gaussmix"), mu_x = 0, sd_x = 1,
rate_x = 1, min_x = -sqrt(3), max_x = sqrt(3), nmix = 5,
mu_min = -1.5, mu_max = 1.5, sds = 0.25, ...)
n |
sample size |
sigma |
standard deviation of the measurement error term |
cutoff |
threshold value for the assignment |
lower |
if TRUE, then those with |
u_dist |
distribution of the measurement error. Only "gauss" or "lap" is supported. |
x_dist |
distribution of the true running variable. Either "gauss", "gaussmix" or any function that a generate random sample. |
mu_x , sd_x |
mean and standard deviation of gaussian distribution.
Used if |
rate_x |
rate parameter used when |
min_x , max_x |
min and max parameter used when |
nmix , mu_min , mu_max , sds |
parameters used
when |
... |
additional argument to be passed to the generator function for running variable |
list of 4 numeric vectors of length n.
d: assignment variable
w: observed running variable
x: true running variable
u: measurement error
gen_data(100, 0.2, 0)
gen_data(100, 0.2, 1, u_dist = "lap", x_dist = "exp")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.