| Title: | Sample Size Calculation for Propensity Score Analysis |
|---|---|
| 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. |
| Authors: | Bo Liu [aut, cre], Xiaoxiao Zhou [ctb], Fan Li [ctb] |
| Maintainer: | Bo Liu <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-05-23 06:01:11 UTC |
| Source: | https://github.com/laubok/pspower |
Plot density of propensity scores given treatment probability and overlap coefficient
plot_overlap(r, phi)plot_overlap(r, phi)
r |
treatment probability |
phi |
overlap coefficient |
a ggplot of the density of propensity scores in two treatment arms
plot_overlap(0.6, 0.9)plot_overlap(0.6, 0.9)
Plots PSpower object
## S3 method for class 'PSpower' plot(x, power = seq(0.6, 0.99, length.out = 100), ...)## S3 method for class 'PSpower' plot(x, power = seq(0.6, 0.99, length.out = 100), ...)
x |
PSpower object |
power |
a range of powers to plot the power curve |
... |
ignored |
an object (class ggplot) containing a figure
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)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)
Prints PSpower object
## S3 method for class 'PSpower' print(x, ...)## S3 method for class 'PSpower' print(x, ...)
x |
PSpower object |
... |
ignored |
no return value; called for side effect to output a string
Calculate sample size needed to achieve a prespecified power
PSpower( tau, sig.level = 0.05, power = NULL, sample.size = NULL, r, phi, rho_sq, test = "two-sided", estimand = "ATE" )PSpower( tau, sig.level = 0.05, power = NULL, sample.size = NULL, r, phi, rho_sq, test = "two-sided", estimand = "ATE" )
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)) |
an object with the calculated sample size
PSpower(tau = 1/sqrt(20), sig.level = 0.05, power = 0.956, r = 0.5, phi = 0.99, rho_sq = 0.02)PSpower(tau = 1/sqrt(20), sig.level = 0.05, power = 0.956, r = 0.5, phi = 0.99, rho_sq = 0.02)