R/getNullModel.R

Defines functions getNullModel

getNullModel <- function(formula,data,response.type){
    nullform <- stats::reformulate("1",response=formula[[2]])
    nullfit <- switch(response.type,
                      "binary"={
                          list("Null model"=stats::glm(nullform,data,family="binomial"))
                      },
                      "continuous"={
                          stop("FIXME: Need to adapt a function for the empirical distribution function or glm.")
                      },
                      "survival"={
                          list("Null model"=prodlim::prodlim(nullform,data))
                      },
                      "competing.risks"={
                          list("Null model"=prodlim::prodlim(nullform,data))
                      })
    nullfit[[1]]$call$data <- NULL
    nullfit[[1]]$formula <- NULL
    nullfit[[1]]$call$formula=nullform
    nullfit
}
  

Try the riskRegression package in your browser

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

riskRegression documentation built on Jan. 13, 2021, 11:12 a.m.