Package 'newTestSurvRec'

Title: Statistical Tests to Compare Curves with Recurrent Events
Description: Implements the routines to compare the survival curves with recurrent events, including the estimations of survival curves. The first model is a model for recurrent event, when the data are correlated or not correlated. It was proposed by Wang and Chang (1999) <doi:10.2307/2669690>. In the independent case, the survival function can be estimated by the generalization of the limit product model of Pena (2001) <doi:10.1198/016214501753381922>.
Authors: Dr Carlos Miguel Martinez Manrique
Maintainer: Carlos Martinez <[email protected]>
License: GPL (>= 2)
Version: 1.0.2
Built: 2024-12-04 07:25:18 UTC
Source: CRAN

Help Index


package newTestSurvRec

Description

package newTestSurvRec

Details

Recurrent events are common in many areas: psychology, engineering, medicine, physics, astronomy, biology, economics and so on. Such events are very common in the real world: viral diseases, carcinogenic tumors, machinery and equipment failures, births, murders, rain, industrial accidents, car accidents and so on. The availability of computerized tools for the analysis is indispensable. The survival analysis is a branch of statistics that allows us to model the time until the occurrence of an events. In general, the objectives of analysis are: the modeling of the survival function to estimate the risk or benefit of the occurrence of an event, the probability occurrence of this event and comparing population groups. The development of tools for the statistical analysis of recurrent event is relatively recent and are not fully known. The purpose of this package is to present statistical tests for the analysis of recurrent event data. Martinez et al. (2009) published a statistical test to compare survival curves of two groups with recurrent events. The hypothesis of the problem is:

Ho:S1(t)=S2(t)\bold{H_{o} : S_{1}(t) = S_{2}(t)}

H1:S1(t)S2(t)\bold{H_{1} : S_{1}(t) \neq S_{2}(t)}

Where, S1(t)S_{1}(t) and S2(t)S_{2}(t) are the survival curves of the both group. The statistic of test is,

Z=tzwz[ΔN(s,z;r)E{ΔN(s,z;r)}]tzwz2Var{ΔN(s,z;r)}Z=\frac{\sum^{\,}_{t\leq\,z}w_{z}\left[\Delta\,N(s,z;r)-E\left\{\Delta\,N(s,z;r)\right\} \right]}{\sqrt{\sum^{\,}_{t\leq\,z}w^{2}_{z}Var\left\{\Delta\,N(s,z;r) \right\}}}

The statistic Z has a normal asymptotic behavior. Its square has a chi-square approximate behavior with a degree of freedom. So,

ΔN(s,z;1)=N(s,z+Δz;1)N(s,z;1)\Delta\,N(s, z; 1) = N(s, z+\Delta\,z; 1) - N(s, z; 1)

Now, Δz\Delta\,z is approaches to zero and as ΔN(s,z;1)\Delta\,N(s, z; 1) has a hyper-geometric behavior and expected value is equal to

Y(s,z;1)ΔN(s,z)/Y(s,z)Y(s, z; 1)\Delta\,N(s, z)/Y(s, z)

and variance equal to,

Var[ΔN(s,z;1)]=Y(s,z)Y(s,z;1)Y(s,z)1Y(s,z;1)ΔN(s,z)Y(s,z)[1ΔN(s,z)Y(s,z)]Var\left[\Delta\,N(s, z; 1) \right]=\frac{Y(s,z)-Y(s,z;1)}{Y(s,z)-1}Y(s,z;1)\frac{\Delta\,N(s,z)}{Y(s,z)}\left[1-\frac{\Delta\,N(s,z)}{Y(s,z)}\right]

This author proposed various types of weights (wz)(w_{z}),

wz=[S(z)]γ[1S(z)]η[Y(s,z)]α[Y(s,z)+1]βw_{z}=\left[S(z)\right]^{\gamma}\left[1-S(z)\right]^{\eta}\frac{\left[Y(s,z)\right]^{\alpha}}{\left[Y(s,z)+1\right]^{\beta}}

The appropriate selection of weights depends on the behavior of the curves. With the selection of the values of the parameters (α,  β,  γ  and  η)(\alpha,\;\beta,\;\gamma\;and \;\eta), on the proposal, is possible adjust its behavior. With the proposal, we are able of make studies on survival analysis with recurrent events and generate tests for analysis others, including the classical tests type: logrank, Gehan, Peto-Peto, Fleming-Harrington and so on. Note that, if all parameters are zero, wz=1w_{z} = 1, its generates the test type logrank for recurrent events. If, α=1\alpha = 1 and the other parameters are zero wz=Y(s,z)w_{z} = Y(s,z), its generates the test type Gehan. If, γ=1\gamma=1 and the other parameters are zero wz=S(z)w_{z} = S(z), its generate the test of Peto-Peto. If, γ=1\gamma = 1 and η=1\eta = 1 and the rest of the parameters are zero, its generate Fleming-Harrington test. On the other hand, if you analyze the test statistical of comparison for recurrent events, it depends on the counting processes N and Y, which are doubles indexed. The index S measures calendar time and Z index measures the gap times. So, if the observation time tends to infinity and unity event study can only occur once in each unit and the statistical comparison becomes the weighted classical statistical comparison of groups of the survival analysis. We can conclude that test proposed by Martinez et al.(2009) are useful on diverse fields of research, such as: medicine, public health, insurance, social science, reliability and others.

Note

