create_cycloSurv {cyclomort}R Documentation

Create a cycloSurv object

Description

cycloSurv is a superclass of Surv, the standard data type for survival analysis in R, with an additional period attribute necessary for estimating periodic hazard functions.

Usage

create_cycloSurv(start, end, event, t0 = NULL, period, timeunits = "days")

Arguments

start

a vector measuring time an individual enters a population (can be POSIX, numeric, or Date)

end

a vector measuring time an individual leaves a population, e.g. via death (or other precipitation event of interest) or censoring. (as a POSIXct, numeric, or Date)

event

the status indicator, normally 0=alive/censored, 1=dead.

t0

reference time for event times. By default, t0 is set to January 1 of the first year of observations if times are POSIXct. There are many reasons why a biological year may more conveniently start on a different day. All else being equal, it can be useful to start a "mortality year" at a period of low mortality to better isolate the seasons of higher mortality.

period

length of one period in the input data

timeunits

units that dates are inputted in if dates are being used

Value

an object of class cycloSurv which is identical to and compatible with a 'Surv object, with, however, an addition "period" attribute.

Examples

startTimes = as.Date(origin = "2010-01-01", 
                    c(0, 0, 0, 50, 0, 50, 100, 150, 0, 100)) #in days
endTimes = as.Date(origin = "2010-01-01", 
                  c(50, 50, 100, 150, 150, 200, 200, 250, 350, 500)) #in days
censored = c(1, 1, 0, 1, 1, 0, 1, 0, 0, 0)
period = 365
morts = create_cycloSurv(start = startTimes, end = endTimes, 
                       event = censored, period = period)

[Package cyclomort version 1.0.2 Index]