Nothing
### coxCenter.R ---
#----------------------------------------------------------------------
## Author: Thomas Alexander Gerds
## Created: Apr 27 2025 (07:31)
## Version:
## Last-Updated: Apr 27 2025 (07:31)
## By: Thomas Alexander Gerds
## Update #: 1
#----------------------------------------------------------------------
##
### Commentary:
##
### Change Log:
#----------------------------------------------------------------------
##
### Code:
# {{{ coxCenter
## * coxCenter
#' @title Extract the mean value of the covariates
#' @description Extract the mean value of the covariates
#' @name coxCenter
#' @param object The fitted Cox regression model object either
#' obtained with \code{coxph} (survival package), \code{cph}
#' (rms package), or \code{phreg} (mets package).
#'
#' @author Brice Ozenne broz@@sund.ku.dk
#' @rdname coxCenter
#' @export
coxCenter <- function(object){
UseMethod("coxCenter")
}
## ** coxCenter.cph
#' @rdname coxCenter
#' @method coxCenter cph
#' @export
coxCenter.cph <- function(object){
return(setNames(object$means, object$mmcolnames))
}
## ** coxCenter.coxph
#' @rdname coxCenter
#' @method coxCenter coxph
#' @export
coxCenter.coxph <- function(object){
return(setNames(object$means, names(coef(object))))
}
## ** coxCenter.phreg
#' @rdname coxCenter
#' @method coxCenter phreg
#' @export
coxCenter.phreg <- function(object){
return(apply(object$X,2,mean))
}
# }}}
######################################################################
### coxCenter.R ends here
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.