Skip to content

Commit

Permalink
rename internal RDDdat to rdd_dat
Browse files Browse the repository at this point in the history
  • Loading branch information
bquast committed May 7, 2015
1 parent 5c512ec commit ac00df9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
20 changes: 10 additions & 10 deletions R/rdd_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,24 @@ rdd_data <- function(y, x, covar, cutpoint, z, labels, data){
# if(hasCova && is.null(labels$covar)) labels$covar <- if(NCOL(covar)==1) names(deparse(substitute(y))

## Assemble data
RDDdat <- data.frame(x=x, y=y)
rdd_dat <- data.frame(x=x, y=y)
if(hasCovar) {
RDDdat <- cbind(RDDdat,covar)
if(NCOL(covar)==1 && is.null(colnames(covar))) colnames(RDDdat)[3] <- covar_nam
rdd_dat <- cbind(rdd_dat,covar)
if(NCOL(covar)==1 && is.null(colnames(covar))) colnames(rdd_dat)[3] <- covar_nam
}

if(type=="Fuzzy"){
RDDdat <- cbind(RDDdat,z)
rdd_dat <- cbind(rdd_dat,z)
}

## return
class(RDDdat) <- c("rdd_data", "data.frame")
attr(RDDdat, "hasCovar") <- hasCovar
attr(RDDdat, "labels") <- labels
attr(RDDdat, "cutpoint") <- cutpoint
attr(RDDdat, "type") <- type
class(rdd_dat) <- c("rdd_data", "data.frame")
attr(rdd_dat, "hasCovar") <- hasCovar
attr(rdd_dat, "labels") <- labels
attr(rdd_dat, "cutpoint") <- cutpoint
attr(rdd_dat, "type") <- type

RDDdat
rdd_dat
}


Expand Down
18 changes: 9 additions & 9 deletions misc/test_RDest_t0_RDDreg.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

if(FALSE){
RDDdat_choice <- RDDdata(y=choice_pg, x=xx, cutpoint=30)
RDDdat_risk <- RDDdata(y=risky_option, x=xx, cutpoint=30)
rdd_dat_choice <- rdd_data(y=choice_pg, x=xx, cutpoint=30)
rdd_dat_risk <- rdd_data(y=risky_option, x=xx, cutpoint=30)

RDbw_choice <- RDDbw_IK(RDDdat_choice)
RDbw_risk <- RDDbw_IK(RDDdat_risk)
RDbw_choice <- RDDbw_IK(rdd_dat_choice)
RDbw_risk <- RDDbw_IK(rdd_dat_risk)

rd_choice <- RDDreg_np(RDDdat_choice)
rd_choice_sam <- RDDreg_np(RDDdat_choice, slope="same")
rd_choice_lm <- RDDreg_lm(RDDdat_choice)
rd_choice <- RDDreg_np(rdd_dat_choice)
rd_choice_sam <- RDDreg_np(rdd_dat_choice, slope="same")
rd_choice_lm <- RDDreg_lm(rdd_dat_choice)

rd_risk <- RDDreg_np(RDDdat_risk)
rd_risk_sam <- RDDreg_np(RDDdat_risk, slope="same")
rd_risk <- RDDreg_np(rdd_dat_risk)
rd_risk_sam <- RDDreg_np(rdd_dat_risk, slope="same")


rd_choice
Expand Down

0 comments on commit ac00df9

Please sign in to comment.