Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull Request follow-up for #30: Various formatting issues #54

Merged
merged 22 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
README
deltaSD.png
^LICENSE\.md$
.github
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: HonestDiD
Type: Package
Title: Robust Inference in Difference-in-Differences and Event Study Designs
Version: 0.2.5
Version: 0.2.6
Depends:
R (>= 3.6.0)
Imports:
Expand Down
8 changes: 5 additions & 3 deletions R/deltasdrmm.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,11 @@
}

computeConditionalCS_DeltaSDRMM <- function(betahat, sigma, numPrePeriods, numPostPeriods,
l_vec = .basisVector(index = 1, size = numPostPeriods), Mbar = 0,
alpha = 0.05, hybrid_flag = "LF", hybrid_kappa = alpha/10,
returnLength = FALSE, postPeriodMomentsOnly = TRUE, monotonicityDirection = "increasing",
l_vec = .basisVector(index = 1, size = numPostPeriods),
Mbar = 0, alpha = 0.05, hybrid_flag = "LF",
hybrid_kappa = alpha/10, returnLength = FALSE,
postPeriodMomentsOnly = TRUE,
monotonicityDirection = "increasing",
gridPoints = 10^3, grid.ub = NA, grid.lb = NA) {
# This function computes the ARP CI that includes nuisance parameters
# for Delta^{SDRMM}(Mbar). This functions uses ARP_computeCI for all
Expand Down
2 changes: 0 additions & 2 deletions R/honest_did.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ honest_did <- function(...) UseMethod("honest_did")
#' points for computational reasons.
#' @param ... Parameters to pass to `createSensitivityResults` or
#' `createSensitivityResults_relativeMagnitudes`.
#' @inheritParams HonestDiD::createSensitivityResults
#' @inheritParams HonestDid::createSensitivityResults_relativeMagnitudes
honest_did.AGGTEobj <- function(es,
e = 0,
type = c("smoothness", "relative_magnitude"),
Expand Down
2 changes: 1 addition & 1 deletion man/DeltaSD_lowerBound_Mpre.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\alias{DeltaSD_lowerBound_Mpre}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Construct lower bound for M for Delta = Delta^{SD}(M) based on observed pre-period coefficients.
Construct lower bound for M for \eqn{\Delta = \Delta^{SD}(M)} based on observed pre-period coefficients.
}
\description{
Constructs a lower bound for M using the observed pre-period coefficients. It constructs a one-sided confidence interval for the maximal second difference of the observed pre-period using the conditional test developed in Andrews, Roth & Pakes (2019). The number of pre-periods (not including the reference period) must be larger than or equal to two.
Expand Down
2 changes: 1 addition & 1 deletion man/DeltaSD_upperBound_Mpre.Rd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\name{DeltaSD_upperBound_Mpre}
\alias{DeltaSD_upperBound_Mpre}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Construct upper bound for M for Delta = Delta^{SD}(M) based on observed pre-period coefficients.
\title{Construct upper bound for M for \eqn{\Delta = \Delta^{SD}(M)} based on observed pre-period coefficients.
}
\description{
Constructs an upper bound for M using the observed pre-period event study coefficients. This is constructed using (1-alpha) level one-sided upper confidence intervala for the second differences of the observed pre-period event study coefficients. The number of pre-periods (not including the reference period) must be larger than or equal to two.
Expand Down
10 changes: 5 additions & 5 deletions man/computeConditionalCS_DeltaRM.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
\alias{computeConditionalCS_DeltaRM}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Computes conditional and hybridized confidence set for Delta = Delta^{RM}(Mbar).
Computes conditional and hybridized confidence set for \eqn{\Delta = \Delta^{RM}(Mbar)}.
}
\description{
Computes the conditional confidence set and hybridized confidence set for Delta = Delta^{RM}(Mbar).
Computes the conditional confidence set and hybridized confidence set for \eqn{\Delta = \Delta^{RM}(Mbar)}.
}
\usage{
computeConditionalCS_DeltaRM(betahat, sigma, numPrePeriods, numPostPeriods,
Expand All @@ -32,13 +32,13 @@ computeConditionalCS_DeltaRM(betahat, sigma, numPrePeriods, numPostPeriods,
Vector of length numPostPeriods that describes the scalar parameter of interest, theta = l_vec'tau. Default equals to first basis vector, (1, 0, ..., 0)
}
\item{Mbar}{
Tuning parameter Mbar for Delta^{RM}(Mbar) that governs how different the maximal pre-period violation of parallel trends may be from the post-period differential trend. Default sets Mbar = 0. See Section 2.3.2 of Rambachan & Roth (2021) for more details.
Tuning parameter Mbar for \eqn{\Delta^{RM}(Mbar)} that governs how different the maximal pre-period violation of parallel trends may be from the post-period differential trend. Default sets Mbar = 0. See Section 2.3.2 of Rambachan & Roth (2021) for more details.
}
\item{alpha}{
Desired level of the confidence set. Default equals 0.05 (corresponding to 95\% confidence interval)
}
\item{hybrid_flag}{
Flag for whether user wishes to compute a hybridized confidence set. "ARP" specifies the conditional confidence set "LF" specifies the conditional least-favorable confidence set. The conditional FLCI hybrid confidence set is not available for Delta^{RM}(Mbar) since the FLCI is infinite length for this choice of Delta. See Section 3.3 and Section 5.3 of Rambachan & Roth (2021) for details. Default equals "LF".
Flag for whether user wishes to compute a hybridized confidence set. "ARP" specifies the conditional confidence set "LF" specifies the conditional least-favorable confidence set. The conditional FLCI hybrid confidence set is not available for \eqn{\Delta^{RM}(Mbar)} since the FLCI is infinite length for this choice of \eqn{\Delta}. See Section 3.3 and Section 5.3 of Rambachan & Roth (2021) for details. Default equals "LF".
}
\item{hybrid_kappa}{
Desired first-stage size of hybridized confidence set. Only specify this value if the user wishes to compute a hybridized confidence set. Default equals alpha/10. If user specifies hybrid_flag = "ARP", set this value to NULL.
Expand All @@ -47,7 +47,7 @@ computeConditionalCS_DeltaRM(betahat, sigma, numPrePeriods, numPostPeriods,
Logical value. If TRUE, function only returns the length of the robust confidence. If FALSE, function returns dataframe that contains a grid of possible parameter values and a vector of zeros and ones associated with each value in the grid (one denotes that the grid value lies in the confidence set and zero denotes that the grid value does not fall within the confidence set.) Default equals FALSE.
}
\item{postPeriodMomentsOnly}{
Logical value. If TRUE, function excludes moments for Delta^{RM}(Mbar) that only include pre-period coefficients. Default equals TRUE.
Logical value. If TRUE, function excludes moments for \eqn{\Delta^{RM}(Mbar)} that only include pre-period coefficients. Default equals TRUE.
}
\item{gridPoints}{
Number of grid points used in test inversion step. Default equals 1000.
Expand Down
12 changes: 6 additions & 6 deletions man/computeConditionalCS_DeltaRMB.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
\alias{computeConditionalCS_DeltaRMB}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Computes conditional and hybridized confidence set for Delta = Delta^{RMB}(Mbar).
Computes conditional and hybridized confidence set for \eqn{Delta = Delta^{RMB}(Mbar)}.
}
\description{
Computes the conditional confidence set and hybridized confidence set for Delta = Delta^{RMB}(Mbar). The set Delta^{RMB}(Mbar) adds an additional sign restriction to Delta^{RM}(Mbar) that restricts the sign of the bias to be either positive (delta >= 0) or negative (delta <= 0).
Computes the conditional confidence set and hybridized confidence set for \eqn{Delta = Delta^{RMB}(Mbar)}. The set \eqn{Delta^{RMB}(Mbar)} adds an additional sign restriction to \eqn{Delta^{RM}(Mbar)} that restricts the sign of the bias to be either positive (\eqn{delta \ge 0}) or negative (\eqn{delta \le 0}).
}
\usage{
computeConditionalCS_DeltaRMB(betahat, sigma, numPrePeriods, numPostPeriods,
Expand Down Expand Up @@ -34,13 +34,13 @@ computeConditionalCS_DeltaRMB(betahat, sigma, numPrePeriods, numPostPeriods,
Vector of length numPostPeriods that describes the scalar parameter of interest, theta = l_vec'tau. Default equals to first basis vector, (1, 0, ..., 0)
}
\item{Mbar}{
Tuning parameter Mbar for Delta^{RM}(Mbar) that governs how different the maximal pre-period violation of parallel trends may be from the post-period differential trend. Default sets Mbar = 0. See Section 2.3.2 of Rambachan & Roth (2021) for more details.
Tuning parameter Mbar for \eqn{\Delta^{RM}(Mbar)} that governs how different the maximal pre-period violation of parallel trends may be from the post-period differential trend. Default sets Mbar = 0. See Section 2.3.2 of Rambachan & Roth (2021) for more details.
}
\item{alpha}{
Desired level of the confidence set. Default equals 0.05 (corresponding to 95\% confidence interval)
}
\item{hybrid_flag}{
Flag for whether user wishes to compute a hybridized confidence set. "ARP" specifies the conditional confidence set "LF" specifies the conditional least-favorable confidence set. The conditional FLCI hybrid confidence set is not available for Delta^{RMB}(Mbar) since the FLCI is infinite length for this choice of Delta. See Section 3.3 and Section 5.3 of Rambachan & Roth (2021) for details. Default equals "LF".
Flag for whether user wishes to compute a hybridized confidence set. "ARP" specifies the conditional confidence set "LF" specifies the conditional least-favorable confidence set. The conditional FLCI hybrid confidence set is not available for \eqn{\Delta^{RMB}(Mbar)} since the FLCI is infinite length for this choice of \eqn{\Delta}. See Section 3.3 and Section 5.3 of Rambachan & Roth (2021) for details. Default equals "LF".
}
\item{hybrid_kappa}{
Desired first-stage size of hybridized confidence set. Only specify this value if the user wishes to compute a hybridized confidence set. Default equals alpha/10. If user specifies hybrid_flag = "ARP", set this value to NULL.
Expand All @@ -49,10 +49,10 @@ computeConditionalCS_DeltaRMB(betahat, sigma, numPrePeriods, numPostPeriods,
Logical value. If TRUE, function only returns the length of the robust confidence. If FALSE, function returns dataframe that contains a grid of possible parameter values and a vector of zeros and ones associated with each value in the grid (one denotes that the grid value lies in the confidence set and zero denotes that the grid value does not fall within the confidence set.) Default equals FALSE.
}
\item{biasDirection}{
Specifies direction of bias restriction. If "positive", bias is restricted to be positive, delta >= 0. If "negative", bias is restricted to be negative, delta <= 0. Default equals "positive".
Specifies direction of bias restriction. If "positive", bias is restricted to be positive, \eqn{\delta \ge 0}. If "negative", bias is restricted to be negative, \eqn{\delta \le 0}. Default equals "positive".
}
\item{postPeriodMomentsOnly}{
Logical value. If TRUE, function excludes moments for Delta^{RMB}(Mbar) that only include pre-period coefficients. Default equals TRUE.
Logical value. If TRUE, function excludes moments for \eqn{\Delta^{RMB}(Mbar)} that only include pre-period coefficients. Default equals TRUE.
}
\item{gridPoints}{
Number of grid points used in test inversion step. Default equals 1000.
Expand Down
12 changes: 6 additions & 6 deletions man/computeConditionalCS_DeltaRMM.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
\alias{computeConditionalCS_DeltaRMM}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Computes conditional and hybridized confidence set for Delta = Delta^{RMM}(Mbar).
Computes conditional and hybridized confidence set for \eqn{\Delta = \Delta^{RMM}(Mbar)}.
}
\description{
Computes the conditional confidence set and hybridized confidence set for Delta = Delta^{RMM}(Mbar). The set Delta^{RMM}(Mbar) adds an additional shape restriction to Delta^{RM}(Mbar) that restricts the underlying trend to be monotone. It may either be increasing (delta_t >= delta_{t-1}) or decreasing (delta_t <= delta_{t-1}).
Computes the conditional confidence set and hybridized confidence set for \eqn{\Delta = \Delta^{RMM}(Mbar)}. The set \eqn{\Delta^{RMM}(Mbar)} adds an additional shape restriction to \eqn{\Delta^{RM}(Mbar)} that restricts the underlying trend to be monotone. It may either be increasing (\eqn{\delta_t \ge \delta_{t-1}}) or decreasing (\eqn{\delta_t \le \delta_{t-1}}).
}
\usage{
computeConditionalCS_DeltaRMM(betahat, sigma, numPrePeriods, numPostPeriods,
Expand Down Expand Up @@ -35,13 +35,13 @@ computeConditionalCS_DeltaRMM(betahat, sigma, numPrePeriods, numPostPeriods,
Vector of length numPostPeriods that describes the scalar parameter of interest, theta = l_vec'tau. Default equals to first basis vector, (1, 0, ..., 0)
}
\item{Mbar}{
Tuning parameter Mbar for Delta^{RM}(Mbar) that governs how different the maximal pre-period violation of parallel trends may be from the post-period differential trend. Default sets Mbar = 0. See Section 2.3.2 of Rambachan & Roth (2021) for more details.
Tuning parameter Mbar for \eqn{\Delta^{RM}(Mbar)} that governs how different the maximal pre-period violation of parallel trends may be from the post-period differential trend. Default sets Mbar = 0. See Section 2.3.2 of Rambachan & Roth (2021) for more details.
}
\item{alpha}{
Desired level of the confidence set. Default equals 0.05 (corresponding to 95\% confidence interval)
}
\item{hybrid_flag}{
Flag for whether user wishes to compute a hybridized confidence set. "ARP" specifies the conditional confidence set "LF" specifies the conditional least-favorable confidence set. The conditional FLCI hybrid confidence set is not available for Delta^{RM}(Mbar) since the FLCI is infinite length for this choice of Delta. See Section 3.3 and Section 5.3 of Rambachan & Roth (2021) for details. Default equals "LF".
Flag for whether user wishes to compute a hybridized confidence set. "ARP" specifies the conditional confidence set "LF" specifies the conditional least-favorable confidence set. The conditional FLCI hybrid confidence set is not available for \eqn{\Delta^{RM}(Mbar)} since the FLCI is infinite length for this choice of \eqn{\Delta}. See Section 3.3 and Section 5.3 of Rambachan & Roth (2021) for details. Default equals "LF".
}
\item{hybrid_kappa}{
Desired first-stage size of hybridized confidence set. Only specify this value if the user wishes to compute a hybridized confidence set. Default equals alpha/10. If user specifies hybrid_flag = "ARP", set this value to NULL.
Expand All @@ -50,10 +50,10 @@ computeConditionalCS_DeltaRMM(betahat, sigma, numPrePeriods, numPostPeriods,
Logical value. If TRUE, function only returns the length of the robust confidence. If FALSE, function returns dataframe that contains a grid of possible parameter values and a vector of zeros and ones associated with each value in the grid (one denotes that the grid value lies in the confidence set and zero denotes that the grid value does not fall within the confidence set.) Default equals FALSE.
}
\item{postPeriodMomentsOnly}{
Logical value. If TRUE, function excludes moments for Delta^{RM}(Mbar) that only include pre-period coefficients. Default equals TRUE.
Logical value. If TRUE, function excludes moments for \eqn{\Delta^{RM}(Mbar)} that only include pre-period coefficients. Default equals TRUE.
}
\item{monotonicityDirection}{
Specifies direction of monotonicity restriction. If "increasing", underlying trend specified to be increasing, delta_t >= delta_{t-1}. If "decreasing", underlying trend specified to be decreasing delta_t <= delta_{t-1}. Default equals "increasing."
Specifies direction of monotonicity restriction. If "increasing", underlying trend specified to be increasing, \eqn{\delta_t \ge \delta_{t-1}}. If "decreasing", underlying trend specified to be decreasing \eqn{\delta_t \le \delta_{t-1}}. Default equals "increasing."
}
\item{gridPoints}{
Number of grid points used in test inversion step. Default equals 1000.
Expand Down
8 changes: 4 additions & 4 deletions man/computeConditionalCS_DeltaSD.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
\alias{computeConditionalCS_DeltaSD}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Computes conditional and hybridized confidence set for Delta = Delta^{SD}(M).
Computes conditional and hybridized confidence set for \eqn{\Delta = \Delta^{SD}(M)}.
}
\description{
Computes the conditional confidence set and hybridized confidence set for Delta = Delta^{SD}(M).
Computes the conditional confidence set and hybridized confidence set for \eqn{\Delta = \Delta^{SD}(M)}.
}
\usage{
computeConditionalCS_DeltaSD(betahat, sigma, numPrePeriods, numPostPeriods,
Expand Down Expand Up @@ -33,7 +33,7 @@ computeConditionalCS_DeltaSD(betahat, sigma, numPrePeriods, numPostPeriods,
Vector of length numPostPeriods that describes the scalar parameter of interest, theta = l_vec'tau. Default equals to first basis vector, (1, 0, ..., 0)
}
\item{M}{
Tuning parameter for Delta^{SD}(M) that governs the degree of non-linearity allowed in the violation of parallel trends. Default equals 0
Tuning parameter for \eqn{\Delta^{SD}(M)} that governs the degree of non-linearity allowed in the violation of parallel trends. Default equals 0
}
\item{alpha}{
Desired size of the confidence set. Default equals 0.05 (corresponding to 95\% confidence interval)
Expand All @@ -48,7 +48,7 @@ computeConditionalCS_DeltaSD(betahat, sigma, numPrePeriods, numPostPeriods,
Logical value. If TRUE, function only returns the length of the robust confidence. If FALSE, function returns dataframe that contains a grid of possible parameter values and a vector of zeros and ones associated with each value in the grid (one denotes that the grid value lies in the confidence set and zero denotes that the grid value does not fall within the confidence set. Default equals FALSE.)
}
\item{postPeriodMomentsOnly}{
Logical value. If TRUE, function excludes moments for Delta^{SD}(M) that only include pre-period coefficients. Default equals TRUE.
Logical value. If TRUE, function excludes moments for \eqn{\Delta^{SD}(M)} that only include pre-period coefficients. Default equals TRUE.
}
\item{gridPoints}{
Number of grid points used in test inversion step. Default equals 1000.
Expand Down
Loading
Loading