ICSKAT_fit_null {ICSKAT}R Documentation

ICSKAT_fit_null.R

Description

Fit the null model (cubic basis spline for baseline cumulative hazard and coefficients for non-genetic coefficiens) for interval-censored skat.

Usage

ICSKAT_fit_null(
  init_beta,
  left_dmat,
  right_dmat,
  obs_ind,
  tpos_ind,
  lt,
  rt,
  runOnce = FALSE,
  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 interval times.

rt

n*1 vector of right interval times.

runOnce

Boolean tells the function to just go through the loop once instead of converging (to get quantites for bootstrapping).

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

Value is 0 if no errors and 1 if Itt is singular, can't perform fit.

errMsg

Empty string if err=0, explains error if there is one.

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, lt, rt, obs_ind, tpos_ind)
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)


[Package ICSKAT version 0.2.0 Index]