TABLE OF CONTENTS


S3Methods/summary.splinesurv [ Functions ]

NAME

    summary.splinesurv --- creates an object of class summary.splinesurv

FUNCTION

Summarizes a splinesurv fit. See package documentation for details.

SYNOPSIS

3576 summary.splinesurv <- function(object, quantiles = c(.025, .975), ...)

SOURCE

3579 {
3580     x <- object
3581     out <- NULL
3582     #  Extract components of the fit that should be included in the summary
3583     out$call <- x$call
3584     out$coef <- as.matrix(x$posterior.mean$coefficients, ncol = 1)
3585     colnames(out$coef) <- "mean"
3586     out$iter <- x$control$iter
3587     out$burnin <- x$control$burnin
3588     out$hazard <- x$hazard
3589     out$frailty <- x$frailty
3590     # compute frailty variance using two estimators:
3591     # as the mean of the variances of the posterior densities
3592     fvar <- post.fvar(x, quantiles)
3593     # or as the variance of the posterior frailty samples
3594     fvar2 <- apply(x$history$frailty[(out$burnin + 1):out$iter, ], 1, var)
3595     out$frailty$spline.fvar <- fvar$mean["spline.fvar", ]
3596     out$frailty$param.fvar <- fvar$mean["param.fvar", ]
3597     out$frailty$fvar <- fvar$mean["fvar", ]
3598     out$frailty$fvar2 <- mean(fvar2)
3599     out$posterior.mean <- x$posterior.mean
3600     out$quantiles.coef <- NULL
3601     if(out$iter < out$burnin) out$burnin <- 0
3602     # Compute posterior quantiles of regression coefficients
3603     if(length(quantiles)){
3604         goodind <- (out$burnin + 1):(out$iter)
3605         goodcoef <- x$history$coefficients[goodind, ,drop = FALSE]
3606         for(q in quantiles){
3607             out$quantiles.coef <- cbind(out$quantiles.coef, 
3608                 apply(goodcoef, 2, function(x) quantile(x, q)))
3609         }
3610         # For presentation, make sure the colnames and rownames are nice
3611         colnames(out$quantiles.coef) <- paste(quantiles * 100, "%", sep = "")
3612         rownames(out$quantiles.coef) <- rownames(out$coef)
3613         out$quantiles.fvar <- fvar$quantiles
3614         out$quantiles.fvar2 <- quantile(fvar2, quantiles)
3615     }
3616     # save the dots for printing parameters
3617     out$dots <- as.list(substitute(list(...)))[ - 1]
3618     class(out) <- "summary.splinesurv"   
3619     return(out)
3620 }