This package have some functions that them were originally performed by the survrec package, which solved the adjustment problem of the PSH and WC estimators using Fortran routines. With the permission of the author, Dr. Juan R. Gonzalez, the algorithm of base was taken, modified, the algorithm, WC estimator was reprogrammed and adapted to the needs of the newTestSurvRec package and thus avoid dependence. Thanks to Dr. Gonzalez

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.// Pena E., Strawderman R., Hollander, M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

See Also

Dif.Surv.Rec, Plot.Event, Rec,Plot.Surv. Rec, Print.Summary, Plot.Cusum.Events

Examples

##library(newTestSurvRec)
getOption("defaultPackages")
XL<-data(TBCplapyr)
XL
Plot.Event.Rec(TBCplapyr)
Dif.Surv.Rec(TBCplapyr,'all',1,1,0,0)
Print.Summary(TBCplapyr)

Re-hospitalization of patients with colorectal cancer

Description

This data set contains the re-hospitalization times of patients diagnosed with stage AB and patients diagnosed with stage C.

Usage

data(DataColonDukesABvsC)

Format

A data frame with 655 observations on the following 10 variables.

This data.frame contains the following columns

j

Observation number

Iden

identification of each subject. Repeated for each recurrence

id

identification of each subject. Repeated for each recurrence

Tinicio

Initial time of observation just before each recurrence

time

re-hospitalization o censoring gaptime

Tcal

re-hospitalization o censoring calendar time

event

censoring status. All event are 1 for each subject excepting last one that it is 0

chemoter

Did patient receive chemotherapy? 1: No or 2:Yes

dukes

Dukes tumor stage: 1:A-B or 2:C

distance

distance from living place to hospital 1:<=30 Km. or 2:>30 Km.

Details

The patients included in the study have been operated between January 1996 and December 1998. For each patient, we have considered this date as the beginning of the observational period. All patients were followed until June 2002. Consequently, the length of the monitoring period can differ for each patient, depending on its surgery date. The first inter occurrence time has been considered as the time between the surgical intervention and the first hospitalization related to cancer. Four hundred and three patients with colon and rectum cancer have been included in the study. Information about their sex (male or female), age ( 60, 60-74 or 75), and tumor stage using Dukes classification (A-B, C, or D) have been recorded. The following inter- occurrence times have been considered as the difference between the last hospitalization and the current one. Only re-admissions related to cancer have been considered.

Source

This data were obtained from Gonzalez, J.R. et al. (2009)

References

Martinez C., Ramirez, G., Vasquez M. (2009). Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.//Gonzalez, J.R., Fernandez, E., Moreno, V. et al. Gender differences in hospital readmission among colorectal cancer patients. Currently submited to J.C.O.

Examples

data(DataColonDukesABvsC)

Re-hospitalization of patients with colorectal cancer

Description

This data contains re-hospitalization times of patients diagnosed with stage AB and patients diagnosed with stage D.

Usage

data(DataColonDukesABvsD)

Format

A data frame with 527 observations on the following 10 variables

This data.frame contains the following columns:

j

Observation number

Iden

Observation of each subject. Repeated for each recurrence

id

Observation of each subject. Repeated for each recurrence

Tinicio

Initial time of observation just before each recurrence

time

re-hospitalization o censoring gaptime

Tcal

re-hospitalization o censoring calendar time

event

censoring status. All event are 1 for each subject excepting last one that it is 0

chemoter

Did patient receive chemotherapy? 1: No or 2:Yes

dukes

Dukes tumoral stage: 1:A-B or 3:D

distance

distance from living place to hospital 1:<=30 Km. or 2:>30 Km.

Details

See details on DataColonDukesABvs

Source

This data were obtained from Gonzalez, J. R. et al. (2009)

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.// Gonzalez, J.R., Fernandez, E., Moreno, V. et al. Gender differences in hospital readmission among colorectal cancer patients. Currently submited to J.C.O.

Examples

data(DataColonDukesABvsD)
XL<-data(DataColonDukesABvsD)
print(XL)

Rehospitalization of patients with colorectal cancer

Description

This data contains the re-hospitalization times of patients diagnosed with stage C and patients diagnosed with stage D

Usage

data(DataColonDukesCvsD)

Format

A data frame with 537 observations on the following 10 variables

This data.frame contains the following columns

j

Observation number

Iden

identification of each subject. Repeated for each recurrence

id

identification of each subject. Repeated for each recurrence

Tinicio

Initial time of observation just before each recurrence

time

re-hospitalization o censoring gaptime

Tcal

re-hospitalization o censoring calendar time

event

censoring status. All event are 1 for each subject excepting last one that it is 0

chemoter

Did patient receive chemotherapy? 1: No or 2:Yes

dukes

Dukes tumor stage: 2:C or 3:D

distance

distance from living place to hospital 1:<<=30 Km. or 2:>>30 Km.

Details

See details on DataColonDukesABvs

Source

This data were obtained from Gonzalez, J.R. et al. (2009)

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.//Gonzalez, J.R., Fernandez, E., Moreno, V. et al. Gender differences in hospital re-admission among colorectal cancer patients. Currently submited to J.C.O.

Examples

data(DataColonDukesCvsD)
XL<-data(DataColonDukesCvsD)
print(XL)

This function computes statistical difference between two survival curves

Description

p-values of these tests are computed.

Usage

Dif.Surv.Rec(XX, type, alfa, beta,gamma,eta)

