TABLE OF CONTENTS


methodsUni/cleanunirecoutput [ Functions ]

NAME

    cleanunirecoutput --- clean output of bivrec.agdata

FUNCTION

Construct the unirec object by removing references to the second dummy process needed by bivrec.agdata during the fitting, and restore the original stratum, process, cluster and subject names that were stripped by unirec.formula

SYNOPSIS

204 cleanunirecoutput <- function(fit, clusternames, subjnames, stratnames, processname)

INPUTS

    fit            a fit returned by unirec.agdata
    clusternames   vector of original cluster IDs
    subjnames      vector of original subject IDs
    stratnames     vector of original stratum IDs
    processnames   vector of original process IDs

OUTPUTS

    an object of class unirec, with properly named components

SOURCE

207 {
208     out <- NULL
209     out$call <- fit$call
210     # regression
211     out$regression = list(coefficients = fit$regressionoutput$betahat,
212                         loglik = fit$regressionoutput$loglik1)
213     # frailties
214     clust <- fit$frailtyoutput$Uihat
215     subj <- fit$frailtyoutput$Uijhat
216     names(clust) <- clusternames
217     names(subj) <- subjnames
218     out$frailty = list(clust = clust, subj = subj)
219     # dispersion
220     disp <- list(clust = fit$dispparams$sigma2hat, subj = fit$dispparams$nu2hat)
221     out$dispersion <- disp
222     # baseline
223     breaks <- fit$regressionoutput$as
224     basehaz <- fit$regressionoutput$alphars
225     rownames(breaks) <- rownames(basehaz) <- stratnames
226     out$hazard = list(breaks = breaks, hazard = basehaz)
227     # summaries
228     summary.reg <- fit$summary.reg[, 1:3]
229     colnames(summary.reg) <- c("coef", "sd", "pval")
230     summary.disp <- fit$summary.disp[c(1, 3)]
231     names(summary.disp) <- c("clust", "subj")
232     out$summaries <- list(regression = summary.reg, dispersion = summary.disp)
233     attr(out, "processname") <- processname
234     class(out) <- "unirec"
235     return(out)
236 }