Skip to content

Commit

Permalink
Keeping track of extra_args for gsynth
Browse files Browse the repository at this point in the history
  • Loading branch information
ebenmichael committed Jul 17, 2020
1 parent f6cbf47 commit 04daba1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions R/augsynth.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ fit_augsynth_internal <- function(wide, synth_data, Z, progfunc,
augsynth$extra_args <- list(...)
if(progfunc == "ridge") {
augsynth$extra_args$lambda <- augsynth$lambda
} else if(progfunc == "gsyn") {
augsynth$extra_args$r <- ncol(augsynth$params$factor)
augsynth$extra_args$CV <- 0
}
##format output
class(augsynth) <- "augsynth"
Expand Down
7 changes: 4 additions & 3 deletions R/outcome_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ fit_prog_reg <- function(X, y, trt, alpha=1, lambda=NULL,
y0hat <- cbind(rep(1, dim(X)[1]),
X) %*% regweights

return(list(y0hat=y0hat,
params=regweights))
return(list(y0hat = y0hat,
params = regweights))
}


Expand Down Expand Up @@ -197,7 +197,8 @@ fit_prog_gsynth <- function(X, y, trt, r=0, r.end=5, force=3, CV=1, ...) {

transform(long_df, time = as.numeric(time))
transform(long_df, unit = as.numeric(unit))
gsyn <- gsynth::gsynth(data = long_df, Y = "obs", D = "trt", index = c("unit", "time"), force = force, CV = CV)
gsyn <- gsynth::gsynth(data = long_df, Y = "obs", D = "trt",
index = c("unit", "time"), force = force, CV = CV, r = r)

t0 <- dim(X)[2]
t_final <- t0 + dim(y)[2]
Expand Down

0 comments on commit 04daba1

Please sign in to comment.