Arguments

XX

Object type recurrent events data

type

"LRrec","Grec","TWrec","PPrec","PMrec","FHrec","CMrec","Mrec","all"

alfa

The appropriate choice, see wzw_{z}. Defect value is equal zero

beta

The appropriate choice, see wzw_{z}. Defect value is equal zero

gamma

The appropriate choice, see wzw_{z}. Defect value is equal zero

eta

The appropriate choice, see wzw_{z}. Defect value is equal zero

Details

This function contains tests to compare survival curves with recurrent events. The curves are estimated using Pena-Strawderman-Hollander or Wang-Chang estimator. GPLE or PSH model: Pena et al. (2001) defined an estimator of the survival function to recurrent events or Kaplan-Meier estimator GPLE. They used two counting processes N and Y. The PSH estimator was defined as,

S^(z)=tz[1ΔN(s,z)Y(s,z)]\hat{S}(z) =\prod_{t\leq\,z}\left[1-\frac{\Delta\,N\left(s,z\right)}{Y\left(s,z\right)}\right]

The authors considered two time scales: one related to calendar time (S) and other related to inter occurrences time (T). So, the counting process N(s, z) represents the number of observed events in the calendar period [0,s][0,s] with tzt\leq\,z and Y(s, z) represents the number of observed events in the period [0,s][0,s] with tzt\geq\,z. The product-limit estimator was developed by Pena, Strawderman and Hollander, called PSH. This estimator is useful when the inter occurrence times are assumed to represents IID sample from some underlying distribution F. The GPLE estimator is defined as: A fundamental assumption of this approach is that individuals have been previously and properly classified in groups according to a stratification variable denote by r. Thus, the estimator of the survival curve by each group is defined as,

S^r(z)=tz[1ΔN(s,z;r)Y(s,z;r)] ⁣r= ⁣1,2.\hat{S}_{r}(z) =\prod_{t\leq\,z}\left[1-\frac{\Delta\,N\left(s,z;r\right)}{Y\left(s,z;r\right)}\right]\!\nabla\:r\:=\!1,2.

WC model: Wang-Chang (1999) proposed an estimator of the common marginal survivor function in the case where within-unit inter occurrences times are correlated. The correlation structure considered by Wang and Chang (1999) is quite general and contains, the cases particular, both the i.i.d. and multiplicative frailty model as special cases. The WC estimator was defined using two new processes,dd^{*} and RR^{*}.

S^(t)=Tt[1d(Tk)R(Tk)]\hat{S}(t) =\prod_{T\leq\,t}\left[1-\frac{d^{*}\left(T_{k}\right)}{R^{*}\left(T_{k}\right)}\right]

The authors try take into account in the definition of NN and YY that an individual may have more than one event. In fact, this estimator has the same way as the GPLE estimator but using these two different processes. the index dd^{*} represents the sum of the proportion of individuals of the inter occurrences times which are equal to tt when there is at least one event. On the other hand, RR^{*} represents an average of the individuals that are at risk time tt, where for each individual the average is the number of failures or censored times at least equal to tt. This average is done regarding the number of events that there are to each individual and in case KK is 0 is divided by 1. For definition more formal see Martinez (2009) and Pena et. al (2001). The WC estimator of S eliminates the bias for the product-limit estimator developed by PSH (2001) when the inter occurrences times are correlated within units.However, when applied to i.i.d. inter occurrence times, this estimator is not expected to perform as well as the PSH estimator, especially with regard to efficiency.

Value

# Dif.Surv.Rec(TBCplapyr,"all",0,0,0,0). Values returned

Nomb.Est Chi.square p.value
LRrec 0.3052411 0.5806152
Grec 1.4448446 0.2293570
TWrec 0.9551746 0.3284056
PPrec 1.1322772 0.2872901
PMrec 1.1430319 0.2850126
PPrrec 1.1834042 0.2766641
HFrec 0.3052411 0.5806152
CMrec 0.3052411 0.5806152
Mrec 1.5298763 0.2161310

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.//Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.

See Also

Plot.Event.Rec, Plot.Surv.Rec, Print.Summary

Examples

data(TBCplapyr)
#Return the p-values of the all tests
Dif.Surv.Rec(TBCplapyr,"all",0,0,0,0)
#Return the p-value of the LRrec test
Dif.Surv.Rec(TBCplapyr)
#Return the p-value of the Grec test
Dif.Surv.Rec(TBCplapyr,"Grec")
#Return the p-values of the CMrec tests
#The CMrec test with this parameters generates LRrec test
Dif.Surv.Rec(TBCplapyr,"all",0,0,0,0)
#The CMrec test with this parameters generates Grec test
Dif.Surv.Rec(TBCplapyr,"all",0,0,1,0)
#The CMrec test with this parameters generates TWrec test
Dif.Surv.Rec(TBCplapyr,"all",0,0,0.5,0)

This function let to adjust the IDs the database

Description

This function let to adjust the ID's the database in case that it is not have the order numeric correct. Observation: this function only let to adjust the id variable not sort the rest of the data.

Usage

fit.Data.Survrecu(x)

Arguments

x

a database type dataframe

Value

Returns the correct numeric order for the dataframe

Note

The last id on each unit of the database to have be a censored data and the occurrences have that to precede to this last it.

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.//Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315

See Also

FitSurvRec, Survrecu, is.Survrecu

Examples

