TABLE OF CONTENTS


methodsBiv/cleanbivrecoutput [ Functions ]

NAME

    cleanbivrecoutput --- clean output of bivrec.agdata

FUNCTION

Construct the bivrec object and restore the original stratum, process, cluster and subject names that were stripped by bivrec.formula

SYNOPSIS

280 cleanbivrecoutput <- function(fit, clusternames, subjnames, stratnames, processnames)

INPUTS

    fit            a fit returned by bivrec.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 bivrec, with properly named components

SOURCE

283 {
284     out <- NULL
285     out$call <- fit$call
286     # regression
287     out$regression = list(coefficients1 = fit$regressionoutput$betahat,
288                         coefficients2 = fit$regressionoutput$betadhat,
289                         loglik1 = fit$regressionoutput$loglik1,
290                         loglik2 = fit$regressionoutput$loglik2)
291     # frailties
292     clust1 <- fit$frailtyoutput$Uihat
293     clust2 <- fit$frailtyoutput$Vihat
294     subj1 <- fit$frailtyoutput$Uijhat
295     subj2 <- fit$frailtyoutput$Vijhat
296     names(clust1) <- names(clust2) <- clusternames
297     names(subj1) <- names(subj2) <- subjnames
298     out$frailty = list(clust1 = clust1, clust2 = clust2, subj1 = subj1, subj2 = subj2)
299     # dispersion
300     disp <- fit$dispparams
301     names(disp) <- c("clust1", "clust2", "subj1", "subj2", "cov")
302     out$dispersion <- disp
303     # baseline
304     breaks1 <- fit$regressionoutput$as
305     breaks2 <- fit$regressionoutput$asd
306     basehaz1 <- fit$regressionoutput$alphars
307     basehaz2 <- fit$regressionoutput$alpharsd
308     rownames(breaks1) <- rownames(breaks2) <- rownames(basehaz1) <- rownames(basehaz2) <- stratnames
309     out$hazard = list(breaks1 = breaks1, breaks2 = breaks2, 
310                     hazard1 = basehaz1, hazard2 = basehaz2)
311     # summaries
312     summary.reg <- fit$summary.reg
313     colnames(summary.reg) <- c("coef1", "sd1", "pval1", "coef2", "sd2", "pval2")
314     summary.disp <- fit$summary.disp
315     names(summary.disp) <- c("clust1", "clust2", "subj1", "subj2", "cov", "corr")
316     out$summaries <- list(regression = summary.reg, dispersion = summary.disp)
317     attr(out, "processnames") <- processnames
318     class(out) <- "bivrec"
319     return(out)
320 }