Commit c7696e2a authored by Andreas Tille's avatar Andreas Tille

New upstream version 2.2-7

parent 6c805705
This diff is collapsed.
Package: cmprsk
Version: 2.2-7
Date: 2014-jun-17
Title: Subdistribution Analysis of Competing Risks
Author: Bob Gray <gray@jimmy.harvard.edu>
Maintainer: Bob Gray <gray@jimmy.harvard.edu>
Depends: R (>= 2.15.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
incidence of a competing risk, Ann. Stat. 16:1141-1154, and Fine JP and
Gray RJ (1999), A proportional hazards model for the subdistribution
of a competing risk, JASA, 94:496-509.
License: GPL (>= 2)
URL: http://www.r-project.org
Packaged: 2014-06-17 18:45:38 UTC; gray
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2014-06-17 23:16:43
94d55d512a9ba36caa9b7df079bae19f *COPYING
024326158b9ee181904ce0688bb35ad0 *DESCRIPTION
25e59606a24d9d76dd829a09d9a90c54 *NAMESPACE
3e0e744d860b0ba3098fbcc8238e053e *R/cmprsk.R
ab1f8f638eba7c7a13db3225977589a3 *man/crr.Rd
8e35bb36130364553fcd0d80d18283c1 *man/cuminc.Rd
9aa901885ef9cb0653c5ad154cb08735 *man/extract.cuminc.Rd
6fa0c161e6dd9b2b9db731b70b2fa3bf *man/plot.cuminc.Rd
d055318772f89bf1d6ce0c14d5d63331 *man/plot.predict.crr.Rd
e1377154ce50530a986b51d422d50424 *man/predict.crr.Rd
9eee30941b7ba829928c199fb50e16f6 *man/print.crr.Rd
446fe5bacfb526891869147d40563bf6 *man/print.cuminc.Rd
6fc86389f06d65ca888dc40e8961b225 *man/summary.crr.Rd
3d843553233387c43d273a8f721722bb *man/timepoints.Rd
c53028d318cc93d99254bb7be508b04c *src/cincsub.f
abcc0f1aca5c56602513cfb1451bd19a *src/crr.f
d02825e3238b85f763cea36899825634 *src/crstm.f
a5c0126cbcc253811db0e486915e6ca9 *src/tpoi.f
ffcf7be80bea500c4f61cc8bd37fee03 *tests/Rplots.ps
8c8e6e952b759046af69be4d750bdc63 *tests/test.R
63a0169768e776a0776a040d826c2116 *tests/test.Rout.save
# Export all names
# exportPattern(".")
useDynLib(cmprsk)
export("crr","summary.crr","print.summary.crr","predict.crr",
"plot.predict.crr","print.crr","cuminc","print.cuminc","timepoints",
"plot.cuminc","[.cuminc")
#export("crr","cuminc","timepoints")
# Import all packages listed as Imports or Depends
import(
survival
)
S3method(summary,crr)
S3method(print,crr)
S3method(print,summary.crr)
S3method(predict,crr)
S3method(print,cuminc)
S3method(plot,cuminc)
S3method('[',cuminc)
S3method(plot,predict.crr)
This diff is collapsed.
Notes on how this package can be tested.
────────────────────────────────────────
To run the unit tests provided by the package you can do
sh run-unit-test
in this directory.
r-cran-cmprsk (2.2-7-2) unstable; urgency=medium
* Make test more tolerant against different output to compare with
* cme fix dpkg-control
-- Andreas Tille <tille@debian.org> Fri, 29 Apr 2016 09:10:40 +0200
r-cran-cmprsk (2.2-7-1) unstable; urgency=low
* Initial release (closes: #799920)
-- Andreas Tille <tille@debian.org> Thu, 24 Sep 2015 11:22:20 +0200
Source: r-cran-cmprsk
Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>
Uploaders: Andreas Tille <tille@debian.org>
Section: gnu-r
Testsuite: autopkgtest
Priority: optional
Build-Depends: debhelper (>= 9),
cdbs,
r-base-dev,
r-cran-survival
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/viewvc/debian-med/trunk/packages/R/r-cran-cmprsk/trunk/
Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/R/r-cran-cmprsk/trunk/
Homepage: https://cran.r-project.org/web/packages/cmprsk/
Package: r-cran-cmprsk
Architecture: any
Depends: ${shlibs:Depends},
${R:Depends},
r-cran-survival
Description: GNU R subdistribution analysis of competing risks
This GNU R package supports 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 incidence
of a competing risk.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cmprsk
Upstream-Contact: Bob Gray <gray@jimmy.harvard.edu>
Source: http://cran.r-project.org/src/contrib/
Files: *
Copyright: 1998-2014 Bob Gray <gray@jimmy.harvard.edu>
License: GPL-2+
Files: debian/*
Copyright: 2015 Andreas Tille <tille@debian.org>
License: GPL-2+
License: GPL-2+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General Public
License can be found in `/usr/share/common-licenses/GPL'.
debian/README.test
debian/tests/run-unit-test
tests
#!/usr/bin/make -f
include /usr/share/R/debian/r-cran.mk
Tests: run-unit-test
Depends: @
Restrictions: allow-stderr
#!/bin/sh -e
pkg=r-cran-cmprsk
# The saved result files do contain some differences in metadata and we also
# need to ignore version differences of R
filter() {
grep -v -e '^R version' \
-e '^Copyright (C)' \
-e '^Platform: ' \
-e '^ISBN 3' \
-e '[Bb]uggy version of Kinderman-Ramage generator use' \
-e '^Loading required package: splines' \
$1 | \
sed '/^> *proc\.time()$/,$d'
}
if [ "$ADTTMP" = "" ] ; then
ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $ADTTMP
cp /usr/share/doc/${pkg}/tests/* $ADTTMP
find . -name "*.gz" -exec gunzip \{\} \;
for htest in `ls *.R | sed 's/\.R$//'` ; do
LC_ALL=C R --no-save < ${htest}.R 2>&1 | tee > ${htest}.Rout
filter ${htest}.Rout.save > ${htest}.Rout.save_
filter ${htest}.Rout > ${htest}.Rout_
diff -u ${htest}.Rout.save_ ${htest}.Rout_
if [ ! $? ] ; then
echo "Test ${htest} failed"
exit 1
else
echo "Test ${htest} passed"
fi
done
rm -f $ADTTMP/*
exit 0
Reference:
Author: Jason P. Fine and Robert J. Gray
Title: "A proportional hazards model for the subdistribution of a competing risk"
Journal: J Am Stat Assoc
Year: 1999
Volume: 94
Number: 446
Pages: 496-509
DOI: 10.2307/2670170
URL: http://www.tandfonline.com/doi/abs/10.1080/01621459.1999.10474144
version=3
http://cran.r-project.org/src/contrib/cmprsk_([-\d.]*)\.tar\.gz
\name{crr}
\alias{crr}
\title{
Competing Risks Regression
}
\description{
regression modeling of subdistribution functions in competing risks
}
\usage{
crr(ftime, fstatus, cov1, cov2, tf, cengroup, failcode=1, cencode=0,
subset, na.action=na.omit, gtol=1e-06, maxiter=10, init, variance=TRUE)
}
\arguments{
\item{ftime}{
vector of failure/censoring times
}
\item{fstatus}{
vector with a unique code for each failure type and a separate code for
censored observations
}
\item{cov1}{
matrix (nobs x ncovs) of fixed covariates (either cov1, cov2, or both
are required)
}
\item{cov2}{
matrix of covariates that will be multiplied by functions of time;
if used, often these covariates would also appear in cov1
to give a prop hazards effect plus a time interaction
}
\item{tf}{
functions of time. A function that takes a vector of times as
an argument and returns a matrix whose jth column is the value of
the time function corresponding to the jth column of cov2 evaluated
at the input time vector. At time \code{tk}, the
model includes the term \code{cov2[,j]*tf(tk)[,j]} as a covariate.
}
\item{cengroup}{
vector with different values for each group with
a distinct censoring distribution (the censoring distribution
is estimated separately within these groups). All data in one group, if
missing.
}
\item{failcode}{
code of fstatus that denotes the failure type of interest
}
\item{cencode}{
code of fstatus that denotes censored observations
}
\item{subset}{
a logical vector specifying a subset of cases to include in the
analysis
}
\item{na.action}{
a function specifying the action to take for any cases missing any of
ftime, fstatus, cov1, cov2, cengroup, or subset.
}
\item{gtol}{
iteration stops when a function of the gradient is \code{< gtol}
}
\item{maxiter}{
maximum number of iterations in Newton algorithm (0 computes
scores and var at \code{init}, but performs no iterations)
}
\item{init}{
initial values of regression parameters (default=all 0)
}
\item{variance}{
If \code{FALSE}, then suppresses computation of the variance estimate
and residuals
}
}
\value{
Returns a list of class crr, with components
\item{$coef}{the estimated regression coefficients}
\item{$loglik}{log pseudo-liklihood evaluated at \code{coef}}
\item{$score}{derivitives of the log pseudo-likelihood evaluated at \code{coef}}
\item{$inf}{-second derivatives of the log pseudo-likelihood}
\item{$var}{estimated variance covariance matrix of coef}
\item{$res}{matrix of residuals giving the
contribution to each score (columns) at each unique failure time
(rows)}
\item{$uftime}{vector of unique failure times}
\item{$bfitj}{jumps in the Breslow-type estimate of the underlying
sub-distribution cumulative hazard (used by predict.crr())}
\item{$tfs}{the tfs matrix (output of tf(), if used)}
\item{$converged}{TRUE if the iterative algorithm converged}
\item{$call}{The call to crr}
\item{$n}{The number of observations used in fitting the model}
\item{$n.missing}{The number of observations removed from the input data
due to missing values}
\item{$loglik.null}{The value of the log pseudo-likelihood when all the
coefficients are 0}
\item{$invinf}{- inverse of second derivative matrix of the log pseudo-likelihood}
}
\details{
Fits the 'proportional subdistribution hazards' regression model
described in Fine and Gray (1999). This model directly assesses the
effect of covariates on the subdistribution of a particular type of
failure in a competing risks setting. The method implemented here is
described in the paper as the weighted estimating equation.
While the use of model formulas is not supported, the
\code{model.matrix} function can be used to generate suitable matrices
of covariates from factors, eg
\code{model.matrix(~factor1+factor2)[,-1]} will generate the variables
for the factor coding of the factors \code{factor1} and \code{factor2}.
The final \code{[,-1]} removes the constant term from the output of
\code{model.matrix}.
The basic model assumes the subdistribution with covariates z is a
constant shift on the complementary log log scale from a baseline
subdistribution function. This can be generalized by including
interactions of z with functions of time to allow the magnitude of the
shift to change with follow-up time, through the cov2 and tfs
arguments. For example, if z is a vector of covariate values, and uft
is a vector containing the unique failure times for failures of the
type of interest (sorted in ascending order), then the coefficients a,
b and c in the quadratic (in time) model
\eqn{az+bzt+zt^2}{a*z+b*z*t+c*z*t*t} can be fit
by specifying \code{cov1=z}, \code{cov2=cbind(z,z)},
\code{tf=function(uft) cbind(uft,uft*uft)}.
This function uses an estimate of the survivor function of the
censoring distribution to reweight contributions to the risk sets for
failures from competing causes. In a generalization of the methodology
in the paper, the censoring distribution can be estimated separately
within strata defined by the cengroup argument. If the censoring
distribution is different within groups defined by covariates in the
model, then validity of the method requires using separate estimates of
the censoring distribution within those groups.
The residuals returned are analogous to the Schoenfeld residuals in
ordinary survival models. Plotting the jth column of res against the
vector of unique failure times checks for lack of fit over time in the
corresponding covariate (column of cov1).
If \code{variance=FALSE}, then %\code{predict.crr} cannot be used and
some of the functionality in \code{summary.crr} and \code{print.crr}
will be lost. This option can be useful in situations where crr is
called repeatedly for point estimates, but standard errors are not
required, such as in some approaches to stepwise model selection.
}
\references{
Fine JP and Gray RJ (1999) A proportional hazards model for the
subdistribution of a competing risk. JASA 94:496-509.
}
\seealso{
\code{\link{predict.crr}} \code{\link{print.crr}} \code{\link{plot.predict.crr}}
\code{\link{summary.crr}}
}
\examples{
# simulated data to test
set.seed(10)
ftime <- rexp(200)
fstatus <- sample(0:2,200,replace=TRUE)
cov <- matrix(runif(600),nrow=200)
dimnames(cov)[[2]] <- c('x1','x2','x3')
print(z <- crr(ftime,fstatus,cov))
summary(z)
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)
# quadratic in time for first cov
crr(ftime,fstatus,cov,cbind(cov[,1],cov[,1]),function(Uft) cbind(Uft,Uft^2))
#additional examples in test.R
}
\keyword{survival}
\name{cuminc}
\alias{cuminc}
\title{
Cumulative Incidence Analysis
}
\description{
Estimate cumulative incidence functions from competing risks
data and test equality across groups
}
\usage{
cuminc(ftime, fstatus, group, strata, rho=0, cencode=0,
subset, na.action=na.omit)
}
\arguments{
\item{ftime}{
failure time variable
}
\item{fstatus}{
variable with distinct codes for different causes of failure
and also a distinct code for censored observations
}
\item{group}{
estimates will calculated within groups given by distinct values of this
variable. Tests will compare these groups. If missing then treated as all
one group (no test statistics)
}
\item{strata}{
stratification variable. Has no effect on estimates. Tests will be
stratified on this variable. (all data in 1 stratum, if missing)
}
\item{rho}{
Power of the weight function used in the tests.
}
\item{cencode}{
value of fstatus variable which indicates the failure time is censored.
}
\item{subset}{
a logical vector specifying a subset of cases to include in the
analysis
}
\item{na.action}{
a function specifying the action to take for any cases missing any of
ftime, fstatus, group, strata, or subset.
}
}
\value{
A list with components giving the subdistribution estimates for each
cause in each group, and a component \code{Tests} giving the test
statistics and p-values for comparing the subdistribution for each cause
across groups (if the
number of groups is \eqn{>}{>}1). The components giving the estimates
have names that are a combination
of the group name and the cause code.
These components are also lists, with components
\item{\code{time}}{ the times
where the estimates are calculated}
\item{\code{est}}{the estimated
sub-distribution functions. These are step functions (all corners
of the steps given), so they can be plotted using ordinary lines() commands.
Estimates at particular times can be located using the timepoints()
function.}
\item{\code{var}}{the estimated variance of
the estimates, which are estimates of the asymptotic
variance of Aalen (1978). }
}
\references{
Gray RJ (1988) A class of K-sample tests for comparing the cumulative
incidence of a competing risk, ANNALS OF STATISTICS, 16:1141-1154.
Kalbfleisch and Prentice (1980) THE ANALYSIS OF FAILURE TIME DATA, p 168-9.
Aalen, O. (1978) Nonparametric estimation of partial transition
probabilities in multiple decrement models, ANNALS OF STATISTICS,
6:534-545.
}
\author{Robert Gray}
\seealso{
\code{\link{plot.cuminc}} \code{\link{timepoints}} \code{\link{print.cuminc}}
}
\examples{
set.seed(2)
ss <- rexp(100)
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))
plot(xx,lty=1,color=1:6)
# see also test.R, test.out
}
\keyword{survival}
\name{[.cuminc}
\alias{[.cuminc}
\title{
Subset method for lists of class cuminc
}
\description{
A subset method that preserves the class of objects of class cuminc,
allowing a subset of the curves to be selected.
}
\usage{
\method{[}{cuminc}(x,i,\ldots)
}
\arguments{
\item{x}{object of class cuminc}
\item{i}{elements to extract}
\item{...}{not used}
}
\value{
A list with selected components of \code{x}, with the class set to
cuminc so cuminc methods can be applied.
}
\seealso{
\code{\link{cuminc}} \code{\link{plot.cuminc}} \code{\link{print.cuminc}}
}
\keyword{survival}
\name{plot.cuminc}
\alias{plot.cuminc}
\title{
Create Labeled Cumulative Incidence Plots
}
\description{
Plot method for cuminc. Creates labeled line plots from appropriate
list input, for example, the output from \code{cuminc()}.
}
\usage{
\method{plot}{cuminc}(x, main=" ", curvlab, ylim=c(0, 1), xlim, wh=2,
xlab="Years", ylab="Probability", lty=1:length(x), color=1, lwd=par('lwd'),
\dots)
}
\arguments{
\item{x}{
a list, with each component representing one curve in the plot. Each
component of \code{x} is itself a list whose first component gives the x values
and 2nd component the y values to be plotted. Although written for
cumulative incidence curves, can in principle be used for any set of lines.
}
\item{main}{
the main title for the plot.
}
\item{curvlab}{
Curve labels for the plot. Default is \code{names(x)}, or if that is missing,
\code{1:nc}, where \code{nc} is the number of curves in \code{x}.
}
\item{ylim}{
yaxis limits for plot
}
\item{xlim}{
xaxis limits for plot (default is 0 to the largest time in any of the
curves)
}
\item{wh}{
if a vector of length 2, then the upper right coordinates of the
legend; otherwise the legend is placed in the upper right corner of
the plot
}
\item{xlab}{
X axis label
}
\item{ylab}{
y axis label
}
\item{lty}{
vector of line types. Default \code{1:nc} (\code{nc} is the number of
curves in \code{x}). For color displays, \code{lty=1, color=1:nc}, might
be more appropriate. If \code{length(lty)<nc}, then \code{lty[1]} is
used for all.
}
\item{color}{
vector of colors. If \code{length(color)<nc}, then the \code{color[1]} is
used for all.
}
\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{
No value is returned.
}
\seealso{ \code{\link{cuminc}} }
%\examples{
%#see help(cuminc)
%}
\keyword{survival}
\keyword{hplot}
% Converted by Sd2Rd version 1.10.
\name{plot.predict.crr}
\alias{plot.predict.crr}
\title{
Plot estimated subdistribution functions
}
\description{
plot method for \code{predict.crr}
}
\usage{
\method{plot}{predict.crr}(x, lty=1:(ncol(x)-1), color=1,
ylim=c(0, max(x[, -1])), xmin=0, xmax=max(x[, 1]), \dots)
}
\arguments{
\item{x}{
Output from \code{predict.crr}
}
\item{lty}{
vector of line types. If length is \eqn{<}{<} \# curves, then
\code{lty[1]} is used for all.
}
\item{color}{
vector of line colors. If length is \eqn{<}{<} \# curves, then
\code{color[1]} is used for all.
}
\item{ylim}{
range of y-axis (vector of length two)
}
\item{xmin}{
lower limit of x-axis (often 0, the default)
}
\item{xmax}{
upper limit of x-axis
}
\item{...}{
Other arguments to plot
}}
\section{Side Effects}{
plots the subdistribution functions estimated by \code{predict.crr}, by
default using a different line type for each curve
}
\seealso{
\code{\link{crr}} \code{\link{predict.crr}}
}
\keyword{survival}
% Converted by Sd2Rd version 1.10.
\name{predict.crr}
\alias{predict.crr}
\title{
Estimate subdistribution functions from crr output
}
\description{
predict method for crr
}
\usage{
\method{predict}{crr}(object, cov1, cov2, \dots)
}
\arguments{
\item{object}{
output from crr
}
\item{cov1, cov2}{
each row of cov1 and cov2 is a set of covariate values where the
subdistribution should be estimated. The columns of cov1 and cov2 must
be in the same order as in the original call to crr. Each must be
given if present in the original call to crr.
}
\item{...}{
additional arguments are ignored (included for compatibility with generic).
}
}
\value{
Returns a matrix with the unique type 1 failure times in the first
column, and the other columns giving the estimated subdistribution
function corresponding to the covariate combinations in the rows of cov1
and cov2, at each failure time (the value that the estimate jumps to at
that failure time).
}
\details{
Computes \eqn{1-\exp(-B(t))}{1-exp(-B(t))}, where \eqn{B(t)}{B(t)} is
the estimated cumulative
sub-distribution hazard obtained for the specified covariate values,
obtained from the Breslow-type estimate of the underlying hazard and
the estimated regression coefficients.
}
\seealso{
\code{\link{crr}} \code{\link{plot.predict.crr}}
}
\keyword{survival}
% Converted by Sd2Rd version 1.10.
\name{print.crr}
\alias{print.crr}
\title{
prints summary of a crr object
}
\description{
print method for crr objects
}
\usage{
\method{print}{crr}(x, \dots)
}
\arguments{
\item{x}{
crr object (output from \code{crr()})
}
\item{...}{additional arguments to \code{print()}}
}
\details{
prints the convergence status, the estimated coefficients, the
estimated standard errors, and the two-sided p-values for the test of
the individual coefficients equal to 0. (If convergence is false
everything else may be meaningless.)
}
\seealso{
\code{\link{crr}}
}
\keyword{survival}
% Converted by Sd2Rd version 1.10.
\name{print.cuminc}
\alias{print.cuminc}
\title{Print cuminc objects}
\description{
A print method for objects of class cuminc (output from \code{cuminc()}).
}
\usage{
\method{print}{cuminc}(x, ntp=4, maxtime, \dots)
}
\arguments{
\item{x}{an object of class cuminc}
\item{ntp}{number of timepoints where estimates are printed}
\item{maxtime}{the maximum timepoint where values are printed. The
default is the maximum time in the curves in \code{x}}
\item{...}{additional arguments to \code{print()}}
}
\details{
Prints the test statistics and p-values (if present in \code{x}), and for each
estimated cumulative incidence curve prints its value and estimated
variance at a vector of times. The times are chosen between 0 and
maxtime using the \code{pretty()} function.
}
\author{Robert Gray}
\seealso{ \code{\link{cuminc}} }
%\examples{
%#see help(cuminc)
%}
\keyword{survival }%-- one or more ...
\name{summary.crr}
\alias{summary.crr}
\alias{print.summary.crr}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Summary method for crr}
\description{
Generate and print summaries of crr output
}
\usage{
\method{summary}{crr}(object, conf.int = 0.95, digits =
max(options()$digits - 5, 2), ...)
\method{print}{summary.crr}(x, digits = max(options()$digits - 4, 3), ...)
}
\arguments{
\item{object}{ An object of class crr (output from the crr function) }
\item{conf.int}{the level for a two-sided confidence interval on the
coeficients. Default is 0.95. }
\item{digits}{ In \code{summary.crr}, \code{digits} determines the number of