diff --git a/DESCRIPTION b/DESCRIPTION index 83637e8..10eb2cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,7 +21,9 @@ Imports: DRDID, tidyr, dplyr, - pbapply + pbapply, + splines2 Suggests: - testthat (>= 3.0.0) + testthat (>= 3.0.0), + did Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index bbcf312..fd33f63 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -43,6 +43,7 @@ export(setup_pte_basic) export(two_by_two_subset) import(BMisc) import(ggplot2) +import(splines2) import(stats) import(tidyr) import(utils) diff --git a/R/attgt_functions.R b/R/attgt_functions.R index c89fc8c..93dae60 100644 --- a/R/attgt_functions.R +++ b/R/attgt_functions.R @@ -11,7 +11,7 @@ #' (equal to "pre" for pre-treatment periods and equal to "post" for post #' treatment periods), \code{Y} (outcome). #' -#' In our case, we call \code{pte::two_by_two_subset} which sets up the +#' In our case, we call \code{two_by_two_subset} which sets up the #' data to have this format before the call to \code{did_attgt}. #' #' @param gt_data data that is "local" to a particular group-time average @@ -78,7 +78,7 @@ did_attgt <- function(gt_data, xformula = ~1, ...) { #' (equal to "pre" for pre-treatment periods and equal to "post" for post #' treatment periods), \code{Y} (outcome). #' -#' In our case, we call \code{pte::two_by_two_subset} which sets up the +#' In our case, we call \code{two_by_two_subset} which sets up the #' data to have this format before the call to `pte_attgt` #' #' @param gt_data data that is "local" to a particular group-time average @@ -218,5 +218,5 @@ pte_attgt <- function( stop(paste0("est_method: ", est_method, " is not supported")) } # return attgt - pte::attgt_if(attgt = attgt$ATT, inf_func = attgt$att.inf.func) + attgt_if(attgt = attgt$ATT, inf_func = attgt$att.inf.func) } diff --git a/R/classes.R b/R/classes.R index e2783a5..7718e76 100644 --- a/R/classes.R +++ b/R/classes.R @@ -76,6 +76,7 @@ group_time_att <- function(group, #' @param object an \code{group_time_att} object #' @param ... extra arguments #' +#' @keywords internal #' @export summary.group_time_att <- function(object, ...) { group_time_att_obj <- object @@ -123,6 +124,7 @@ summary.group_time_att <- function(object, ...) { #' @param x a \code{group_time_att} object #' @param ... extra arguments #' +#' @keywords internal #' @export print.group_time_att <- function(x, ...) { summary.group_time_att(x, ...) @@ -163,6 +165,7 @@ pte_results <- function(att_gt, #' @param object an \code{pte_results} object #' @param ... other arguments #' +#' @keywords internal #' @export summary.pte_results <- function(object, ...) { overall_att <- object$overall_att$overall.att @@ -233,6 +236,7 @@ summary.pte_results <- function(object, ...) { #' @param x a \code{pte_results} object #' @param ... extra arguments #' +#' @keywords internal #' @export print.pte_results <- function(x, ...) { # summary.pte_results(x,...) @@ -249,6 +253,7 @@ print.pte_results <- function(x, ...) { #' @param x a \code{summary.pte_results} object #' @param ... extra arguments #' +#' @keywords internal #' @export print.summary.pte_results <- function(x, ...) { object <- x @@ -403,6 +408,7 @@ pte_emp_boot <- function(attgt_results, #' #' @return \code{summary.pte_results} object #' +#' @keywords internal #' @export summary.pte_emp_boot <- function(object, ...) { overall_att <- object$overall_results$att diff --git a/R/imports.R b/R/imports.R index fd93c91..9388893 100644 --- a/R/imports.R +++ b/R/imports.R @@ -9,5 +9,6 @@ #' @import ggplot2 #' @import tidyr #' @import BMisc +#' @import splines2 #' @importFrom dplyr bind_rows group_by group_map inner_join mutate transmute "_PACKAGE" diff --git a/R/process_dose_gt.R b/R/process_dose_gt.R index 28ca56e..861f531 100644 --- a/R/process_dose_gt.R +++ b/R/process_dose_gt.R @@ -116,13 +116,13 @@ process_dose_gt <- function(gt_results, ptep, ...) { #' @param dose vector containing the values of the dose used in estimation #' @param att.d estimates of ATT(d) for each value of `dose` #' @param att.d_se standard error of ATT(d) for each value of `dose` -#' @param att.d_crt.val critical value to produce pointwise or uniform confidence +#' @param att.d_crit.val critical value to produce pointwise or uniform confidence #' interval for ATT(d) #' @param att.d_inffunc matrix containing the influence function from estimating #' ATT(d) #' @param acrt.d estimates of ACRT(d) for each value of `dose` #' @param acrt.d_se standard error of ACRT(d) for each value of `dose` -#' @param acrt.d_crt.val critical value to produce pointwise or uniform confidence +#' @param acrt.d_crit.val critical value to produce pointwise or uniform confidence #' interval for ACRT(d) #' @param acrt.d_inffunc matrix containing the influence function from estimating #' ACRT(d) @@ -171,6 +171,7 @@ dose_obj <- function( #' @param object an `dose_obj` object #' @param ... extra arguments #' +#' @keywords internal #' @export summary.dose_obj <- function(object, ...) { dose_obj <- object @@ -201,6 +202,7 @@ summary.dose_obj <- function(object, ...) { #' @param x a list containing the summary of a `dose_obj` object #' @param ... extra arguments #' +#' @keywords internal #' @export print.summary.dose_obj <- function(x, ...) { # browser() diff --git a/R/process_dtt_gt.R b/R/process_dtt_gt.R new file mode 100644 index 0000000..f6ed31f --- /dev/null +++ b/R/process_dtt_gt.R @@ -0,0 +1,3 @@ +process_dtt_gt <- function(gt_results, ptep, ...) { + stop("this is just a stub for processing distributional results, not implemented yet") +} diff --git a/R/pte.R b/R/pte.R index 61b428c..dc3f5c2 100644 --- a/R/pte.R +++ b/R/pte.R @@ -523,7 +523,7 @@ pte <- function(yname, #' should return. This is unused is unused except in cases where #' the results involve distributions. #' -#' @param process_dose An optional function to customize results when the gt-specific +#' @param process_dose_gt_fun An optional function to customize results when the gt-specific #' function returns treatment effects that depend on dose (i.e., amount of the #' treatment). The default is `process_dose_gt`, which is a function provided #' by the package. See that function for an example of what this function should diff --git a/R/pte_aggte.R b/R/pte_aggte.R index 95e4425..d8edea1 100644 --- a/R/pte_aggte.R +++ b/R/pte_aggte.R @@ -490,8 +490,7 @@ crit_val_checks <- function(crit_val, alp = 0.05) { #' #' @description An object for holding aggregated treatment effect parameters. #' -#' @inheritParams aggte -#' @inheritParams compute.aggte +#' @inheritParams pte_aggte #' @param overall.att The estimated overall ATT #' @param overall.se Standard error for overall ATT #' @param egt Holds the length of exposure (for dynamic effects), the @@ -547,6 +546,7 @@ aggte_obj <- function(overall.att = NULL, #' @param object an \code{aggte_obj} object #' @param ... other arguments #' +#' @keywords internal #' @export summary.aggte_obj <- function(object, ...) { # call diff --git a/_pkgdown.yml b/_pkgdown.yml index 84af843..234089a 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -12,3 +12,58 @@ navbar: github: icon: fa-github href: https://github.com/bcallaway11/ptetools + +reference: + - title: Generic functions for panel data causal inference + contents: + - aggte_obj + - attgt_if + - attgt_noif + - attgt_pte_aggregations + - compute.pte + - compute.pte2 + - dose_obj + - group_time_att + - gt_data_frame + - overall_weights + - panel_empirical_bootstrap + - process_att_gt + - pte + - pte2 + - pte_aggte + - pte_attgt + - pte_emp_boot + - pte_params + - pte_results + - setup_pte + - setup_pte_basic + + - title: Group-time average treatment effects with a binary treatment + contents: + - did_attgt + - pte_default + + - title: Functions for dealing with a continuous treatment + contents: + - pte_dose_results + + - title: Functions for dealing with distributional treatment effects + contents: + - qott_pte_aggregations + - qtt_pte_aggregations + + - title: Functions for group-time specific subsets of data + contents: + - keep_all_pretreatment_subset + - keep_all_untreated_subset + - two_by_two_subset + + - title: Plotting functions + contents: + - ggpte + - ggpte_cont + + - title: Helper functions + contents: + - crit_val_checks + - mboot2 diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 7f62c3d..2b36278 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.1.3 pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2025-01-31T16:05Z +last_built: 2025-01-31T19:39Z urls: reference: https://github.com/bcallaway11/ptetools/reference article: https://github.com/bcallaway11/ptetools/articles diff --git a/docs/reference/aggte_obj.html b/docs/reference/aggte_obj.html index 83cf4e8..d8f12cb 100644 --- a/docs/reference/aggte_obj.html +++ b/docs/reference/aggte_obj.html @@ -73,6 +73,10 @@
The type of aggregation to be done. Default is "overall"
Holds the length of exposure (for dynamic effects), the group (for selective treatment timing), or the time period (for calendar diff --git a/docs/reference/did_attgt.html b/docs/reference/did_attgt.html index 216b153..95c6cbe 100644 --- a/docs/reference/did_attgt.html +++ b/docs/reference/did_attgt.html @@ -8,7 +8,7 @@ D (treated group identifier), period (time period), name (equal to "pre" for pre-treatment periods and equal to "post" for post treatment periods), Y (outcome). -In our case, we call pte::two_by_two_subset which sets up the +In our case, we call two_by_two_subset which sets up the data to have this format before the call to did_attgt.'>
Skip to contents @@ -59,13 +59,13 @@D
(treated group identifier), period
(time period), name
(equal to "pre" for pre-treatment periods and equal to "post" for post
treatment periods), Y
(outcome).
-In our case, we call pte::two_by_two_subset
which sets up the
+
In our case, we call two_by_two_subset
which sets up the
data to have this format before the call to did_attgt
.
one-sided formula for covariates used in the propensity score and outcome regression models
critical value to produce pointwise or uniform confidence +interval for ATT(d)
matrix containing the influence function from estimating ATT(d)
critical value to produce pointwise or uniform confidence +interval for ACRT(d)
matrix containing the influence function from estimating ACRT(d)
critical value to produce pointwise or uniform confidence -interval for ATT(d)
critical value to produce pointwise or uniform confidence -interval for ACRT(d)
did_attgt()
-
- dose_obj()
ggpte()
-
- ggpte_cont()
-
- group_time_att()
overall_weights()
- keep_all_untreated_subset()
+ panel_empirical_bootstrap()
mboot2()
+ process_att_gt()
overall_weights()
+ pte()
panel_empirical_bootstrap()
+ pte2()
print(<group_time_att>)
+ pte_aggte()
print(<pte_results>)
+ pte_attgt()
print(<summary.dose_obj>)
+ pte_emp_boot()
print(<summary.pte_results>)
+ pte_params()
process_att_gt()
+ pte_results()
pte()
+ setup_pte()
pte2()
+ setup_pte_basic()
pte_aggte()
-
- pte_attgt()
+
+ pte_dose_results()
pte_emp_boot()
-
- pte_params()
- pte_results()
-
- qott_pte_aggregations()
@@ -242,56 +227,84 @@ setup_pte()
- setup_pte_basic()
+
+ keep_all_pretreatment_subset()
summary(<aggte_obj>)
+ keep_all_untreated_subset()
summary(<dose_obj>)
+ two_by_two_subset()
summary(<group_time_att>)
+
+
+ ggpte()
summary(<pte_emp_boot>)
+ ggpte_cont()
summary(<pte_results>)
+
+
+ crit_val_checks()
two_by_two_subset()
+ mboot2()