data(MMC.TestSurvRec)
ID<-fit.Data.Survrecu(Survrecu(MMC.TestSurvRec$id,MMC.TestSurvRec$time,
                               MMC.TestSurvRec$event))
ID
fit<-PSH.fit(Survrecu(ID,MMC.TestSurvRec$time,
                               MMC.TestSurvRec$event))
fit$time
fit$surv
plot(fit$time,fit$surv)

 
data(DataColonDukesABvsD)
XL<-data(DataColonDukesABvsD)
DataColonDukesABvsD$Iden
Y<-fit.Data.Survrecu(Survrecu(DataColonDukesABvsD$Iden,DataColonDukesABvsD$time,
                                  DataColonDukesABvsD$event))
Y
fit<-WC.fit(Survrecu(Y,DataColonDukesABvsD$time,DataColonDukesABvsD$event))
fit$time
fit$surv
plot(fit$time,fit$surv)
print(data.frame(time=fit$time,n.event=fit$n.event, 
                     Surv=fit$survfunc,std.error=fit$std.error))

Compute a Survival Curve for Recurrent Event Data given a variable of group

Description

Computes an estimate of a survival curve for recurrent event data using either the Pena, Strawderman and Hollanderor Wang and Chang estimators. It also computes the asymptotic standard errors. The resulting object of class Survrecu is plotted.

Usage

FitSurvRec(formula, data, type = "pena-strawderman-hollander", ...)

Arguments

formula

A formula object. If a formula object is supplied it must have a Survrecu object as the response on the left of the operatorand a term on the right. For a single survival curve as part of the formula is required.

data

a data frame in wich to interpret the variables named in the formula.

type

a character string specifying the type of survival curve. Possible value are "pena- strawderman-hollander" or "wang-chang". The default is "pena,-strawderman-hollander".

...

additional arguments passed to the type of estimator.

Details

See the help details of PSH.fit or WC.fit depending on the type chosen

Value

A FitSurvRec object. Methods defined for FitSurvRec objects are provided for print, lines and plot.

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.//Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315

See Also

is.Survrecu, Survrecu, PSH.fit, Plot.Event.Rec, Plot.Surv.Rec, Print.Summary

Examples

data(MMC.TestSurvRec)
# fit a PSH survival function and plot it
fitPSH<-FitSurvRec(Survrecu(id,time,event)~1,data=MMC.TestSurvRec)
plot(fitPSH$time,fitPSH$survfunc,type="s" ,ylim=c(0,1),
     xlim=c(0,max(fitPSH$time)))
title(main = list("Survival Curve with Recurrent Event Data", 
      cex = 0.8, font = 2.3, col = "dark blue"))
mtext("Research Group: AVANCE USE R!", cex = 0.7, font = 2, 
      col = "dark blue", line = 1)
mtext("Software made by: Dr. Carlos Martinez", cex = 0.6, font = 2, 
      col = "dark red", line = 0)
 
fitWC<-FitSurvRec(Survrecu(id,time,event)~1,data=MMC.TestSurvRec,
              type="wang-chang")
plot(fitWC$time,fitWC$survfunc,type="s" ,ylim=c(0,1),xlim=c(0,max(fitWC$time)))
  	  title(main = list("Survival Curve with Recurrent Event Data", 
       cex = 0.8, font = 2.3, col = "dark blue"))
        mtext("Research Group: AVANCE USE R!", cex = 0.7, font = 2, 
       col = "dark blue", line = 1)
        mtext("Software made by: Dr. Carlos Martinez", cex = 0.6, font = 2, 
       col = "dark red", line = 0)

This function verify if the formula type of survival recurrent is object type newTestSurvRec

Description

To verify if the create object type Survrecu is a formula model type newTestSurvRec

Usage

is.Survrecu(x)

Arguments

x

Object type formula of the class newTestSurvRec

Value

False

if the object is not type formula

True

if the object is type formula

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.// Pena E., Strawderman R., Hollander, M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315

See Also

FitSurvRec, Dif.Surv.Rec, Survrecu, FitSurvRec

Examples

data(MMC.TestSurvRec)
x<-Survrecu(MMC.TestSurvRec$id,MMC.TestSurvRec$time,MMC.TestSurvRec$event)~1
is.Survrecu(x)

Migratory Motor Complex

Description

This contains the Migratoty Motor Complex data

Usage

data(MMC.TestSurvRec)

Format

A data frame with 99 observations on the following 5 variables.

j

Number of the observation on dataset

id

ID of each subject. Repeated for each recurrence

time

recurrence o censoring time

event

censoring status. All event are 1 for each subject excepting last one that it is 0

group

A factor with levels Females Males

Details

The data correspond a study from the Section for Gastroenterology of Department of Internal Medicine, Ulleal University Hospital of Oslo.

Source

Husebye E, Skar V, Aalen O. and Osnes M (1990), Digestive Diseases and Sciences.

References

Husebye E, Skar V, Aalen O.O., Osnes M.(1990). Digital ambulatory manometry of the small intestine in healthy adults. Estimates of variation within and between individuals and statistical management of incomplete MMC periods. Digestive Diseases and Sciences.35:1057: 65.

Examples

data(MMC.TestSurvRec)
XL<-data(MMC.TestSurvRec)
print(XL)
Print.Summary(MMC.TestSurvRec)
## maybe str(MMC.TestSurvRec) ; plot(MMC.TestSurvRec) ...

