### Run rdrobust with Default Settings Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html This example demonstrates how to use the rdbwselect_2014 function with default settings. It requires the dependent variable 'y' and the running variable 'x'. ```r x<-runif(1000,-1,1) y<-5+3*x+2*(x>=0)+rnorm(1000) rdbwselect_2014(y,x) ``` -------------------------------- ### Perform Bandwidth Selection with rdbwselect Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Example of generating random data and selecting a bandwidth for a regression discontinuity design. ```R x <- runif(1000,-1,1) y <- 5 + 3*x + 2*(x>=0) + rnorm(1000) rdbwselect(y,x) ``` -------------------------------- ### GET /data/rdrobust_RDsenate Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Access the RD Senate dataset containing incumbency advantage measures for the U.S. Senate (1914-2010). ```APIDOC ## GET /data/rdrobust_RDsenate ### Description Retrieves the RD Senate dataset, which includes measures of incumbency advantage in the U.S. Senate for the period 1914-2010. ### Method GET ### Endpoint data(rdrobust_RDsenate) ### Response #### Success Response (200) - **margin** (numeric vector) - The margin of victory or relevant RD variable. - **vote** (numeric vector) - The vote share or outcome variable. ``` -------------------------------- ### POST /rdbwselect Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Configures and executes bandwidth selection for local-polynomial regression-discontinuity estimators. ```APIDOC ## POST /rdbwselect ### Description Performs bandwidth selection for RD designs with options to control for mass points, bandwidth restrictions, and variable standardization. ### Parameters #### Request Body - **masspoints** (string) - Optional - Controls for repeated observations. Options: 'off', 'check', 'adjust'. Default: 'adjust'. - **bwcheck** (integer) - Optional - Minimum number of unique observations for preliminary bandwidths. - **bwrestrict** (boolean) - Optional - If TRUE, restricts bandwidths to the range of x. Default: TRUE. - **stdvars** (boolean) - Optional - If TRUE, standardizes x and y before computation. Default: FALSE. ### Response #### Success Response (200) - **N** (vector) - Sample sizes to the left and right of the cutoff. - **c** (numeric) - Cutoff value. - **p** (integer) - Order of the local-polynomial for point-estimator. - **q** (integer) - Order of the local-polynomial for bias-correction estimator. - **bws** (matrix) - Estimated bandwidths. - **bwselect** (string) - Bandwidth selection procedure employed. - **kernel** (string) - Kernel function used. ``` -------------------------------- ### POST /rdbwselect_2014 Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Deprecated bandwidth selection procedure for backward compatibility with 2014 methodologies. ```APIDOC ## POST /rdbwselect_2014 ### Description Deprecated command implementing bandwidth selectors for local polynomial RD point estimators as described in Calonico, Cattaneo and Titiunik (2014). Use rdbwselect for current implementations. ### Parameters #### Request Body - **y** (numeric) - Required - Dependent variable. - **x** (numeric) - Required - Running variable. - **c** (numeric) - Optional - Cutoff value. Default: 0. - **p** (integer) - Optional - Order of local-polynomial. Default: 1. - **q** (integer) - Optional - Order of bias-correction estimator. Default: 2. - **kernel** (string) - Optional - Kernel function. Default: 'tri'. ``` -------------------------------- ### POST /rdbwselect_2014 Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Computes bandwidths for RD designs using various data-driven selection procedures. ```APIDOC ## POST /rdbwselect_2014 ### Description Computes data-driven bandwidths for local-polynomial regression discontinuity estimators. ### Parameters #### Request Body - **y** (vector) - Required - The dependent variable. - **x** (vector) - Required - The running variable (score). - **subset** (vector) - Optional - Subset of observations to be used. - **c** (numeric) - Optional - RD cutoff in x; default is 0. - **p** (integer) - Optional - Order of local-polynomial for point-estimator; default is 1. - **q** (integer) - Optional - Order of local-polynomial for bias-correction; default is 2. - **deriv** (integer) - Optional - Order of derivative to be estimated; default is 0. - **rho** (numeric) - Optional - Sets pilot bandwidth b = h/rho. - **kernel** (string) - Optional - Kernel function: 'triangular' (default), 'epanechnikov', 'uniform'. - **bwselect** (string) - Optional - Bandwidth selection procedure: 'CCT' (default), 'IK', 'CV'. - **scaleregul** (numeric) - Optional - Scaling factor for regularization; default is 1. - **delta** (numeric) - Optional - Quantile for CV procedure; default is 0.5. - **cvgrid_min** (numeric) - Optional - Minimum value of bandwidth grid for CV. - **cvgrid_max** (numeric) - Optional - Maximum value of bandwidth grid for CV. - **cvgrid_length** (integer) - Optional - Bin length of bandwidth grid for CV. - **cvplot** (boolean) - Optional - Generates graph of CV objective function. - **vce** (string) - Optional - Variance-covariance matrix estimator: 'nn' (default), 'resid'. - **matches** (integer) - Optional - Number of matches for 'nn' estimator; default is 3. - **all** (boolean) - Optional - If specified, reports CCT, IK, and CV procedures. ### Response #### Success Response (200) - **bws** (matrix) - Estimated bandwidths for each procedure. - **bwselect** (string) - Bandwidth selection procedure employed. - **kernel** (string) - Kernel function used. - **p** (integer) - Order of point-estimator polynomial. - **q** (integer) - Order of bias-correction polynomial. ### Request Example { "y": [5.1, 4.2, ...], "x": [-0.5, 0.2, ...], "bwselect": "CCT" } ``` -------------------------------- ### RD Estimation Configuration Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Parameters for configuring the rdrobust estimation procedure. ```APIDOC ## RD Estimation Parameters ### Description Configuration parameters for the rdrobust estimation function, covering dependent variables, bandwidth selection, and variance estimation. ### Parameters - **y** (variable) - Required - The dependent variable. - **x** (variable) - Required - The running variable (score or forcing variable). - **c** (numeric) - Optional - The RD cutoff in x; default is 0. - **fuzzy** (variable) - Optional - Treatment status variable for fuzzy RD estimation. - **deriv** (integer) - Optional - Order of the derivative of the regression functions; default is 0. - **p** (integer) - Optional - Order of the local-polynomial for point-estimator; default is 1. - **q** (integer) - Optional - Order of the local-polynomial for bias-correction; default is 2. - **covs** (variable) - Optional - Additional covariates for estimation and inference. - **covs_drop** (boolean) - Optional - Whether to drop collinear covariates; default is TRUE. - **kernel** (string) - Optional - Kernel function: triangular (default), epanechnikov, or uniform. - **bwselect** (string) - Optional - Bandwidth selection procedure; default is mserd. - **vce** (string) - Optional - Variance-covariance matrix estimator; default is nn. - **cluster** (variable) - Optional - Cluster ID variable for cluster-robust variance estimation. - **nnmatch** (integer) - Optional - Minimum number of neighbors for nn variance estimator; default is 3. ``` -------------------------------- ### RDrobust Function Arguments Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Detailed explanation of the arguments for the main RDrobust function. ```APIDOC ## RDrobust Function Arguments ### Description This section details the arguments used by the RDrobust function for regression discontinuity analysis. ### Arguments #### Core Data Arguments - **y** (variable) - The dependent variable. - **x** (variable) - The running variable (score or forcing variable). - **c** (numeric) - Specifies the RD cutoff in `x`; default is `c = 0`. - **weights** (variable) - The variable used for optional weighting of the estimation procedure. The unit-specific weights multiply the kernel function. - **subset** (vector) - An optional vector specifying a subset of observations to be used. #### Polynomial and Binning Options - **p** (numeric) - Specifies the order of the global-polynomial used to approximate the population conditional mean functions for control and treated units; default is `p = 4`. - **nbins** (numeric) - Specifies the number of bins used to the left and right of the cutoff. If not specified, `J+` and `J-` are estimated. - **binselect** (character) - Specifies the procedure to select the number of bins. Options include `es`, `espr`, `esmv` (default), `esmvpr`, `qs`, `qspr`, `qsmv`, `qsmvpr`. - **scale** (numeric) - A multiplicative factor for the optimal numbers of bins; default is `scale = 1`. - **masspoints** (character) - Checks and controls for repeated observations in the running variable. Options: `off`, `check`, `adjust` (default). #### Kernel and Bandwidth Options - **kernel** (character) - Specifies the kernel function. Options: `triangular`, `epanechnikov`, `uniform` (default). - **h** (numeric) - Specifies the bandwidth. If two are provided, the first is for below the cutoff, the second for above. #### Covariate Handling - **covs** (variable) - Specifies additional covariates to be used in the polynomial regression. - **covs_eval** (numeric/character) - Sets the evaluation points for additional covariates. Options: `0`, `"mean"` (default). - **covs_drop** (logical) - If TRUE, checks for and drops collinear additional covariates. Default is TRUE. - **ginv.tol** (numeric) - Tolerance used to invert matrices involving covariates when `covs_drop=TRUE`. #### Plotting and Graphical Options - **hide** (logical) - If TRUE, omits the RD plot; default is `hide = FALSE`. - **ci** (logical) - If TRUE, displays confidence intervals for each bin. - **shade** (logical) - If TRUE, replaces confidence intervals with shaded areas. - **title** (character) - Optional title for the RD plot. - **x.label** (character) - Optional label for the x-axis of the RD plot. - **y.label** (character) - Optional label for the y-axis of the RD plot. - **x.lim** (numeric) - Optional setting for the range of the x-axis. - **y.lim** (numeric) - Optional setting for the range of the y-axis. - **col.dots** (character) - Optional setting for the color of the dots in the RD plot. - **col.lines** (character) - Optional setting for the color of the lines in the RD plot. #### Other Options - **support** (numeric) - Specifies an optional extended support of the running variable for bin construction; default is the sample range. ``` -------------------------------- ### rdbwselect: Bandwidth Selection Procedures for Local Polynomial Regression Discontinuity Estimators Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html The rdbwselect function implements bandwidth selectors for local polynomial Regression Discontinuity (RD) point estimators and inference procedures. ```APIDOC ## rdbwselect ### Description Implements bandwidth selectors for local polynomial Regression Discontinuity (RD) point estimators and inference procedures. ### Usage ```R rdbwselect(y, x, c = NULL, fuzzy = NULL, deriv = NULL, p = NULL, q = NULL, covs = NULL, covs_drop = TRUE, ginv.tol = 1e-20, kernel = "tri", weights = NULL, bwselect = "mserd", vce = "nn", cluster = NULL, nnmatch = 3, scaleregul = 1, sharpbw = FALSE, all = NULL, subset = NULL, masspoints = "adjust", bwcheck = NULL, bwrestrict = TRUE, stdvars = FALSE) ``` ### Parameters * **y** (numeric vector) - The dependent variable. * **x** (numeric vector) - The running variable. * **c** (numeric scalar, optional) - The cutoff value for the running variable. Defaults to the median of x. * **fuzzy** (numeric vector, optional) - The instrument for the treatment indicator in fuzzy RD settings. * **deriv** (numeric scalar, optional) - The order of the derivative of the regression function to estimate. Defaults to 0. * **p** (numeric scalar, optional) - The order of the local polynomial. Defaults to 1. * **q** (numeric scalar, optional) - The order of the local polynomial for the second-stage estimation. Defaults to p. * **covs** (numeric matrix or data frame, optional) - Additional covariates to be included in the estimation. * **covs_drop** (logical, optional) - Whether to drop covariates that are collinear with the running variable. Defaults to TRUE. * **ginv.tol** (numeric scalar, optional) - Tolerance for generalized inverse. Defaults to 1e-20. * **kernel** (character string, optional) - The kernel function to use. Options: "tri", "epa", "uni", "triweight", "tricube", "gaussian", "cos", "logistic", "normal", "denisity". Defaults to "tri". * **weights** (numeric vector, optional) - Pre-specified weights for the observations. * **bwselect** (character string, optional) - Bandwidth selection method. Options: "mserd", "mse-comb", "msetest", "imsetest", "manual". Defaults to "mserd". * **vce** (character string, optional) - Variance-covariance estimation method. Options: "nn", "hc0", "hc1", "hc2", "hc3", "hc4". Defaults to "nn". * **cluster** (character string or vector, optional) - Variable(s) to be used for clustering standard errors. * **nnmatch** (numeric scalar, optional) - Number of nearest neighbors to use for nearest neighbor matching. Defaults to 3. * **scaleregul** (numeric scalar, optional) - Scalar for regularization. Defaults to 1. * **sharpbw** (logical, optional) - Whether to use sharp bandwidth selection. Defaults to FALSE. * **all** (logical, optional) - Whether to report all results. Defaults to NULL. * **subset** (logical vector, optional) - Subset of data to be used for estimation. * **masspoints** (character string, optional) - Method for handling mass points. Options: "adjust", "drop", "none". Defaults to "adjust". * **bwcheck** (logical, optional) - Whether to check bandwidth validity. Defaults to NULL. * **bwrestrict** (logical, optional) - Whether to restrict bandwidth to be within a certain range. Defaults to TRUE. * **stdvars** (logical, optional) - Whether to standardize variables. Defaults to FALSE. ### Request Example ```R # Example usage (replace with actual data) # rdbwselect(y = my_y_data, x = my_x_data) ``` ### Response #### Success Response (200) Returns a list containing selected bandwidths and related statistics. ``` -------------------------------- ### RDrobust Parameters and Return Values Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Detailed explanation of the parameters accepted by the RDrobust function and the structure of its return values. ```APIDOC ## RDrobust Function Documentation ### Description This section details the parameters available for the `rdrobust` function and the structure of the values it returns. ### Parameters #### Function Arguments - **level** (numeric) - Optional - Sets the confidence level for confidence intervals; default is `level = 95`. - **scalepar** (numeric) - Optional - Specifies scaling factor for the RD parameter of interest. Default is `scalepar = 1`. - **scaleregul** (numeric) - Optional - Specifies scaling factor for the regularization term in bandwidth selectors. Setting `scaleregul = 0` removes the regularization term; default is `scaleregul = 1`. - **sharpbw** (logical) - Optional - Option to perform fuzzy RD estimation using a bandwidth selection procedure for the sharp RD model. Automatically selected if there is perfect compliance at either side of the cutoff. - **detail** (logical) - Optional - If specified, `rdrobust` reports output from versions 2.2.0 and earlier. - **all** (logical) - Optional - If specified, `rdrobust` reports three procedures: (i) conventional RD estimates with conventional standard errors, (ii) bias-corrected estimates with conventional standard errors, (iii) bias-corrected estimates with robust standard errors. - **subset** (vector) - Optional - An optional vector specifying a subset of observations to be used. - **masspoints** (character) - Optional - Checks and controls for repeated observations in the running variable. Options are: `off` (ignores mass points), `check` (reports the number of unique observations at each side of the cutoff), `adjust` (controls that preliminary bandwidths contain a minimal number of unique observations). Default is `masspoints='adjust'`. - **bwcheck** (integer) - Optional - If a positive integer is provided, the preliminary bandwidth is enlarged to use at least `bwcheck` unique observations. - **bwrestrict** (logical) - Optional - If `TRUE`, computed bandwidths are restricted to lie within the range of `x`; default is `bwrestrict = TRUE`. - **stdvars** (logical) - Optional - If `TRUE`, `x` and `y` are standardized before computing bandwidths; default is `stdvars = FALSE`. ### Value - **N** (vector) - Sample sizes used to the left and to the right of the cutoff. - **N_h** (vector) - Effective sample sizes used to the left and to the right of the cutoff. - **c** (numeric) - Cutoff value. - **p** (integer) - Order of the polynomial used for estimation of the regression function. - **q** (integer) - Order of the polynomial used for estimation of the bias of the regression function. - **bws** (matrix) - Bandwidths used in the estimation. - **tau_cl** (vector) - Conventional local-polynomial estimate to the left and to the right of the cutoff. - **tau_bc** (vector) - Bias-corrected local-polynomial estimate to the left and to the right of the cutoff. - **coef** (vector) - Conventional and bias-corrected local-polynomial RD estimates. - **se** (vector) - Conventional and robust standard errors of the local-polynomial RD estimates. - **bias** (vector) - Estimated bias for the local-polynomial RD estimator below and above the cutoff. - **beta_Y_p_l** (vector) - Conventional p-order local-polynomial estimates to the left of the cutoff for the outcome variable. - **beta_Y_p_r** (vector) - Conventional p-order local-polynomial estimates to the right of the cutoff for the outcome variable. - **beta_T_p_l** (vector) - Conventional p-order local-polynomial estimates to the left of the cutoff for the first stage (fuzzy RD). - **beta_T_p_r** (vector) - Conventional p-order local-polynomial estimates to the right of the cutoff for the first stage (fuzzy RD). - **beta_covs** (vector) - Coefficients of the additional covariates, only returned when `covs()` are used. - **V_cl_l** (matrix) - Conventional variance-covariance matrix estimated below the cutoff. - **V_cl_r** (matrix) - Conventional variance-covariance matrix estimated above the cutoff. - **V_rb_l** (matrix) - Robust variance-covariance matrix estimated below the cutoff. - **V_rb_r** (matrix) - Robust variance-covariance matrix estimated above the cutoff. - **pv** (vector) - P-values associated with conventional, bias-corrected, and robust local-polynomial RD estimates. - **ci** (matrix) - Confidence intervals associated with conventional, bias-corrected, and robust local-polynomial RD estimates. ### Authors - Sebastian Calonico, University of California, Davis, CA. scalonico@ucdavis.edu. - Matias D. Cattaneo, Princeton University, Princeton, NJ. cattaneo@princeton.edu. - Max H. Farrell, University of California, Santa Barbara, CA. maxhfarrell@ucsb.edu. - Rocio Titiunik, Princeton University, Princeton, NJ. titiunik@princeton.edu. ``` -------------------------------- ### Bandwidth Selection Function for RD Estimators Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Implements bandwidth selectors for local polynomial Regression Discontinuity (RD) point estimators and inference procedures. Companion commands are rdrobust and rdplot. ```R rdbwselect(y, x, c = NULL, fuzzy = NULL, deriv = NULL, p = NULL, q = NULL, covs = NULL, covs_drop = TRUE, ginv.tol = 1e-20, kernel = "tri", weights = NULL, bwselect = "mserd", vce = "nn", cluster = NULL, nnmatch = 3, scaleregul = 1, sharpbw = FALSE, all = NULL, subset = NULL, masspoints = "adjust", bwcheck = NULL, bwrestrict = TRUE, stdvars = FALSE) ``` -------------------------------- ### Usage of Deprecated rdbwselect_2014 Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Syntax for the deprecated bandwidth selection command provided for backward compatibility. ```R rdbwselect_2014(y, x, subset = NULL, c = 0, p = 1, q = 2, deriv = 0, rho = NULL, kernel = "tri", bwselect = "CCT", scaleregul = 1, delta = 0.5, cvgrid_min = NULL, cvgrid_max = NULL, cvgrid_length = NULL, cvplot = FALSE, vce = "nn", matches = 3, all = FALSE, precalc = TRUE ) ``` -------------------------------- ### RDrobust Estimation Arguments Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html This section details the arguments used in the RDrobust package for estimating regression discontinuity designs. ```APIDOC ## RDrobust Estimation Arguments ### Description This section details the arguments used in the RDrobust package for estimating regression discontinuity designs. ### Arguments - **y** (variable) - The dependent variable. - **x** (variable) - The running variable (a.k.a. score or forcing variable). - **c** (numeric) - Specifies the RD cutoff in `x`; default is `c = 0`. - **fuzzy** (variable) - Specifies the treatment status variable used to implement fuzzy RD estimation. Default is Sharp RD design. - **deriv** (numeric) - Specifies the order of the derivative of the regression functions to be estimated. Default is `deriv=0`. - **p** (numeric) - Specifies the order of the local-polynomial used to construct the point-estimator; default is `p = 1`. - **q** (numeric) - Specifies the order of the local-polynomial used to construct the bias-correction; default is `q = 2`. - **h** (numeric or numeric vector) - Specifies the main bandwidth used to construct the RD point estimator. If not specified, bandwidth `h` is computed by `rdbwselect`. If two bandwidths are specified, the first is for data below the cutoff and the second for data above. - **b** (numeric or numeric vector) - Specifies the bias bandwidth used to construct the bias-correction estimator. If not specified, bandwidth `b` is computed by `rdbwselect`. If two bandwidths are specified, the first is for data below the cutoff and the second for data above. - **rho** (numeric) - Specifies the value of `rho`, so that the bias bandwidth `b` equals `h/rho`. Default is `rho = 1` if `h` is specified but `b` is not. - **covs** (variable) - Additional covariates to be used for efficiency improvements. - **covs_drop** (logical) - If TRUE, checks for collinear additional covariates and drops them. Default is TRUE. - **ginv.tol** (numeric) - Tolerance used to invert matrices involving covariates when `covs_drop=TRUE`. - **kernel** (string) - The kernel function used to construct the local-polynomial estimator(s). Options are `triangular` (default), `epanechnikov`, and `uniform`. - **weights** (variable) - The variable used for optional weighting of the estimation procedure. Unit-specific weights multiply the kernel function. - **bwselect** (string) - Specifies the bandwidth selection procedure. Options include `mserd`, `msetwo`, `msesum`, `msecomb1`, `msecomb2`, `cerrd`, `certwo`, `cersum`, `cercomb1`, `cercomb2`. Default is `bwselect=mserd`. - **vce** (string) - Specifies the procedure used to compute the variance-covariance matrix estimator. Options are `nn`, `hc0`, `hc1`, `hc2`, `hc3`. Default is `vce=nn`. - **cluster** (variable) - Indicates the cluster ID variable used for cluster-robust variance estimation. - **nnmatch** (numeric) - Minimum number of neighbors to be used with `vce=nn`. Default is `nnmatch=3`. ``` -------------------------------- ### rdrobust: Robust Data-Driven Statistical Inference in RD Designs Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html The rdrobust function constructs local-polynomial point estimators and robust confidence intervals for average treatment effects at the cutoff in Sharp, Fuzzy, and Kink RD settings. ```APIDOC ## rdrobust ### Description Constructs local-polynomial point estimators and robust confidence intervals for average treatment effects at the cutoff in Sharp, Fuzzy and Kink RD settings. ### Usage ```R rdrobust(y, x, c = NULL, fuzzy = NULL, deriv = NULL, p = NULL, q = NULL, covs = NULL, covs_drop = TRUE, ginv.tol = 1e-20, kernel = "tri", weights = NULL, bwselect = "mserd", vce = "nn", cluster = NULL, nnmatch = 3, scaleregul = 1, sharpbw = FALSE, all = NULL, subset = NULL, masspoints = "adjust", bwcheck = NULL, bwrestrict = TRUE, stdvars = FALSE) ``` ### Parameters * **y** (numeric vector) - The dependent variable. * **x** (numeric vector) - The running variable. * **c** (numeric scalar, optional) - The cutoff value for the running variable. Defaults to the median of x. * **fuzzy** (numeric vector, optional) - The instrument for the treatment indicator in fuzzy RD settings. * **deriv** (numeric scalar, optional) - The order of the derivative of the regression function to estimate. Defaults to 0. * **p** (numeric scalar, optional) - The order of the local polynomial. Defaults to 1. * **q** (numeric scalar, optional) - The order of the local polynomial for the second-stage estimation. Defaults to p. * **covs** (numeric matrix or data frame, optional) - Additional covariates to be included in the estimation. * **covs_drop** (logical, optional) - Whether to drop covariates that are collinear with the running variable. Defaults to TRUE. * **ginv.tol** (numeric scalar, optional) - Tolerance for generalized inverse. Defaults to 1e-20. * **kernel** (character string, optional) - The kernel function to use. Options: "tri", "epa", "uni", "triweight", "tricube", "gaussian", "cos", "logistic", "normal", "denisity". Defaults to "tri". * **weights** (numeric vector, optional) - Pre-specified weights for the observations. * **bwselect** (character string, optional) - Bandwidth selection method. Options: "mserd", "mse-comb", "msetest", "imsetest", "manual". Defaults to "mserd". * **vce** (character string, optional) - Variance-covariance estimation method. Options: "nn", "hc0", "hc1", "hc2", "hc3", "hc4". Defaults to "nn". * **cluster** (character string or vector, optional) - Variable(s) to be used for clustering standard errors. * **nnmatch** (numeric scalar, optional) - Number of nearest neighbors to use for nearest neighbor matching. Defaults to 3. * **scaleregul** (numeric scalar, optional) - Scalar for regularization. Defaults to 1. * **sharpbw** (logical, optional) - Whether to use sharp bandwidth selection. Defaults to FALSE. * **all** (logical, optional) - Whether to report all results. Defaults to NULL. * **subset** (logical vector, optional) - Subset of data to be used for estimation. * **masspoints** (character string, optional) - Method for handling mass points. Options: "adjust", "drop", "none". Defaults to "adjust". * **bwcheck** (logical, optional) - Whether to check bandwidth validity. Defaults to NULL. * **bwrestrict** (logical, optional) - Whether to restrict bandwidth to be within a certain range. Defaults to TRUE. * **stdvars** (logical, optional) - Whether to standardize variables. Defaults to FALSE. ### Request Example ```R # Example usage (replace with actual data) # rdrobust(y = my_y_data, x = my_x_data) ``` ### Response #### Success Response (200) Returns a list containing estimation results, confidence intervals, and other relevant statistics. ``` -------------------------------- ### rdrobust Estimation Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Implements local polynomial Regression Discontinuity (RD) point estimators with robust bias-corrected confidence intervals. ```APIDOC ## rdrobust ### Description Implements local polynomial Regression Discontinuity (RD) point estimators with robust bias-corrected confidence intervals and inference procedures. ### Usage rdrobust(y, x, c = NULL, fuzzy = NULL, deriv = NULL, p = NULL, q = NULL, h = NULL, b = NULL, rho = NULL, covs = NULL, covs_drop = TRUE, ginv.tol = 1e-20, kernel = "tri", weights = NULL, bwselect = "mserd", vce = "nn", cluster = NULL, nnmatch = 3, level = 95, scalepar = 1, scaleregul = 1, sharpbw = FALSE, detail = NULL, all = NULL, subset = NULL, masspoints = "adjust", bwcheck = NULL, bwrestrict = TRUE, stdvars = FALSE) ``` -------------------------------- ### Perform Regression Discontinuity Analysis with rdrobust Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Generates synthetic data and performs a robust regression discontinuity estimation. ```R x <- runif(1000,-1,1) y <- 5 + 3*x + 2*(x>=0) + rnorm(1000) rdrobust(y,x) ``` -------------------------------- ### Load RD Senate Dataset Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Loads the RD Senate dataset for use in regression discontinuity analysis. ```R data(rdrobust_RDsenate) ``` -------------------------------- ### rdplot Data-Driven RD Plots Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Generates data-driven Regression Discontinuity plots for visualization of the RD design. ```APIDOC ## rdplot ### Description Generates data-driven RD plots using optimal binning strategies. ### Response - **binselect** (string) - Method used to compute the optimal number of bins. - **N** (numeric) - Sample sizes used to the left and right of the cutoff. - **rdplot** (object) - A standard ggplot object that can be used for further customization. ### Request Example x <- runif(1000,-1,1) y <- 5 + 3*x + 2*(x>=0) + rnorm(1000) rdplot(y,x) ``` -------------------------------- ### Local Polynomial RD Estimation Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Implements local polynomial RD point estimators with robust bias-corrected confidence intervals. Various parameters control bandwidth selection, kernel type, and variance estimation. ```R rdrobust(y, x, c = NULL, fuzzy = NULL, deriv = NULL, p = NULL, q = NULL, h = NULL, b = NULL, rho = NULL, covs = NULL, covs_drop = TRUE, ginv.tol = 1e-20, kernel = "tri", weights = NULL, bwselect = "mserd", vce = "nn", cluster = NULL, nnmatch = 3, level = 95, scalepar = 1, scaleregul = 1, sharpbw = FALSE, detail = NULL, all = NULL, subset = NULL, masspoints = "adjust", bwcheck = NULL, bwrestrict = TRUE, stdvars = FALSE) ``` -------------------------------- ### rdplot: Exploratory Data Analysis for RD Designs Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html The rdplot function conducts exploratory data analysis, specifically generating RD plots. ```APIDOC ## rdplot ### Description Conducts exploratory data analysis (RD plots) for regression-discontinuity designs. ### Usage ```R rdplot(y, x, c = NULL, ..., kernel = "tri", bwselect = "mserd", p = 1, q = NULL, nbins = NULL, binselect = "es", yjitt = 0.1, xjitt = 0.1, plot = TRUE, print = FALSE) ``` ### Parameters * **y** (numeric vector) - The dependent variable. * **x** (numeric vector) - The running variable. * **c** (numeric scalar, optional) - The cutoff value for the running variable. Defaults to the median of x. * **...** - Additional arguments passed to `rdrobust` or `rdbwselect`. * **kernel** (character string, optional) - The kernel function to use. Defaults to "tri". * **bwselect** (character string, optional) - Bandwidth selection method. Defaults to "mserd". * **p** (numeric scalar, optional) - The order of the local polynomial. Defaults to 1. * **q** (numeric scalar, optional) - The order of the local polynomial for the second-stage estimation. Defaults to p. * **nbins** (numeric scalar, optional) - Number of bins for the plot. Defaults to NULL. * **binselect** (character string, optional) - Bin selection method. Options: "es", "qs", "equal". Defaults to "es". * **yjitt** (numeric scalar, optional) - Amount of jitter to add to the y-axis. Defaults to 0.1. * **xjitt** (numeric scalar, optional) - Amount of jitter to add to the x-axis. Defaults to 0.1. * **plot** (logical, optional) - Whether to generate the plot. Defaults to TRUE. * **print** (logical, optional) - Whether to print the estimation results. Defaults to FALSE. ### Request Example ```R # Example usage (replace with actual data) # rdplot(y = my_y_data, x = my_x_data) ``` ### Response #### Success Response (200) Generates an RD plot and optionally returns estimation results. ``` -------------------------------- ### rdplot Function Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Implements data-driven Regression Discontinuity (RD) plots. ```APIDOC ## rdplot ### Description Implements several data-driven Regression Discontinuity (RD) plots, using either evenly-spaced or quantile-spaced partitioning. It constructs plots with binned sample means tracing out the underlying regression function or mimicking the underlying variability of the data. ### Parameters - **y** (numeric) - Required - Outcome variable. - **x** (numeric) - Required - Running variable. - **c** (numeric) - Optional - RD cutoff (default 0). - **p** (numeric) - Optional - Order of the local polynomial used to construct the plots (default 4). - **nbins** (numeric) - Optional - Number of bins. - **binselect** (string) - Optional - Method for bin selection (default "esmv"). - **scale** (numeric) - Optional - Scaling factor for bin selection. - **kernel** (string) - Optional - Kernel function (default "uni"). - **weights** (numeric) - Optional - Weights. - **h** (numeric) - Optional - Bandwidth. - **covs** (matrix) - Optional - Covariates. - **covs_eval** (string) - Optional - Covariate evaluation method (default "mean"). - **covs_drop** (boolean) - Optional - Whether to drop collinear covariates (default TRUE). - **ginv.tol** (numeric) - Optional - Tolerance for generalized inverse (default 1e-20). - **support** (numeric) - Optional - Support of the running variable. - **subset** (logical) - Optional - Subset of data. - **masspoints** (string) - Optional - Handling of mass points (default "adjust"). - **hide** (boolean) - Optional - Whether to hide the plot (default FALSE). - **ci** (numeric) - Optional - Confidence interval level. - **shade** (boolean) - Optional - Whether to shade confidence intervals (default FALSE). - **title** (string) - Optional - Plot title. - **x.label** (string) - Optional - X-axis label. - **y.label** (string) - Optional - Y-axis label. - **x.lim** (numeric) - Optional - X-axis limits. - **y.lim** (numeric) - Optional - Y-axis limits. - **col.dots** (string) - Optional - Color for dots. - **col.lines** (string) - Optional - Color for lines. ``` -------------------------------- ### Generate RD Plot Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html Generates a standard ggplot object for Regression Discontinuity plots. Requires y and x variables. ```R x <- runif(1000,-1,1) y <- 5 + 3*x + 2*(x>=0) + rnorm(1000) rdplot(y,x) ``` -------------------------------- ### rdplot Function Signature Source: https://cran.r-project.org/web/packages/rdrobust/refman/rdrobust.html This is the function signature for rdplot, detailing its arguments for creating RD plots. Use this to understand the available customization options for plotting. ```R rdplot(y, x, c = 0, p = 4, nbins = NULL, binselect = "esmv", scale = NULL, kernel = "uni", weights = NULL, h = NULL, covs = NULL, covs_eval = "mean", covs_drop = TRUE, ginv.tol = 1e-20, support = NULL, subset = NULL, masspoints = "adjust", hide = FALSE, ci = NULL, shade = FALSE, title = NULL, x.label = NULL, y.label = NULL, x.lim = NULL, y.lim = NULL, col.dots = NULL, col.lines = NULL) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.