##generic functions print.CE=function(object,...){ cat("\n") cat("Call:\n") print(object$call) cat("\n") beta=object$beta var=object$var t=object$t y=object$y w=object$w varnames=object$varnames se=sqrt(diag(var)) pv=2*(1-pnorm(abs(beta/se))) cat("Proportional mean regression models for composite endpoint\n (Mao and Lin, 2016, Biostatistics):\n\n") K=length(w) weight=matrix(w,1,K) rownames(weight)="Weight" colnames(weight)=rep(" ",K) colnames(weight)[1]="Event 1 (Death)" for (k in 2:K){ colnames(weight)[k]=paste("Event",k) } print(weight) cat("\n\n") cat("Newton-Raphson algorithm converges in", object$i,"iterations.\n\n") table=cbind(Estimate = beta, StdErr = se, z.value = beta/se, p.value = pv) colnames(table)=c("Estimate","se","z.value","p.value") rownames(table)=varnames cat("Estimates for Regression parameters:\n\n") printCoefmat(table, P.value=TRUE, has.Pvalue=TRUE) cat("\n") cat("\n") za=qnorm(0.975) MR=cbind(exp(beta),exp(beta-za*se),exp(beta+za*se)) colnames(MR)=c("Mean Ratio","95% lower CL","95% higher CL") rownames(MR)=varnames cat("Point and interval estimates for for mean ratios:\n\n") print(MR) cat("\n") } plot.CE=function(object,z,xlab="Time", ylab="Mean function",lty=1,frame.plot=F,add=F, ...){ beta=object$beta var=object$var t=object$t y=object$y mf=exp(sum(beta*z))*y if (add==F){ plot(stepfun(t,c(0,mf)),do.point=F, lty=lty,xlab=xlab,ylab=ylab,frame.plot=frame.plot,...) }else{ lines(stepfun(t,c(0,mf)),do.point=F,lty=lty,...) } }