PSpower: Calculate sample size needed to achieve a prespecified power

View source: R/PSpower.R

PSpowerR Documentation

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)

PSpower documentation built on April 4, 2025, 5:17 a.m.