Type: | Package |
Title: | Sample Size Calculation for Propensity Score Analysis |
Version: | 0.1.1 |
Maintainer: | Bo Liu <bl226@duke.edu> |
Description: | Sample size calculations in causal inference with observational data are increasingly desired. This package is a tool to calculate sample size under prespecified power with minimal summary quantities needed. |
Depends: | ggplot2 |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-04-02 20:45:21 UTC; boliu |
Author: | Bo Liu [aut, cre], Xiaoxiao Zhou [ctb], Fan Li [ctb] |
Repository: | CRAN |
Date/Publication: | 2025-04-02 21:00:02 UTC |
Calculate sample size needed to achieve a prespecified power
Description
Calculate sample size needed to achieve a prespecified power
Usage
PSpower(
tau,
sig.level = 0.05,
power = NULL,
sample.size = NULL,
r,
phi,
rho_sq,
test = "two-sided",
estimand = "ATE"
)
Arguments
tau |
the anticipated standardized treatment effect |
sig.level |
the significance level, or the type-I error rate (default 0.05) |
power |
the desired power to achieve (only specify for sample size calculation) |
sample.size |
the total sample size (only specify for power calculation) |
r |
the proportion of treated units |
phi |
the overlap coefficient (usually between 0.8 and 1); use function plot_overlap(r, phi) for visual aid |
rho_sq |
the squared correlation between propensity score and outcome; recommend treating as a sensitivity parameter: a grid of values between 0 and the R-squared statistic of predicting the outcomes with covariates. |
test |
whether one-sided or two-sided test is considered |
estimand |
the estimand (ATE, ATT, ATC or ATO), or a customized tilting function h(e(x)) |
Value
an object with the calculated sample size
Examples
PSpower(tau = 1/sqrt(20), sig.level = 0.05, power = 0.956, r = 0.5, phi = 0.99, rho_sq = 0.02)
Plots PSpower object
Description
Plots PSpower object
Usage
## S3 method for class 'PSpower'
plot(x, power = seq(0.6, 0.99, length.out = 100), ...)
Arguments
x |
PSpower object |
power |
a range of powers to plot the power curve |
... |
ignored |
Value
an object (class ggplot) containing a figure
Examples
obj <- PSpower(tau = 1/sqrt(20), sig.level = 0.05, power = 0.956,
r = 0.5, phi = 0.99, rho_sq = 0.02)
plot(obj)
Plot density of propensity scores given treatment probability and overlap coefficient
Description
Plot density of propensity scores given treatment probability and overlap coefficient
Usage
plot_overlap(r, phi)
Arguments
r |
treatment probability |
phi |
overlap coefficient |
Value
a ggplot of the density of propensity scores in two treatment arms
Examples
plot_overlap(0.6, 0.9)
Prints PSpower object
Description
Prints PSpower object
Usage
## S3 method for class 'PSpower'
print(x, ...)
Arguments
x |
PSpower object |
... |
ignored |
Value
no return value; called for side effect to output a string