Plot data with recurrent events

Description

This function plot data with recurrent events

Usage

Plot.Cusum.Events(yy, xy = 1, xf= 1, colevent = "blue", colcensor = "red",
                                             ltyx = 1, lwdx = 1)

Arguments

yy

Data type recurrent events. Examples: TBCplapyr, TBCplathi or TBCpyrthi

xy

Initial unit to start the plotted

xf

Final unit of the plotted

colevent

It is color that identifies the event

colcensor

it is color that identifies the censor

ltyx

The line type. Line types can either be specified as an integer (0=="blank", 1=="solid" (default),2=="dashed",3=="dotted",4=="dotdash", 5=="longdash", 6=="twodash") or as one of the character strings: "blank", "solid", "dashed","dotted", "dotdash"," longdash", or "twodash", where blank uses invisible lines (i.e., does not draw them)

lwdx

The line width, a positive number, defaulting to 1. The interpretation is device-specific, and some devices do not implement line widths less than one. (See the help on the device for details of the interpretation.)

Details

This function print and plot as max 5 units each intent.

Value

Print the data correspond to the selects units

Note

This graph is useful because it facilitates the processes of counting in the units

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.

See Also

Plot.Data, Events, Plot. Surv.Rec

Examples

XL<-data(TBCplapyr)
 #TBCplapyr
 # See, the unit number 1 to 24
 Plot.Cusum.Events(TBCplapyr,1,24,"green","red",2,1)
 # See, the unit number 10 to 12
 Plot.Cusum.Events(TBCplapyr,10,12,"pink","blue",1,3)
 # See, the unit number 5 to 9
 Plot.Cusum.Events(TBCplapyr,5,11,,,2,3)

Plot data with recurrent events

Description

This function plot data with recurrent events

Usage

Plot.Data.Events(yy, paciente, inicio, dias, censored, especiales,
                                          colevent="red",colcensor="blue")

Arguments

yy

Data type recurrent events. Examples: TBCplapyr, TBCplathi or TBCpyrthi

paciente

Vector of number of units on the data base

inicio

Vector, its assumed that the units are observed from one time equal to zero.

dias

Vector of the periods of observations of the study untis

censored

vector of times of censorship for each unit

especiales

Three-column matrix containing the identification of the units of study in each observation, the times of occurrence of the event or censorship and type of event.

colevent

Color event identifier.

colcensor

Color censored data identifier.

Details

The plot shows the recuurence of the events on the time

Value

This function returned the pictorial representation of the set of recurrence events data

Note

We recommend users to use routines similar to the example.

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.

See Also

Dif.Surv.Rec, Plot.Surv.Rec, Print.Summary

Examples

data(TBCplapyr)
XL<-data(TBCplapyr)
p<-ncol(TBCplapyr)
N<-nrow(TBCplapyr)
censor<-matrix(TBCplapyr$event)
especiales<-matrix(data=0,nrow(TBCplapyr),3)
especiales[,1]<-matrix(TBCplapyr$id)
especiales[,2]<-matrix(TBCplapyr$Tcal)
especiales[,3]<-matrix(TBCplapyr$event)
niveles<-levels(factor(especiales[,1]))
for(i in 1:N){
for(j in 1:nrow(matrix(niveles))){
if (as.character(especiales[i,1])==niveles[j]) especiales[i,1]<-j}}
StudyPeriod<-matrix(data=0,nrow(matrix(niveles)),1)
start<-matrix(data=0,nrow(matrix(niveles)),1)
k<-0
for(j in 1:N){if (TBCplapyr$event[j]==0){k<-k+1;StudyPeriod[k,1]<-TBCplapyr$Tcal[j]}}
units<-matrix(1:nrow(matrix(niveles)),nrow(matrix(niveles)),1)
Plot.Data.Events(TBCplapyr,units,start,StudyPeriod,censor,especiales,"black","blue")
Plot.Data.Events(TBCplapyr,units,start,StudyPeriod,censor,especiales,"red","black")

This function plots the ocurrence of a event in two scales time

Description

Recurrent events are plotted. A plot is returned. The counting processes are a powerful tools in survival analysis. These process consider two scale time, a calendar time and a gap time. This idea originally provides from Gill (1981) and the concept was extended by Pena et al. (2001).

Usage

Plot.Event.Rec(yy, xy, xf)

Arguments

yy

Object type recurrent events data. Example: TBCplapyr

xy

Identification of the unit to plotted. 'xy = 1' is defect value.

xf

Argument to plot the ocurrent events of the unit 'xf'. 'xf = 1' is defect value.

Value

Plot is returned. Pena et al. (2001) designed a special graphic, that allows to count the occurrence of events per unit time. Doubly-indexed processes illustration for an case. The graphic shows a case followed during 24.01 months. This patient presents four recurrences at months 7, 10, 16 and 24 from the beginning of study. This fact implies that interoccurrence. times are 7, 3, 6, 8 and the censored time correspond to 0.01 months. Let us assume that we are interested in computing the single processes, N(t) and Y (t) for a selected interoccurrence time t = 5. In this case N(t = 5) = 1 and Y (t = 5) = 3. For the calendar time scale, s = 20, we have N(s = 20) = 3 and Y (s = 20) = 1. Now, let us assume that we would like to know double-indexed processes for both selected interoccurrence and calendar times. Using both time scales we observe that N14(s=20,t=5)=1N_{14}(s = 20,t = 5)=1, Y14(s=20,t=5)=2Y_{14}(s = 20, t = 5) = 2 and ΔN14(s=20,t=6)=1\Delta\,N_{14}(s = 20,t = 6) = 1.

