Nothing
### R code from vignette source 'nndd.Rnw'
###################################################
### code chunk number 1: preliminaries
###################################################
options(width = 70, prompt = "R> ", continue = "+ ")
library("Formula")
library("lmtest")
library("multiwayvcov")
library("memisc")
library("nndd")
###################################################
### code chunk number 2: IRCA
###################################################
library("nndd")
data("IRCA", package = "nndd")
IRCA$StateFIPS <- factor(IRCA$StateFIPS)
formula <- Formula(treated | v_crime ~ unemprate + povrate + pop
+ crack_index + officers_pc + income + abortions + StateFIPS
| unemprate + povrate + pop + crack_index +officers_pc )
nndd1 <- nndd(formula = formula, data = IRCA,
index = c("county", "year"),
t_time = "1986",
displ_coefs = c("unemprate", "povrate", "pop" , "crack_index",
"officers_pc", "income" , "abortions", "post",
"treated", "post:treated") )
print(nndd1)
summary(nndd1)
###################################################
### code chunk number 3: cluster
###################################################
nndd1c <- nndd(formula = formula, data = IRCA,
index = c("county", "year"),
t_time = "1986" ,
clustervariables = "StateFIPS",
displ_coefs = c("unemprate", "povrate", "pop" , "crack_index",
"officers_pc", "income" , "abortions",
"post", "treated", "post:treated"))
###################################################
### code chunk number 4: simple dd
###################################################
lm1 <- lm(update(formula(formula, lhs = 2, rhs = 1),
paste(paste(".",
paste(formula(formula, lhs = 0, rhs = (2)),
collapse = " . + ")),
"+post*treated")),
data = IRCA)
lm1$displ_coefs <- c("unemprate", "povrate", "pop" , "crack_index",
"officers_pc", "income" , "abortions",
"post", "treated", "post:treated")
class(lm1) <- c("lmc", "lm")
lm1c <- lm1
lm1c$clustervariables <- "StateFIPS"
class(lm1c) <- c("lmc", "lm")
###################################################
### code chunk number 5: compare (eval = FALSE)
###################################################
## mtable(lm1,nndd1, lm1c, nndd1c)
###################################################
### code chunk number 6: mtable-latex
###################################################
gsub("_", "\\\\_", toLatex(mtable(lm1,nndd1, lm1c, nndd1c)))
###################################################
### code chunk number 7: comapre (eval = FALSE)
###################################################
## #dev.new()
## par(mfrow = c(1,2))
## plot(nndd1c,data = IRCA ,which = c(1,2))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.