Skip to content

Commit

Permalink
version 2.1-7
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Gray authored and gaborcsardi committed Dec 24, 2006
1 parent f855fd1 commit 13a516e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 54 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: cmprsk
Version: 2.1-5
Date: 2004-oct-6
Version: 2.1-7
Date: 2006-dec-24
Title: Subdistribution Analysis of Competing Risks
Author: Bob Gray <[email protected]>
Maintainer: Bob Gray <[email protected]>
Depends: R (>= 1.4.0), survival
Depends: R (>= 1.9.0), survival
Description: Estimation, testing and regression modeling of
subdistribution functions in competing risks, as described in Gray
(1988), A class of K-sample tests for comparing the cumulative
Expand All @@ -13,4 +13,4 @@ Description: Estimation, testing and regression modeling of
of a competing risk, JASA, 94:496-509.
License: GPL version 2 or newer
URL: http://www.r-project.org, http://biowww.dfci.harvard.edu/~gray
Packaged: Wed Oct 6 10:33:45 2004; gray
Packaged: Sun Dec 24 12:16:26 2006; gray
14 changes: 11 additions & 3 deletions R/cmprsk.R
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ timepoints <- function(w,times) {
}

plot.cuminc <- function(x,main=" ",curvlab,ylim=c(0,1),xlim,wh=2,xlab="Years",
ylab="Probability",lty=1:length(x),color=1,...) {
ylab="Probability",lty=1:length(x),color=1,lwd = par('lwd'),...) {
# x is a list containing curves to be plotted. Each component of
# x is a list with the first component containing the x values
# and the second component the y values. main = main title in the plot
Expand All @@ -369,6 +369,7 @@ ylab="Probability",lty=1:length(x),color=1,...) {
if (!is.null(x$Tests)) x <- x[names(x) != 'Tests']
nc <- length(x)
if (length(lty) < nc) lty <- rep(lty[1],nc) else lty <- lty[1:nc]
if (length(lwd) < nc) lwd <- rep(lwd[1],nc) else lwd <- lwd[1:nc]
if (length(color) < nc) color <- rep(color[1],nc) else color <- color[1:nc]
if (missing(curvlab)) {
if (mode(names(x))=="NULL") {
Expand All @@ -387,8 +388,15 @@ ylab="Probability",lty=1:length(x),color=1,...) {
if (length(wh) != 2) {
wh <- c(xlim[1],ylim[2])
}
legend(wh[1],wh[2],legend=curvlab,col=color,lty=lty,bty="n",bg=-999999,...)
u <- list(...)
if (length(u)>0) {
i <- pmatch(names(u),names(formals(legend)),0)
do.call('legend',c(list(x=wh[1],y=wh[2],legend=curvlab,col=color,lty=lty,lwd=lwd,bty="n",bg=-999999),u[i>0]))
} else {
do.call('legend',list(x=wh[1],y=wh[2],legend=curvlab,col=color,lty=lty,lwd=lwd,bty="n",bg=-999999))
}
# legend(wh[1],wh[2],legend=curvlab,col=color,lty=lty,bty="n",bg=-999999,...)
for (i in 1:nc) {
lines(x[[i]][[1]],x[[i]][[2]],lty=lty[i],col=color[i],...)
lines(x[[i]][[1]],x[[i]][[2]],lty=lty[i],col=color[i],lwd=lwd[i],...)
}
}
23 changes: 0 additions & 23 deletions man/crr.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -129,34 +129,11 @@ ftime <- rexp(200)
fstatus <- sample(0:2,200,replace=TRUE)
cov <- matrix(runif(600),nrow=200)
print(z <- crr(ftime,fstatus,cov))
# convergence: TRUE
# coefficients:
# [1] 0.8470 -0.3473 -0.6913
# standard errors:
# [1] 0.4027 0.4402 0.4916
# two-sided p-values:
# [1] 0.035 0.430 0.160
# for failures of type 2
z.p <- predict(z,rbind(c(.1,.5,.8),c(.1,.5,.2)))
plot(z.p,lty=1,color=2:3)
crr(ftime,fstatus,cov,failcode=2)
# convergence: TRUE
# coefficients:
# [1] -0.4638 0.4896 0.2331
# standard errors:
# [1] 0.3896 0.4540 0.4256
# two-sided p-values:
# [1] 0.23 0.28 0.58
# quadratic in time for first cov
crr(ftime,fstatus,cov,cbind(cov[,1],cov[,1]),function(Uft) cbind(Uft,Uft^2))
# convergence: TRUE
# coefficients:
# [1] 1.3360 -0.3484 -0.6852 -1.1210 0.3897
# standard errors:
# [1] 0.8657 0.4405 0.4909 1.6860 0.6271
# two-sided p-values:
# [1] 0.12 0.43 0.16 0.51 0.53
#last 2 values are the coefs of the cov[,1]*t and cov[,1]*t^2 terms
#additional examples in test.R
}
\keyword{survival}
22 changes: 0 additions & 22 deletions man/cuminc.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,6 @@ gg <- factor(sample(1:3,100,replace=TRUE),1:3,c('a','b','c'))
cc <- sample(0:2,100,replace=TRUE)
strt <- sample(1:2,100,replace=TRUE)
print(xx <- cuminc(ss,cc,gg,strt))
#Tests:
# stat pv
#1 3.393977 0.1832345
#2 1.989511 0.3698139
#Estimates and Variances:
#$est
# 1 2 3 4 5
#a 1 0.1311269 0.2699184 0.3420625 0.3420625 0.3420625
#b 1 0.2176471 0.2615686 NA NA NA
#c 1 0.3816280 0.4889137 0.5723581 NA NA
#a 2 0.2257601 0.2972171 0.4415053 0.4415053 0.4415053
#b 2 0.3117647 0.5878431 NA NA NA
#c 2 0.2160508 0.2607532 0.2607532 NA NA
#
#$var
# 1 2 3 4 5
#a 1 0.003922836 0.009113464 0.012507959 0.01250796 0.01250796
#b 1 0.005528913 0.006916070 NA NA NA
#c 1 0.009854126 0.012351948 0.015575726 NA NA
#a 2 0.005947601 0.007356628 0.014479506 0.01447951 0.01447951
#b 2 0.007033454 0.010927780 NA NA NA
#c 2 0.006497566 0.007867543 0.007867543 NA NA
plot(xx,lty=1,color=1:6)
# see also test.R, test.out
}
Expand Down
8 changes: 6 additions & 2 deletions man/plot.cuminc.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ list input, for example, the output from \code{cuminc()}.
}
\usage{
plot.cuminc(x, main=" ", curvlab, ylim=c(0, 1), xlim, wh=2, xlab="Years",
ylab="Probability", lty=1:length(x), color=1, \dots)
ylab="Probability", lty=1:length(x), color=1, lwd=par('lwd'), \dots)
}
\arguments{
\item{x}{
Expand Down Expand Up @@ -53,7 +53,11 @@ used for all.
vector of colors. If \code{length(color)<nc}, then the \code{color[1]} is
used for all.
}
\item{...}{
\item{lwd}{
vector of line widths. If \code{length(lwd)<nc}, then \code{lwd[1]}
is used for all.
}
\item{...}{
additional arguments passed to the initial call of the plot function.
}}
\value{
Expand Down

0 comments on commit 13a516e

Please sign in to comment.