Author(s)

Dr. Carlos M. Martinez M. <[email protected]>

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.// Pena E., Strawderman R., Hollander, M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.// Gill, R. (1981) Testing with replacement and the product-limit estimator. Ann. Statist., 9, 853-860.

See Also

Dif.Surv.Rec, Plot.Data.Events

Examples

XL<-data(TBCplapyr)
# See, the unit number 14
Plot.Event.Rec(TBCplapyr,14,14)
# See, the unit number 5 
Plot.Event.Rec(TBCplapyr,5,5)

Plots of thesurvival function from an object with class newTestSurvRec, using PHS or WC models

Description

The survival curves are plotted. Both curves are estimates using PSH o WC estimator. This package is available in language R. This important clearly, that the PHS estimator is of valid use when it assumed that the inter-occurrence times are IID. Its obvious that this assumption is restrictive in biomedical applications and its use is more valid on the field of engineering. For WC estimated not import if the data is correlated.

Usage

Plot.Surv.Rec(XX,...)

Arguments

XX

Data type recurrent events. Example: TBCplapyr

...

Other objects

Value

The survival curves for both groups are plotted.

Author(s)

Dr. Carlos M. Martinez M. <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

See Also

Plot.Event.Rec, Dif.Surv.Rec

Examples

XL<-data(TBCplapyr)
Plot.Surv.Rec(TBCplapyr)

Function to print summary of statistics tests to comparison of the survival curves of the groups with recurrent events

Description

Returns matrices that contain the estimations of the survival curves for both groups. The estimations of survival curves of both groups are made using PSH estimator. The p.values of the tests are returned.

Usage

Print.Summary(XX,...)

Arguments

XX

Object type recurrent events data

...

other objects

Details

See Dif.Surv.Rec(XX,...)

Value

Put object type recurrent events data. #Print.Summary(TBCplapyr). #Values returned:

time n.event n.risk Surv_G1 std.error
1 2 127 0.984 0.0110
2 9 124 0.913 0.0243
3 14 113 0.800 0.0340
4 9 98 0.726 0.0380
... .. .. ..... ......
... .. .. ..... ......
29 1 18 0.244 0.0422
31 1 13 0.225 0.0427
35 1 9 0.200 0.0439
time n.event n.risk Surv_G2 std.error
1 3 84 0.964 0.0199
2 6 81 0.893 0.0327
3 12 73 0.746 0.0447
4 10 61 0.624 0.0494
... .. .. ..... ......
... .. .. ..... ......
15 1 17 0.283 0.0514
42 1 6 0.236 0.0582
44 1 5 0.189 0.0599

Group Median

Group Median
Pooled Group 8
1er Group 9
2do Group 6
Nomb.Est Chi.square p.value
LRrec 0.3052411 0.5806152
Grec 1.4448446 0.2293570
TWrec 0.9551746 0.3284056
PPrec 1.1322772 0.2872901
PMrec 1.1430319 0.2850126
PPrrec 1.1834042 0.2766641
HFrec 0.3052411 0.5806152
CMrec 0.3052411 0.5806152
Mrec 1.5298763 0.2161310

Author(s)

Dr. Carlos M. Martinez M. <[email protected]>

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.

See Also

Dif.Surv.Rec, Plot.Surv.Rec

Examples

data(TBCplapyr)
Print.Summary(TBCplapyr)

Estimator of the survival curve using the estimator developed by Pena, Strawderman and Hollander

Description

Estimation of survival function for recurrence time data by means the generalized product limit estimator (PLE) method developed by Pena, Strawderman and Hollander. The resulting object of class Survrecu is plotted by plot, before it is returned.

Usage

PSH.fit(x, tvals)

Arguments

x

a survival recurrent event object

tvals

vector of times where the survival function can be estimated.

Details

The estimator computed by this object is the nonparametric estimator of the inter-event time survivor function under the assumption of a renewal or IID model. This generalizes the product-limit estimator to the situation where the event is recurrent. For details and the theory behind this estimator, please refer to Pena, Strawderman and Hollander (2001, JASA).

Value

Value returned

n

number of unit or subjects observed.

m

vector of number of recurrences in each subject (length n)

failed

vector of number of recurrences in each subject (length n*m). Vector ordered (e.g. times of first unit, times of second unit, ..., times of n-unit)

censored

vector of times of censorship for each subject (length n)

numdistinct

number of distinct failures times.

distinct

vector of distinct failures times.

AtRisk

matrix of number of persons-at-risk at each distinct time and for each subject

survfunc

vector of survival estimated in distinct times

tvals

copy of argument.

Note

This function was originally performed by the survrec package, which solved the adjustment problem of the PSH estimator using Fortran routines. With the permission of its author, the algorithm of the packet base was taken, modified, the algorithm of the PSH estimates was reprogrammed and adapted to the needs of the newTestSurvRec package and thus avoid dependence.

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Pena, E.A., Strawderman, R. and Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J. Amer. Statist. Assoc. 96, 1299-1315.// Pena E., Strawderman R., Hollander, M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

See Also

WC.fit, Survrecu, Plot.Event.Rec, Plot.Surv.Rec, Print.Summary

