#' Constructs survival matrix for use in applied data examples
#'
#' @param x covariates
#' @param nT number of unique times
#' @param intercept include an intercept?
#'
#' @return
#' @export
construct_interp_survival_matrix <- function(x, nT, intercept = FALSE) {
n <- nrow(x)
d <- ncol(x)
xmat <- matrix(0, nrow=n * nT, ncol = d * nT)
for(t in 1:nT) {
rows <- seq(1, n * nT, nT) + (t-1)
cols <- 1:d + (t-1) * d
xmat[rows, cols] <- x
}
if(intercept) xmat <- cbind(1,xmat)
return(xmat)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.