R/common.R

Defines functions splineResolution checkValidTimeCut

Documented in checkValidTimeCut splineResolution

# Some common functionality and constants

##' Sets the smoothing parameter, usally in (0,1]. 
##' 
##' @return The spline resolution
##' @export 
splineResolution <- function() {
  getOption('eventTools.spline.resolution', 0.5 )
}

##' Checks that the change point is ok
##' @param x EventModel object
##' @param y EventModelExtended object
checkValidTimeCut <- function( x, y ) {
  if( ( y@time.cut - max(x@event.data@subject.data$time, na.rm=T) ) > 2 ) {
    warning( paste0( "The change point should equal the largest time in the right censored model!", 
                     "That or all patients have had events! Regardless, this situation may result", 
                     "undefined behaviour!" ) )
  } 
}
scientific-computing-solutions/eventTools documentation built on May 29, 2019, 3:44 p.m.