Examples

data(MMC.TestSurvRec)
fitPSHa<-PSH.fit(Survrecu(MMC.TestSurvRec$id,MMC.TestSurvRec$time,
                          MMC.TestSurvRec$event))
fitPSHa$surv
fitPSHa$time
plot(fitPSHa$time,fitPSHa$survfunc,type="s" ,ylim=c(0,1),xlim=c(0,max(fitPSHa$time)))
  	  title(main = list("Survival Curve with Recurrent Event Data", 
        cex = 0.8, font = 2.3, col = "dark blue"))
mtext("Research Group: AVANCE USE R!", cex = 0.7, font = 2, 
        col = "dark blue", line = 1)
mtext("Software made by: Dr. Carlos Martinez", cex = 0.6, font = 2, 
        col = "dark red", line = 0)

Calculate the survival time to a selected quantile

Description

Auxiliary function called from Dif.Surv.Rec function. Given a FitSurvRec object we obtain the quantile from a survival function using PHS o WC estimators.

Usage

Qsearch.Fractil(fr, qr = 0.5)

Arguments

fr

FitSurvRec object

qr

quantile. Default is 0.5

Value

Returns the time in a selected quantile

Author(s)

Dr. Carlos M Martinez M., <[email protected]>

References

Martinez C., Ramirez, G., Vasquez M. (2009). Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.

See Also

FitSurvRe, Survrecu, is.Survrecu

Examples

XL<-data(MMC.TestSurvRec)
fit<-FitSurvRec(Survrecu(id,time,event)~1,data=MMC.TestSurvRec)
# 35th percentile from the survival function
Qsearch.Fractil(fit,q=0.35)

Create a Survival recurrent object type newTestSurvRec

Description

Create a survival recurrent object, usually used as a response variable in a model formula

Usage

Survrecu(id, time, event)

Arguments

id

Identifier of each subject. This value is the same for all recurrent times of each subject.

time

time of recurrence. For each subject the last time are censored.

event

The status indicator, 0=no recurrence 1=recurrence. Only these values are accepted.

Value

An object of class newTestSurvRec is returned. newTestSurRec object is implemented as a matrix of 3 colummns. No method for print. In the case of is.Survrecu, a logical value TRUE if x inherits from class Survrecu, otherwise an FALSE.

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.

See Also

FitSurvRec, is.Survrecu

Examples

data(MMC.TestSurvRec)
Survrecu(MMC.TestSurvRec$id,MMC.TestSurvRec$time,MMC.TestSurvRec$event)~1

Data in patients with bladder cancer treated with placebo or pyridoxine

Description

This database corresponds to the time of recurrence of tumors in 78 patients with bladder cancer. Patients were randomly assigned to treatments: placebo (47 patients) and pyridoxine (31 patients). Data type data.frame with 222 observations on 8 variables.

Usage

data(TBCplapyr)

Format

A data frame with 222 observations on the following 9 variables.

j

Observation number

id

ID of each unit. Repeated for each recurrence

Tinicio

Inicial time

time

recurrence o censoring time. For each unit the last time is censored

Tcal

Time if observation for each unit

event

censoring status. 1 = occurrence of the event in the unit and 0 right censored time

strata

Number of strata

trt

a factor with levels PlaceboPlacebo or PyridoxinePyridoxine

group

A factor with levels. Group identification

Details

Experiment Byar(1980). The database Byar experiment is used and the time (months) of recurrence of tumors in 116 sick patients with superficial bladder cancer is measured. These patients were randomly allocated to the following treatments: placebo (47 patients), pyridoxine (31 patients) and thiotepa (38 patients).

Source

Andrews D. , Herzberg A., (1985). Data. A collections of problems from many fields for the student and reserarch worker, Springer series in statistics, Springer-Verlag, USA

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Martinez, C. (2009). Generalizacion de algunas pruebas clasicas de comparacion de curvas de supervivencia al caso de eventos de naturaleza recurrente. Tesis doctoral. Universidad Central de Venezuela (UCV). Caracas-Venezuela.// Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

Examples

XL<-data(TBCplapyr)
XL<-data(TBCplapyr)
print(XL)
Print.Summary(TBCplapyr)

Data in patients with bladder cancer treated as placebo or thiotepa

Description

This database corresponds to the time of recurrence of tumors of 85 patients with bladder cancer. Patients were randomly assigned to treatments: placebo (47 patients) and thiotepa (38 patients). Data type data.frame with 217 observations on 8 variables.

Usage

data(TBCplathi)

Format

A data frame with 217 observations on the following 9 variables.

j

Observation number

id

ID of each unit. Repeated for each recurrence

Tinicio

Inicial time

time

recurrence o censoring time. For each unit the last time is censored

Tcal

Time if observation for each unit

event

censoring status. 1 = ocurrence of the event in the unit and 0 right censored time

strata

Number of strata

trt

a factor with levels PlaceboPlacebo or ThiotepaThiotepa

group

A factor with levels. Group identificator

Details

Experiment Byar (1980). The database Byar experiment is used and the time (months) of recurrence of tumors in 116 sick patients with superficial bladder cancer is measured. These patients were randomly allocated to the following treatments: placebo (47 patients), pyridoxine (31 patients) and thiotepa (38 patients).

Source

Andrews D., Herzberg A., (1985). Data. A collections of problems from many fields for the student and reserarch worker, Springer series in statistics, Springer-Verlag, USA

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.// Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

