Predict the Regression Discontinuity
predict.rd.Rd
predict.rd
makes predictions of means and standard deviations of RDs at different cutoffs.
Usage
# S3 method for rd
predict(object, gran = 50, ...)
Arguments
- object
An
rd
object, typically the result ofrd_est
.- gran
A non-negative integer specifying the granularity of the data points (i.e. the desired number of predicted points). The default is 50.
- ...
Additional arguments passed to
predict
.
Examples
set.seed(12345)
x <- runif(1000, -1, 1)
cov <- rnorm(1000)
y <- 3 + 2 * x + 3 * cov + 10 * (x >= 0) + rnorm(1000)
tr <- as.integer(x >= 0)
rd <- rd_est(y ~ x + tr | cov, cutpoint = 0, t.design = "geq")
predict(rd)
#> X cf X3 X2 X1 Tr cov_gm
#> 25 -0.99772683 0 -9.931960e-01 0.9954588212 -0.99772683 0 -0.01679203
#> 24 -0.95707948 0 -8.766859e-01 0.9160011345 -0.95707948 0 -0.01679203
#> 23 -0.91643214 0 -7.696636e-01 0.8398478612 -0.91643214 0 -0.01679203
#> 22 -0.87578479 0 -6.717261e-01 0.7669990012 -0.87578479 0 -0.01679203
#> 21 -0.83513745 0 -5.824704e-01 0.6974545546 -0.83513745 0 -0.01679203
#> 20 -0.79449010 0 -5.014937e-01 0.6312145213 -0.79449010 0 -0.01679203
#> 19 -0.75384276 0 -4.283929e-01 0.5682789013 -0.75384276 0 -0.01679203
#> 18 -0.71319541 0 -3.627652e-01 0.5086476946 -0.71319541 0 -0.01679203
#> 17 -0.67254807 0 -3.042075e-01 0.4523209012 -0.67254807 0 -0.01679203
#> 16 -0.63190072 0 -2.523170e-01 0.3992985212 -0.63190072 0 -0.01679203
#> 15 -0.59125338 0 -2.066907e-01 0.3495805545 -0.59125338 0 -0.01679203
#> 14 -0.55060603 0 -1.669256e-01 0.3031670012 -0.55060603 0 -0.01679203
#> 13 -0.50995869 0 -1.326188e-01 0.2600578611 -0.50995869 0 -0.01679203
#> 12 -0.46931134 0 -1.033673e-01 0.2202531344 -0.46931134 0 -0.01679203
#> 11 -0.42866400 0 -7.876822e-02 0.1837528211 -0.42866400 0 -0.01679203
#> 10 -0.38801665 0 -5.841859e-02 0.1505569210 -0.38801665 0 -0.01679203
#> 9 -0.34736931 0 -4.191547e-02 0.1206654343 -0.34736931 0 -0.01679203
#> 8 -0.30672196 0 -2.885590e-02 0.0940783609 -0.30672196 0 -0.01679203
#> 7 -0.26607462 0 -1.883694e-02 0.0707957008 -0.26607462 0 -0.01679203
#> 6 -0.22542727 0 -1.145564e-02 0.0508174541 -0.22542727 0 -0.01679203
#> 5 -0.18477992 0 -6.309056e-03 0.0341436207 -0.18477992 0 -0.01679203
#> 4 -0.14413258 0 -2.994239e-03 0.0207742006 -0.14413258 0 -0.01679203
#> 3 -0.10348523 0 -1.108243e-03 0.0107091938 -0.10348523 0 -0.01679203
#> 2 -0.06283789 0 -2.481217e-04 0.0039486004 -0.06283789 0 -0.01679203
#> 1 -0.02219054 0 -1.092707e-05 0.0004924203 -0.02219054 0 -0.01679203
#> 26 0.00000000 0 0.000000e+00 0.0000000000 0.00000000 1 -0.01679203
#> 27 0.00000000 1 0.000000e+00 0.0000000000 0.00000000 0 -0.01679203
#> 28 0.01845680 0 6.287374e-06 0.0003406535 0.01845680 1 -0.01679203
#> 29 0.05910415 0 2.064685e-04 0.0034933000 0.05910415 1 -0.01679203
#> 30 0.09975149 0 9.925632e-04 0.0099503599 0.09975149 1 -0.01679203
#> 31 0.14039884 0 2.767518e-03 0.0197118331 0.14039884 1 -0.01679203
#> 32 0.18104618 0 5.934281e-03 0.0327777197 0.18104618 1 -0.01679203
#> 33 0.22169353 0 1.089580e-02 0.0491480195 0.22169353 1 -0.01679203
#> 34 0.26234087 0 1.805502e-02 0.0688227327 0.26234087 1 -0.01679203
#> 35 0.30298822 0 2.781488e-02 0.0918018592 0.30298822 1 -0.01679203
#> 36 0.34363556 0 4.057834e-02 0.1180853991 0.34363556 1 -0.01679203
#> 37 0.38428291 0 5.674835e-02 0.1476733522 0.38428291 1 -0.01679203
#> 38 0.42493025 0 7.672784e-02 0.1805657187 0.42493025 1 -0.01679203
#> 39 0.46557760 0 1.009198e-01 0.2167624986 0.46557760 1 -0.01679203
#> 40 0.50622494 0 1.297271e-01 0.2562636917 0.50622494 1 -0.01679203
#> 41 0.54687229 0 1.635527e-01 0.2990692982 0.54687229 1 -0.01679203
#> 42 0.58751963 0 2.027996e-01 0.3451793180 0.58751963 1 -0.01679203
#> 43 0.62816698 0 2.478708e-01 0.3945937511 0.62816698 1 -0.01679203
#> 44 0.66881432 0 2.991691e-01 0.4473125976 0.66881432 1 -0.01679203
#> 45 0.70946167 0 3.570975e-01 0.5033358574 0.70946167 1 -0.01679203
#> 46 0.75010901 0 4.220590e-01 0.5626635305 0.75010901 1 -0.01679203
#> 47 0.79075636 0 4.944565e-01 0.6252956169 0.79075636 1 -0.01679203
#> 48 0.83140370 0 5.746929e-01 0.6912321167 0.83140370 1 -0.01679203
#> 49 0.87205105 0 6.631713e-01 0.7604730298 0.87205105 1 -0.01679203
#> 50 0.91269839 0 7.602945e-01 0.8330183562 0.91269839 1 -0.01679203
#> 51 0.95334574 0 8.664655e-01 0.9088680960 0.95334574 1 -0.01679203
#> 52 0.99399308 0 9.820873e-01 0.9880222491 0.99399308 1 -0.01679203
#> YSE.cubic YSE.quadratic YSE.linear Yhat.cubic Yhat.quadratic Yhat.linear
#> 25 0.17416908 0.13398618 0.09167682 1.015801 1.112584 1.073478
#> 24 0.12850196 0.11381610 0.08612158 1.121579 1.173441 1.143670
#> 23 0.09844111 0.09661877 0.08070078 1.218704 1.235103 1.213862
#> 22 0.08353826 0.08269693 0.07544342 1.308024 1.297570 1.284054
#> 21 0.07986165 0.07233497 0.07038611 1.390385 1.360841 1.354246
#> 20 0.08122769 0.06563201 0.06557517 1.466632 1.424916 1.424439
#> 19 0.08302387 0.06229215 0.06106885 1.537612 1.489796 1.494631
#> 18 0.08316722 0.06156874 0.05693951 1.604170 1.555481 1.564823
#> 17 0.08122090 0.06247466 0.05327490 1.667153 1.621970 1.635015
#> 16 0.07763346 0.06407787 0.05017694 1.727407 1.689264 1.705207
#> 15 0.07334223 0.06566691 0.04775603 1.785777 1.757362 1.775399
#> 14 0.06952558 0.06677252 0.04611891 1.843110 1.826265 1.845591
#> 13 0.06730361 0.06713008 0.04535055 1.900252 1.895973 1.915783
#> 12 0.06732017 0.06664226 0.04549499 1.958050 1.966485 1.985975
#> 11 0.06941922 0.06536382 0.04654372 2.017348 2.037801 2.056167
#> 10 0.07272509 0.06351385 0.04843806 2.078993 2.109922 2.126359
#> 9 0.07605454 0.06151419 0.05108400 2.143831 2.182848 2.196551
#> 8 0.07833192 0.06003889 0.05437195 2.212709 2.256578 2.266743
#> 7 0.07890125 0.06002106 0.05819316 2.286472 2.331113 2.336935
#> 6 0.07789050 0.06251631 0.06244985 2.365966 2.406452 2.407127
#> 5 0.07685918 0.06838776 0.06705912 2.452037 2.482596 2.477319
#> 4 0.07965893 0.07802223 0.07195325 2.545532 2.559545 2.547511
#> 3 0.09203623 0.09134223 0.07707799 2.647297 2.637298 2.617703
#> 2 0.11840182 0.10803830 0.08239034 2.758177 2.715855 2.687895
#> 1 0.15984322 0.12777279 0.08785625 2.879018 2.795217 2.758087
#> 26 0.16233459 0.12626679 0.08540881 12.778858 12.907275 12.845227
#> 27 0.18868765 0.13972582 0.09089516 2.949496 2.838883 2.796407
#> 28 0.14150689 0.11727601 0.08300772 12.839859 12.939539 12.884273
#> 29 0.10587849 0.09940024 0.07780958 12.965565 13.011506 12.970265
#> 30 0.08444523 0.08438713 0.07275651 13.080328 13.084727 13.056257
#> 31 0.07542125 0.07252922 0.06788092 13.185297 13.159203 13.142248
#> 32 0.07401614 0.06406224 0.06322387 13.281619 13.234934 13.228240
#> 33 0.07509602 0.05897849 0.05883728 13.370442 13.311920 13.314232
#> 34 0.07561047 0.05685034 0.05478617 13.452912 13.390160 13.400223
#> 35 0.07446553 0.05686506 0.05115029 13.530176 13.469654 13.486215
#> 36 0.07172715 0.05808460 0.04802406 13.603383 13.550404 13.572206
#> 37 0.06810465 0.05969945 0.04551261 13.673680 13.632408 13.658198
#> 38 0.06465725 0.06113036 0.04372202 13.742213 13.715667 13.744190
#> 39 0.06251030 0.06201900 0.04274298 13.810130 13.800180 13.830181
#> 40 0.06245239 0.06218799 0.04263143 13.878579 13.885948 13.916173
#> 41 0.06454849 0.06161228 0.04339408 13.948706 13.972971 14.002165
#> 42 0.06810414 0.06041432 0.04498647 14.021660 14.061248 14.088156
#> 43 0.07201484 0.05888397 0.04732492 14.098587 14.150780 14.174148
#> 44 0.07517400 0.05751574 0.05030551 14.180634 14.241567 14.260140
#> 45 0.07675601 0.05703479 0.05382165 14.268949 14.333609 14.346131
#> 46 0.07646864 0.05834444 0.05777565 14.364680 14.426905 14.432123
#> 47 0.07498109 0.06232641 0.06208390 14.468973 14.521455 14.518114
#> 48 0.07469396 0.06956191 0.06667778 14.582976 14.617261 14.604106
#> 49 0.08035382 0.08020255 0.07150224 14.707836 14.714321 14.690098
#> 50 0.09746014 0.09408538 0.07651369 14.844700 14.812636 14.776089
#> 51 0.12884482 0.11093046 0.08167772 14.994716 14.912205 14.862081
#> 52 0.17457891 0.13046847 0.08696714 15.159032 15.013029 14.948073
#> Yhat.optimal YSE.optimal Yhat.half YSE.half Yhat.double YSE.double
#> 25 NA NA NA NA 1.079883 0.06752836
#> 24 NA NA NA NA 1.148718 0.06325819
#> 23 NA NA NA NA 1.218903 0.05924453
#> 22 NA NA NA NA 1.289057 0.05561235
#> 21 NA NA NA NA 1.358828 0.05219664
#> 20 1.433212 0.05351443 NA NA 1.428069 0.04912911
#> 19 1.502391 0.05018178 NA NA 1.498024 0.04606496
#> 18 1.570578 0.04756590 NA NA 1.567430 0.04350838
#> 17 1.637510 0.04540605 NA NA 1.636231 0.04122609
#> 16 1.705687 0.04352574 NA NA 1.705562 0.03972614
#> 15 1.774605 0.04185812 NA NA 1.775195 0.03863884
#> 14 1.844355 0.04075105 NA NA 1.845160 0.03801955
#> 13 1.913633 0.04016291 NA NA 1.914923 0.03792424
#> 12 1.983118 0.03986409 NA NA 1.984763 0.03838954
#> 11 2.051582 0.03982443 NA NA 2.054181 0.03946229
#> 10 2.119627 0.04039372 2.108404 0.04862173 2.123420 0.04112820
#> 9 2.188668 0.04133364 2.174698 0.04794918 2.193080 0.04336685
#> 8 2.258892 0.04289745 2.244873 0.04835162 2.263251 0.04616949
#> 7 2.331200 0.04494031 2.322093 0.04931989 2.334335 0.04948909
#> 6 2.403885 0.04734331 2.399653 0.05173447 2.405549 0.05328389
#> 5 2.475562 0.05068397 2.474337 0.05550261 2.476216 0.05755586
#> 4 2.546171 0.05534967 2.547828 0.06010072 2.546253 0.06226192
#> 3 2.619887 0.06166732 2.633510 0.06810471 2.617487 0.06744207
#> 2 2.700694 0.06929119 2.740723 0.08194842 2.690569 0.07316427
#> 1 2.784650 0.07942976 2.863448 0.10107893 2.763901 0.07947455
#> 26 12.874758 0.07846905 12.820108 0.10104606 12.855436 0.07770452
#> 27 2.828083 0.08606018 2.924380 0.11587315 2.802977 0.08320053
#> 28 12.911195 0.07375349 12.863912 0.08996432 12.893707 0.07492860
#> 29 12.997552 0.06515337 12.971149 0.07425638 12.979631 0.06931166
#> 30 13.083186 0.05868914 13.073155 0.06461790 13.065530 0.06420810
#> 31 13.167395 0.05331197 13.171508 0.05764257 13.151580 0.05951202
#> 32 13.247994 0.04945917 13.258300 0.05231195 13.236106 0.05518741
#> 33 13.327042 0.04653024 13.336121 0.04917102 13.319554 0.05124713
#> 34 13.409052 0.04399498 13.418018 0.04730486 13.404088 0.04771811
#> 35 13.492550 0.04215822 13.500467 0.04640453 13.489132 0.04463287
#> 36 13.575605 0.04064254 13.579614 0.04602288 13.573898 0.04201536
#> 37 13.659063 0.03975913 13.658999 0.04602422 13.658790 0.03991440
#> 38 13.741770 0.03900395 NA NA 13.743332 0.03838355
#> 39 13.824751 0.03908117 NA NA 13.827986 0.03745209
#> 40 13.908491 0.03964597 NA NA 13.912962 0.03712527
#> 41 13.992177 0.04055230 NA NA 13.997924 0.03738596
#> 42 14.076941 0.04163177 NA NA 14.083345 0.03819651
#> 43 14.162403 0.04347484 NA NA 14.169068 0.03949880
#> 44 14.248791 0.04554372 NA NA 14.255182 0.04120871
#> 45 14.337097 0.04804828 NA NA 14.342108 0.04383194
#> 46 14.427110 0.05108708 NA NA 14.429727 0.04660551
#> 47 14.518724 0.05454876 NA NA 14.517934 0.04970498
#> 48 NA NA NA NA 14.605350 0.05310234
#> 49 NA NA NA NA 14.692974 0.05669884
#> 50 NA NA NA NA 14.782527 0.06068324
#> 51 NA NA NA NA 14.870923 0.06471625
#> 52 NA NA NA NA 14.958527 0.06941019