ICskat {ICSKAT} | R Documentation |
ICSKAT.R
Description
Calculate the test statistic and p-value for interval-censored SKAT.
Usage
ICskat(
left_dmat,
right_dmat,
lt,
rt,
obs_ind,
tpos_ind,
gMat,
null_beta,
Itt,
pvalue = TRUE
)
Arguments
left_dmat |
n*(p+nknots+2) design matrix for left end of interval. |
right_dmat |
n*(p+nknots+2) design matrix for right end of interval. |
lt |
n*1 vector of left side of interval times. |
rt |
n*1 vector of right side of interval times. |
obs_ind |
n*1 vector of whether the event was observed before last follow-up. |
tpos_ind |
n*1 vector of whether the event was observed after follow-up started (t>0). |
gMat |
n*q genotype matrix. |
null_beta |
(p+nknots+2)*1 vector of coefficients for null model. |
Itt |
(p+nknots+2)*(p+nknots+2) Fisher information matrix for null model coefficients. |
pvalue |
Boolean, if TRUE then find the p-value (maybe don't need it if bootstrapping, saves eigendecomposition) |
Value
A list with the elements:
p_SKAT |
ICSKAT p-value |
p_burden |
IC burden test p-value |
complex |
Indicator of whether the SKAT variance matrix was positive definite |
sig_mat |
The covariance matrix of the score equations for genetic effects when treated as fixed effects |
skatQ |
SKAT test statistic |
burdenQ |
Burden test statistic |
Ugamma |
Score vector |
lambdaQ |
Vector of eigenvalues of variance matrix |
null_beta |
The fitted null parameters |
err |
Will be 0 for no error, 22 if had to adjust parameters on CompQuadForm (totally normal), or 99 if NA in variance matrix. ICSKATwrapper will return 1 here if the null fit has an error |
errMsg |
Explains error code, blank string if no error |
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)
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)