Examples

data(TBCplathi)
XL<-data(TBCplathi)
print(XL)
Print.Summary(TBCplathi)
## maybe str(TBCplathi) ; plot(TBCplathi) ...

Data in patients with bladder cancers and treated with pyridoxine or thiotepa

Description

This database corresponds to the time of recurrence of tumors of 69 patients with bladder cancer. Patients were randomly assigned to treatments: pyridoxine (38 patients) and thiotepa (31 patients). Data type data.frame with 171 observations on 8 variables.

Usage

data(TBCpyrthi)

Format

A data frame with 171 observations on the following 9 variables.

j

Observation number

id

ID of each unit. Repeated for each recurrence

Tinicio

Inicial time

time

recurrence o censoring time. For each unit the last time is censored

Tcal

Time if observation for each unit

event

censoring status. 1 = ocurrence of the event in the unit and' 0 right censored time

strata

Number of strata

trt

a factor with levels PyridoxinePyridoxine or ThiotepaThiotepa

group

A factor with levels. Group identificator

Details

Experiment Byar (1980). The database Byar experiment is used and the time (months) of recurrence of tumors in 116 sick patients with superficial bladder cancer is measured. These patients were randomly allocated to the following treatments: placebo (47 patients), pyridoxine (31 patients) and thiotepa (38 patients).

Source

Andrews D., Herzberg A., (1985). Data. A collections of problems from many fields for the student and reserarch worker, Springer series in statistics, Springer-Verlag, USA

References

Martinez C., Ramirez, G., Vasquez M. (2009).Pruebas no parametricas para comparar curvas de supervivencia de dos grupos que experimentan eventos recurrentes. Propuestas. Revista Ingenieria U.C.,Vol 16, 3, 45-55.//Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

Examples

data(TBCpyrthi)
XL<-data(TBCpyrthi)
print(XL)
Print.Summary(TBCpyrthi)
## maybe str(TBCpyrthi) ; plot(TBCpyrthi) ...

Survival function estimator for recurrence time data using the estimator developed by Wang and Chang

Description

Estimation of survival function for correlated by the product limit estimator PLE method developed by Wang and Chang.

Usage

WC.fit(x, tvals)

Arguments

x

a survival recurrent event object

tvals

vector of times where the survival function can be estimated.

Details

Wang-Chang (1999) proposed an estimator of the common marginal survivor function in the case where within-unit inter-occurrence times are correlated. The correlation structure considered by Wang and Chang (1999) is quite general and contains, in particular, both the i.i.d. and multiplicative (hence gamma) frailty model as special cases. This estimator removes the bias noted for the product-limit estimator developed by Pena, Strawderman and Hollander (PSH, 2001) when inter-occurrence times are correlated within units. However, when applied to i.i.d. inter-occurrence times, this estimator is not expected to perform as well as the PSH estimator, especially with regard to efficiency.

Value

Value returned

n

number of unit or subjects observed.

m

vector of number of recurrences in each subject (length n)

failed

vector of number of recurrences in each subject (length n*m). Vector ordered (e.g. times of first unit, times of second unit, ..., times of n-unit)

censored

vector of times of censorship for each subject (length n)

numdistinct

number of distinct failures times.

distinct

vector of distinct failures times.

AtRisk

matrix of number of persons-at-risk at each distinct time and for each subject

survfunc

vector of survival estimated in distinct times

tvals

copy of argument.

Note

This function was originally performed by the survrec package, which solved the adjustment problem of the WC estimator using Fortran routines. With the permission of its author, the algorithm was taken, modified, the algorithm, WC estimator was reprogrammed and adapted to the needs of the newTestSurvRec package and thus avoid dependence.

Author(s)

Dr. Carlos M. Martinez M., <[email protected]>

References

Wang, M. C. and Chang, S.H. (1999). Nonparametric Estimation of a Recurrent Survival Function. J. Amer. Statist. Assoc. 94, 146-153.// Pena E., Strawderman R., Hollander M. (2001). Nonparametric Estimation with Recurrent Event Data. J.A.S.A. 96, 1299-1315.

See Also

PSH.fit, Plot.Event.Rec, Plot.Surv.Rec, Print.Summary

Examples

XL<-data(MMC.TestSurvRec)
#-------------------------------------------------------------------------------------
fitPSHa<-PSH.fit(Survrecu(MMC.TestSurvRec$id,MMC.TestSurvRec$time,
                        MMC.TestSurvRec$event))
fitPSHa$surv
fitPSHa$time
plot(fitPSHa$time,fitPSHa$survfunc,type="s" ,ylim=c(0,1),
        xlim=c(0,max(fitPSHa$time)))
title(main = list("Survival Curve with Recurrent Event Data", 
        cex = 0.8, font = 2.3, col = "dark blue"))
mtext("Research Group: AVANCE USE R!", cex = 0.7, font = 2, 
        col = "dark blue", line = 1)
mtext("Software made by: Dr. Carlos Martinez", cex = 0.6, font = 2, 
        col = "dark red", line = 0)


fitWCa<-WC.fit(Survrecu(MMC.TestSurvRec$id,MMC.TestSurvRec$time,
                        MMC.TestSurvRec$event))
fitWCa$surv
fitWCa$time
plot(fitWCa$time,fitWCa$survfunc,type="s" ,ylim=c(0,1),
        xlim=c(0,max(fitWCa$time)))