Skip to content

Latest commit

 

History

History
 
 

proj

Web-based software to estimate power and causal effects of various regression discontinuity designs

R packages

Data sets

CRAN packages

'qpdf' is needed for checks on size reduction of PDFs

R Markdown

RDD packages

Estimation

package rdd rdrobust rddtools rddapp :octocat:
dependency sandwich, lmtest, AER, Formula no sandwich, lmtest, AER, Formula, np sandwich, lmtest, AER, Formula
model design sharp, fuzzy sharp, fuzzy sharp, fuzzy sharp, fuzzy
coefficient estimator local linear regression local polynomial regression local polynomial regression local linear regression
sharp estimation call lm from stats matrix computation call lm from stats call lm from stats
fuzzy estimation call ivreg from AER matrix computation call ivreg from AER call ivreg from AER
covariate include include include, residual include
bias correction no local polynomial regression no no
kernel function tri, unif, epan, normal, etc tri, unif, epan tri, unif, normal tri, unif, epan, etc
bandwidth selection IK09 CCT, IK12, CV, etc IK12, RSW IK09, IK12, RSW
covariance estimator call vcovHC from sandwich matrix computation call vcov from stats call vcovHC from stats
cluster correlation call sandwich from sandwich matrix computation call sandwich from sandwich call sandwich from sandwich
confidence interval yes yes yes yes
test call DCdensity from rdd no call DCdensity from rdd, call ks.test, t.test from stats call DCdensity from rdd

Shiny apps

Shiny servers

install_github

Sys.getenv("GITHUB_PATH")
Sys.setenv(GITHUB_PATH = "171931d137897fbef9350d7ea0b958cf093c5d4e")
Sys.getenv("GITHUB_PATH")

devtools::install_github("zejin/RDD", subdir = 'rdd/rddapp', auth_token = Sys.getenv("GITHUB_PATH"))

Comments

File names

# Good
fit_models.R
utility_functions.md

# Bad
foo.r
stuff.MD

Object names

# Good
day_one
day_1

# Bad
first_day_of_the_month
DayOne
dayone
djm1

# Bad
T <- FALSE
c <- 10
mean <- function(x) sum(x)

Spacing

# Good
average <- mean(feet / 12 + inches, na.rm = TRUE)

# Bad
average<-mean(feet/12+inches,na.rm=TRUE)

# Good
x <- 1:10
base::get

# Bad
x <- 1 : 10
base :: get

# Good
if (debug) do(x)
plot(x, y)

# Bad
if(debug)do(x)
plot (x, y)

# Good
list(
  total = a + b + c, 
  mean  = (a + b + c) / n
)

# Good
if (debug) do(x)
diamonds[5, ]

# Bad
if ( debug ) do(x)  # No spaces around debug
x[1,]   # Needs a space after the comma
x[1 ,]  # Space goes after comma not before

Curly braces

# Good
if (y < 0 && debug) {
  message("Y is negative")
}

if (y == 0) {
  log(x)
} else {
  y ^ x
}

# Bad
if (y < 0 && debug)
message("Y is negative")

if (y == 0) {
  log(x)
} 
else {
  y ^ x
}

# Good
if (y < 0 && debug) message("Y is negative")

Indentation

# Good
long_function_name <- function(a = "a long argument", 
                               b = "another argument",
                               c = "another long argument") {
  # As usual code is indented by two spaces.
}

Assignment

# Good
x <- 5
# Bad
x = 5