Learn R Programming

ICSKAT (version 0.3.0)

make_IC_dmat: make_IC_dmat.R

Description

Puts together the entire design matrix for both the left and right ends of the interval, pasting together the non-genetic covariates with the cubic spline basis.

Usage

make_IC_dmat(xMat, lt, rt, obs_ind, tpos_ind, quant_r = NULL, nKnots = 1)

Value

A list with the elements:

right_dmat

n*(p+nKnots+2) design matrix for right end of interval.

left_dmat

n*(p+nKnots+2) design matrix for left end of interval.

quant_r

Quantiles used for constructing spline.

Arguments

xMat

n*p matrix of non-genetic covariates.

lt

n*1 vector with left end of intervals (min is 0).

rt

n*1 vector with right end of intervals.

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).

quant_r

Quantiles of time to use in constructing the spline, pass in if doing bootstrap.

nKnots

Number of knots to use for cubic spline basis (default is 1).

Examples

Run this code
set.seed(0)
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)
make_IC_dmat(xMat = xMat, lt = lt, rt = rt, obs_ind = obs_ind, tpos_ind = tpos_ind)

Run the code above in your browser using DataLab