ICSKAT_fit_null_PO {ICSKAT} | R Documentation |
ICSKAT_fit_null_PO.R
Description
Fit the null model (cubic basis spline for baseline cumulative hazard and coefficients for non-genetic coefficients) for interval-censored skat with PO model.
Usage
ICSKAT_fit_null_PO(
init_beta,
left_dmat,
right_dmat,
obs_ind,
tpos_ind,
lt,
rt,
checkpoint = FALSE,
eps = 10^(-6)
)
Arguments
init_beta |
(p+nknots+2)*1 vector of coefficients to initialize the Newton-Raphson. |
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. |
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). |
lt |
n*1 vector of left side of interval times. |
rt |
n*1 vector of right side of interval times. |
checkpoint |
Boolean tells the function to print when each iteration completes. |
eps |
Stop when the L2 norm of the difference in model coefficients reaches this limit. |
Value
A list with the elements:
beta_fit |
(p+nknots+2)*1 vector of fitted coefficients under null model. |
iter |
Number of iterations needed to converge. |
Itt |
Fisher information matrix for the fitted coefficients. |
diff_beta |
Difference between beta_fit and previous iteration of the vector, can be checked for errors. |
err |
err=1 if NA shows up in the calculation. |
IterrMsg |
Describes the error. |
Examples
set.seed(2)
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 = xMat, lt = lt, rt = rt, obs_ind = obs_ind,
tpos_ind = tpos_ind)
ICSKAT_fit_null_PO(init_beta = rep(0.1, 5), left_dmat = dmats$left_dmat,
right_dmat=dmats$right_dmat, obs_ind = obs_ind, tpos_ind = tpos_ind, lt = lt, rt = rt)