Changes in 0.4.9

Changes in 0.4.8

Changes in 0.4.7

Changes in 0.4.6

Changes in 0.4.5

Changes in 0.4.4

Changes in 0.4.3

Changes in 0.4.2

Changes in 0.4.1

Changes in 0.4.0

Changes in 0.3.1

This is a hotfix. survtab() was causing warnings in certain situations, which this update fixes. Also fixed plotting survtab objects so that multiple strata are plotted correctly when one or more curves end before the longest one as well other small fixes: See Github issues #89, #90, #91, and #92.

Changes in 0.3.0

Adjusting

Direct adjusting (computing weighted averages of estimates) has been generalized. Functions such as survtab and survmean allow for using adjust() mini function within formulas, or a separate adjust argument. Weights are passed separately. See the examples in the next chapter. See also ?direct_adjusting.

Estimating functions of survival time

The survtab function computes observed, net/relative and cause-specific survivals as well as cumulative incidence functions for Lexis data. Any of the supported survival time functions can be easily adjusted by any number of categorical variables if needed.

One can also use survtab_ag for aggregated data. This means the data does not have to be on the subject-level to compute survival time function estimates.

## prep data
data(sibr)
sire$cancer <- "rectal"
sibr$cancer <- "breast"
sr <- rbind(sire, sibr)

sr$cancer <- factor(sr$cancer)
sr <- sr[sr$dg_date < sr$ex_date, ]

sr$status <- factor(sr$status, levels = 0:2, 
                    labels = c("alive", "canD", "othD"))

## create Lexis object
library(Epi)
x <- Lexis(entry = list(FUT = 0, AGE = dg_age, CAL = get.yrs(dg_date)), 
           exit = list(CAL = get.yrs(ex_date)), 
           data = sr,
           exit.status = status)
#> NOTE: entry.status has been set to "alive" for all.

## population hazards file - see ?pophaz for general instructions
data(popmort)
pm <- data.frame(popmort)
names(pm) <- c("sex", "CAL", "AGE", "haz")

## simple usage - uses lex.Xst as status variable
st <- survtab(FUT ~ cancer, data = x,
              breaks = list(FUT = seq(0, 5, 1/12)),
              surv.type = "surv.rel", pophaz = pm)

## more explicit usage
st <- survtab(Surv(FUT, event = lex.Xst) ~ cancer, data = x,
              breaks = list(FUT = seq(0, 5, 1/12)),
              surv.type = "surv.rel", pophaz = pm)


## adjusting
x$agegr <- cut(x$dg_age, c(0,55,65,75,Inf))
w <- as.numeric(table(x$agegr))
st <- survtab(Surv(FUT, event = lex.Xst) ~ cancer + adjust(agegr), 
              data = x,
              breaks = list(FUT = seq(0, 5, 1/12)),
              surv.type = "surv.rel", 
              pophaz = pm, weights = w)

Rates

The new rate function enables easy calculation of e.g. standardized incidence rates:

## dummy data

a <- merge(0:1, 1:18)
names(a) <- c("sex", "agegroup")
set.seed(1)
a$obs <- rbinom(nrow(a), 100, 0.5)
set.seed(1)
a$pyrs <- rbinom(nrow(a), 1e4, 0.75)

## so called "world" standard rates (weighted to hypothetical world pop in 2000)
r <- rate(data = a, obs = obs, pyrs = pyrs, print = sex, 
          adjust = agegroup, weights = 'world_2000_18of5')
#> Warning in pyrJjCscXlsrH * pyrJjCscXlsrH: NAs produced by integer overflow

#> Warning in pyrJjCscXlsrH * pyrJjCscXlsrH: NAs produced by integer overflow
sex obs pyrs rate.adj SE.rate.adj rate.adj.lo rate.adj.hi rate SE.rate rate.lo rate.hi
0 933 134986 0.0069947 0.0002541 0.0065140 0.0075108 0.0069118 NA 0.0064822 0.0073699
1 875 134849 0.0064453 0.0002429 0.0059865 0.0069394 0.0064887 NA 0.0060727 0.0069332