SAT.stage2.sampling: Second stage sampling with SAT.

Description Usage Arguments Value References Examples

View source: R/SAT.stage2.sampling.r

Description

This function implements the second stage sampling in SAT by SAT-S or SAT-cY.

Usage

1
SAT.stage2.sampling(r1, n, S, Rpar = 0.5, r, stage1.index, stage1.y, X, method = "SAT-S")

Arguments

r1

pilot subsample size.

n

total sample size.

S

a binary vector of length n. Surrogate observations for all samples.

Rpar

case proportion parameter. Should be the same as in SAT.stage1.sampling.

r

second stage subsample size.

stage1.index

a vector of length r1. The output of SAT.stage1.sampling, i.e., the index of pilot sampled patients.

stage1.y

a binary vector of length r1. The manual chart review results for patients in stage1.index.

X

a matrix of dimension n times p (the first column needs to be 1). The covariate matrix contains observations for all n samples.

Value

The function returns a list:

beta.pilot

the pilot estimator.

stage1.index

a vector of index for patients who are selected in pilot sampling.

stage2.index

a vector of index for patients who are selected in the second stage sampling.

stage1.weights

a vector of weights used in fitting weighted logistic regression for patients who are selected in pilot sampling.

References

Liu, X., Chubak, J., Hubbard, R. A. & Chen, Y. (2021). SAT: a Surrogate Assisted Two-wave case boosting sampling method, with application to EHR-based association studies.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(SAT)
set.seed(0)
n <- 1e5
beta0  <- c(1/5, 0, 0, 1/2, rep(1/2, 4))
d <- length(beta0)

X <- rnorm(n*(d-1), -1.5, 1)
X <- matrix(X, nrow = n, ncol = d - 1)
X <- cbind(1, X)

P  <- 1 - 1 / (1 + exp(X %*% beta0))
Y  <- rbinom(n, 1, P)

a1 <- 0.85 # sensitivity
a2 <- 0.95 # specificity
pr_s <- vector(mode = "numeric", length = n)
pr_s <- a1*(Y==1) + (1-a2)*(Y==0)
S <- rbinom(n, 1, pr_s)

stage1.index <- SAT.stage1.sampling(r1 = 400, n = 1e5, S, Rpar = 0.5)
stage1.y <- Y[stage1.index]
stage2 <- SAT.stage2.sampling(r1 = 400, n = 1e5, S, Rpar = 0.5, r = 800,
                              stage1.index, stage1.y, X, method = "SAT-S")
stage$beta.pilot

xliu-stat/SAT documentation built on Dec. 23, 2021, 7:10 p.m.