sample.size.calculate: Sample Size Calculation in Local Neighborhoods

View source: R/PSWweight.R

sample.size.calculateR Documentation

Sample Size Calculation in Local Neighborhoods

Description

This function calculate the sample sizes in pre-specified local neighborhoods (the number of subjects in each propensity score (PS) stratified sub-population).

Usage

sample.size.calculate(Z, p.hat, ej)

Arguments

Z

The binary treatment indicator. A vector with 2 unique numeric values in 0 = untreated and 1 = treated.

p.hat

The propensity score used to determine the sub-population in each local neighborhood.

ej

The matrix of the local neighborhoods, which contains two columns of positive values greater or equal to 0 and less or equal to 1. The rows of ej represent the neighborhoods. The first column is the start point of the local neighborhoods. The second column is the end point of the local neighborhoods.

Value

The matrix contains sample sizes in the local neighborhoods with each row corresponding to each local neighborhood (strata). The first gives the total number (n) of subjects in each strata. The third or fourth column give the sample sizes of untreated (n0) or treated (n1) subjects in each strata. The second column gives the ratio between n1 and n.

Examples

# Simulate data
KS = Kang_Schafer_Simulation(n = 1000, seeds = 5050)
# The treatment indicator and the true propensity score
Z = KS$Data[,2]
true.ps = KS$Data[,11]
# Local neighborhoods
ej = cbind(seq(0,0.7,0.1),seq(0.3,1,0.1))
# Calculate sample size in true PS-stratified sub-populations
local.sample.size = sample.size.calculate(Z = Z, p.hat = true.ps, ej)


fiona19832008/PSLB documentation built on April 14, 2022, 12:41 a.m.