ICSKATO_bootstrap {ICSKAT} | R Documentation |
ICSKATO_bootstrap.R
Description
The version of ICSKATO to run when bootstrapping to match kurtosis.
Usage
ICSKATO_bootstrap(
icskatOut,
B,
intervalProbs,
allVisits,
quant_r,
seed = NULL,
null_fit,
gMat,
xMat,
fitAgain,
checkpoint = FALSE,
downsample = 1,
rhoVec
)
Arguments
icskatOut |
The output list from ICSKAT(). |
B |
Number of bootstrap replications. |
intervalProbs |
n*(s+1) matrix where n is number of subjects and s is the number of visits possible, probability of falling in each interval. |
allVisits |
n*s matrix with all the visit times for each subject. |
quant_r |
Quantiles of time from make_IC_dmats, to keep them constant through bootstrapping. |
seed |
Seed to start the bootstrapping. |
null_fit |
The null fit output from ICSKAT_fit_null. |
gMat |
Genotype matrix used in original test. |
xMat |
n*p matrix of non-genetic covariates. |
fitAgain |
Boolean, whether to fit the null model again in each bootstrap. |
checkpoint |
Boolean, whether to print every time 100 bootstraps finish. |
downsample |
A number in (0, 1], will use this fraction of the bootstrap iterations to try running the test with fewer bootstraps. |
rhoVec |
Vector of rhos to search over in SKATO. |
Value
A list with the elements:
kurtQvec |
Vector of bootstrapped excess kurtosis of each Qrho. |
varQvec |
Vector of bootstrapped variance of each Qrho. |
meanQvec |
Vector of bootstrapped mean of each Qrho. |
kurtKappa |
Bootstrapped kurtosis of kappa term without zeta. |
kurtKappaAll |
Bootstrapped kurtosis of full kappa term with zeta. |
varKappaAll |
Bootstrapped variance of full kappa term with zeta. |
meanKappaAll |
Bootstrapped mean of full kappa term with zeta. |
bootDF |
Matrix with B rows containing all the bootstrapped quantities over all iterations. |
QrhoBoot |
Matrix with B rows containing all the bootstrapped Qrho values, one column for each rho. |
listDS |
A list containing all of the other elements in this return list, except using the downsampled iterations. |
nonNA |
Number of bootstraps that did not result in NA (and thus were not removed). |
Examples
set.seed(2)
gMat <- matrix(data=rbinom(n=2000, size=2, prob=0.3), nrow=100)
xMat <- matrix(data=rnorm(200), nrow=100)
bhFunInv <- function(x) {x}
obsTimes <- 1:5
etaVec <- rep(0, 100)
outcomeDat <- gen_IC_data(bhFunInv = bhFunInv, obsTimes = obsTimes, windowHalf = 0.1,
probMiss = 0.1, etaVec = etaVec)
lt <- outcomeDat$leftTimes
rt <- outcomeDat$rightTimes
tpos_ind <- as.numeric(lt > 0)
obs_ind <- as.numeric(rt != Inf)
dmats <- make_IC_dmat(xMat, lt, rt, obs_ind, tpos_ind)
nullFit <- ICSKAT_fit_null(init_beta = rep(0, 5), left_dmat = dmats$left_dmat,
right_dmat=dmats$right_dmat, obs_ind = obs_ind, tpos_ind = tpos_ind,
lt = lt, rt = rt)
icskatOut <- ICskat(left_dmat = dmats$left_dmat, right_dmat=dmats$right_dmat,
lt = lt, rt = rt, obs_ind = obs_ind, tpos_ind = tpos_ind, gMat = gMat,
null_beta = nullFit$beta_fit, Itt = nullFit$Itt)
intervalProbOutput <- construct_interval_probs(allTimes = outcomeDat$allVisits,
dmats = dmats, nullBeta = nullFit$beta_fit, p = ncol(xMat), nKnots=1)
ICSKATO_bootstrap(icskatOut = icSkatOut, B = 100, intervalProbs = intervalProbOutput$probMat,
allVisits = intervalProbOutput$allTimesFilled, quant_r = dmats$quant_r, seed = 0,
null_fit = nullFit, gMat = gMat, xMat, fitAgain = TRUE,
rhoVec=c(0, 0.01, 0.04, 0.09, 0.25, 0.5, 1))