Skip to content

Commit

Permalink
new cran submission
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
xuyiqing committed Aug 6, 2021
1 parent b1bb198 commit e6cf33d
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 80 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package: gsynth
Type: Package
Title: Generalized Synthetic Control Method
Version: 1.1.9
Date: 2021-02-21
Version: 1.2.0
Date: 2021-08-05
Author: Yiqing Xu, Licheng Liu
Maintainer: Yiqing Xu <yiqingxu@ucsd.edu>
Maintainer: Yiqing Xu <yiqingxu@stanford.edu>
Description: Provides causal inference with interactive fixed-effect models. It imputes counterfactuals for each treated unit using control group information based on a linear interactive fixed effects model that incorporates unit-specific intercepts interacted with time-varying coefficients. This method generalizes the synthetic control method to the case of multiple treated units and variable treatment periods, and improves efficiency and interpretability. This version supports unbalanced panels and implements the matrix completion method. Main reference: Yiqing Xu (2017) <doi:10.1017/pan.2016.2>.
URL: http://yiqingxu.org/software/gsynth/gsynth_examples.html
URL: https://yiqingxu.org/packages/gsynth/gsynth_examples.html
NeedsCompilation: yes
License: GPL-2
Imports: Rcpp (>= 0.12.3), ggplot2 (>= 2.1.0), GGally (>= 1.0.1),
Imports: Rcpp (>= 0.12.3), ggplot2 (>= 2.1.0), GGally (>= 1.0.1), future (>= 1.21.0), doRNG (>= 1.8.2),
doParallel (>= 1.0.10), foreach (>= 1.4.3), abind (>= 1.4-0), mvtnorm (>= 1.0-6), MASS (>= 7.3.47), lfe (>= 1.0-0)
SystemRequirements: A C++11 compiler.
Depends: R (>= 2.10)
Expand Down
4 changes: 2 additions & 2 deletions R/default.R
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ gsynth.default <- function(formula = NULL,data, # a data frame (long-form)

# Do not attempt to use the parametric bootstrap if the number of treated units is fewer than 40
n_treated = length(unique(data[data[,D] == 1, index[1]]))
if (inference == "nonparametric" && n_treated < 40 && se) {
stop("Nonparametric bootstrap is inappropriate when there are fewer than 40 treated units")
if (inference == "nonparametric" && n_treated < 40 && se && estimator != "mc") {
warning("Nonparametric bootstrap may be inappropriate when there are too few 40 treated units; consider using parametric bootstrap or jackknife.")
}

## nboots
Expand Down
31 changes: 16 additions & 15 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
# main: whether to show the title;
# nfactors: whose loadings to be plotted
# id: individual plot
plot.gsynth <- function(x,
type = "gap",
xlim = NULL,
ylim = NULL,
xlab = NULL,
ylab = NULL,
legendOff = FALSE,
raw = "none",
main = NULL,
nfactors = NULL,
id = NULL,
axis.adjust = FALSE,
theme.bw = FALSE,
shade.post = NULL,
...){
plot.gsynth <- function(
x,
type = "gap",
xlim = NULL,
ylim = NULL,
xlab = NULL,
ylab = NULL,
legendOff = FALSE,
raw = "none",
main = NULL,
nfactors = NULL,
id = NULL,
axis.adjust = FALSE,
theme.bw = TRUE,
shade.post = FALSE,
...){


##-------------------------------##
Expand Down
6 changes: 6 additions & 0 deletions R/zzz.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.onAttach <-
function (libname, pkgname){
# echo output to screen
packageStartupMessage("## Syntax has been updated since v.1.2.0.\n")
packageStartupMessage("## Comments and suggestions -> yiqingxu@stanford.edu.\n")
}
6 changes: 4 additions & 2 deletions man/cumuEff.rd
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
}

\author{
Yiqing Xu and Licheng Liu
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University

Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{
Jushan Bai. 2009. "Panel Data Models with Interactive Fixed
Effects." Econometrica 77:1229--1279.

Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.
Iss. 1, January 2017, pp. 57-76.
}
\seealso{
\code{\link{gsynth}}
Expand Down
8 changes: 4 additions & 4 deletions man/gsynth-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
See \code{\link{gsynth}} for details.
}
\author{
Yiqing Xu <yiqingxu@ucsd.edu>, University of California, San Diego
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University

Licheng Liu <liulch.16@sem.tsinghua.edu.cn>, Tsinghua University
Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{
Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25, Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.
with Interactive Fixed Effects Models." Political Analysis, Vol. 25, Iss. 1, January 2017, pp. 57-76.

For more details, see \url{http://yiqingxu.org/software/gsynth/gsynth_examples.html}.
For more details, see \url{https://yiqingxu.org/packages/gsynth/gsynth_examples.html}.
}
10 changes: 5 additions & 5 deletions man/gsynth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ on interactive fixed effect models.}
\item{beta.boot}{bootstrap results for \code{beta}.}
}
\author{
Yiqing Xu <yiqingxu@ucsd.edu>

Licheng Liu <liulch.16@sem.tsinghua.edu.cn>
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University
Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{
Laurent Gobillon and Thierry Magnac, 2016.
Expand All @@ -192,11 +192,11 @@ on interactive fixed effect models.}

Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.
Iss. 1, January 2017, pp. 57-76.

Athey S, Bayati M, Doudchenko N, et al. Matrix completion methods for causal panel data models[J]. arXiv preprint arXiv:1710.10251, 2017.

For more details, see \url{http://yiqingxu.org/software/gsynth/gsynth_examples.html}.
For more details, see \url{https://yiqingxu.org/packages/gsynth/gsynth_examples.html}.

For more details about the matrix completion method, see \url{https://github.com/susanathey/MCPanel}.
}
Expand Down
6 changes: 3 additions & 3 deletions man/interFE.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
\item{est.boot}{a matrix storing results from bootstraps.}
}
\author{
Yiqing Xu <yiqingxu@ucsd.edu>

Licheng Liu <liulch.16@sem.tsinghua.edu.cn>
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University
Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{Jushan Bai. 2009. "Panel Data Models with Interactive Fixed
Effects." Econometrica 77:1229--1279.}
Expand Down
8 changes: 4 additions & 4 deletions man/plot.gsynth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
results obtained from, the generalized synthetic control method.
}
\author{
Yiqing Xu <yiqingxu@ucsd.edu>
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University
Licheng Liu <liulch.16@sem.tsinghua.edu.cn>
Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.
Iss. 1, January 2017, pp. 57-76.
See \url{http://yiqingxu.org/software/gsynth/gsynth_examples.html} for
See \url{https://yiqingxu.org/packages/gsynth/gsynth_examples.html} for
more detailed information.
}
\seealso{
Expand Down
10 changes: 5 additions & 5 deletions man/print.gsynth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
\item{\dots}{other argv.}
}
\author{
Yiqing Xu <yiqingxu@ucsd.edu>

Licheng Liu <liulch.16@sem.tsinghua.edu.cn>
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University
Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.
Iss. 1, January 2017, pp. 57-76.

For more details, see \url{http://yiqingxu.org/software/gsynth/gsynth_examples.html}.
For more details, see \url{https://yiqingxu.org/packages/gsynth/gsynth_examples.html}.
}
\seealso{
\code{\link{gsynth}} and \code{\link{plot.gsynth}}
Expand Down
4 changes: 2 additions & 2 deletions man/print.interFE.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
\item{\dots}{other argv.}
}
\author{
Yiqing Xu <yiqingxu@ucsd.edu>
Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University

Licheng Liu <liulch.16@sem.tsinghua.edu.cn>
Licheng Liu <liulch@mit.edu>, M.I.T.
}
\references{Jushan Bai. 2009. "Panel Data Models with Interactive Fixed
Effects." Econometrica 77:1229--1279.}
Expand Down
28 changes: 14 additions & 14 deletions man/simdata.Rd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
\name{simdata}
\docType{data}
\alias{simdata}
\title{simdata}
\description{A simulated dataset.}
\format{dataframe}
\keyword{datasets}
\references{
Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.

For more details, see \url{http://yiqingxu.org/software/gsynth/gsynth_examples.html}.
}
\name{simdata}
\docType{data}
\alias{simdata}
\title{simdata}
\description{A simulated dataset.}
\format{dataframe}
\keyword{datasets}
\references{
Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76.

For more details, see \url{https://yiqingxu.org/packages/gsynth/gsynth_examples.html}.
}
38 changes: 19 additions & 19 deletions man/turnout.Rd
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
\name{turnout}
\docType{data}
\alias{turnout}
\title{turnout}
\description{State-level voter turnout data.}
\format{dataframe}
\keyword{datasets}
\references{
Melanie Jean Springer. 2014. How the States Shaped the
Nation: American Electoral Institutions and Voter Turnout,
1920-2000. University of Chicago Press.

Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76. Available at: \url{https://doi.org/10.1017/pan.2016.2}.

For more details, see \url{http://yiqingxu.org/software/gsynth/gsynth_examples.html}.
}

\name{turnout}
\docType{data}
\alias{turnout}
\title{turnout}
\description{State-level voter turnout data.}
\format{dataframe}
\keyword{datasets}
\references{
Melanie Jean Springer. 2014. How the States Shaped the
Nation: American Electoral Institutions and Voter Turnout,
1920-2000. University of Chicago Press.

Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference
with Interactive Fixed Effects Models." Political Analysis, Vol. 25,
Iss. 1, January 2017, pp. 57-76.
For more details, see \url{https://yiqingxu.org/packages/gsynth/gsynth_examples.html}.
}

0 comments on commit e6cf33d

Please sign in to comment.