sample.size.calculate | R Documentation |
This function calculate the sample sizes in pre-specified local neighborhoods (the number of subjects in each propensity score (PS) stratified sub-population).
sample.size.calculate(Z, p.hat, ej)
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. |
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.