R/survModel.R

Defines functions survModel

Documented in survModel

#' Survival model for simulation
#' 
#' Create a survival model to simulate a right censored event time data without
#' covariates
#' 
#' This function requires the \code{lava} package.
#' 
#' @return A structural equation model initialized with three variables: the
#' latent event time, the latent right censored time, and the observed
#' right censored event time.
#' @author Thomas A. Gerds <tag@@biostat.ku.dk>
#' @export 
survModel <- function(){
    ## require(lava)
    sm <- lava::lvm(~eventtime+censtime)
    lava::distribution(sm,"eventtime") <- lava::coxWeibull.lvm(scale=1/100)
    lava::distribution(sm,"censtime") <- lava::coxWeibull.lvm(scale=1/100)
    sm <- lava::eventTime(sm,time~min(eventtime=1,censtime=0),"event")
    sm
}

Try the prodlim package in your browser

Any scripts or data that you put into this service are public.

prodlim documentation built on June 24, 2024, 5:08 p.m.