File: rpcurve.Rd

package info (click to toggle)
r-cran-popepi 0.4.13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,656 kB
  • sloc: sh: 13; makefile: 2
file content (74 lines) | stat: -rw-r--r-- 2,167 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/relative_poisson_net_survival.R
\name{rpcurve}
\alias{rpcurve}
\title{Marginal piecewise parametric relative survival curve}
\usage{
rpcurve(object)
}
\arguments{
\item{object}{a \code{relpois} object}
}
\value{
A \code{data.table} of relative survival curves.
}
\description{
Fit a marginal relative survival curve based on a \code{relpois} fit
}
\details{
Estimates a marginal curve, i.e. the average of all
possible individual curves.

Only supported when the reserved \code{FOT} variable was used in \code{relpois}.
Computes a curve for each unique combination of covariates (e.g. 4 sets)
and returns a weighted average curve based on the counts
of subjects for each combination (e.g. 1000, 125, 50, 25 respectively).
Fairly fast when only categorical variables have been used, otherwise
go get a cup of coffee.

If delayed entry is present in data due to period analysis limiting,
the marginal curve is constructed only for those whose follow-up started
in the respective period.
}
\examples{
\donttest{
## use the simulated rectal cancer cohort
data("sire", package = "popEpi")
ab <- c(0,45,55,65,70,Inf)
sire$agegr <- cut(sire$dg_age, breaks = ab, right = FALSE)

BL <- list(fot= seq(0,10,1/12))
pm <- data.frame(popEpi::popmort)
x <- lexpand(sire, breaks=BL, pophaz=pm,
             birth = bi_date,
             entry = dg_date, exit = ex_date,
             status  = status \%in\% 1:2)

rpm <- relpois(x, formula = lex.Xst \%in\% 1:2 ~ -1+ FOT + agegr,
               fot.breaks=c(0,0.25,0.5,1:8,10))
pmc <- rpcurve(rpm)

## compare with non-parametric estimates
names(pm) <- c("sex", "per", "age", "haz")
x$agegr <- cut(x$dg_age, c(0,45,55,65,75,Inf), right = FALSE)
st <- survtab(fot ~ adjust(agegr), data = x, weights = "internal",
              pophaz = pm)


plot(st, y = "r.e2.as")
lines(y = pmc$est, x = pmc$Tstop, col="red")
}



}
\seealso{
Other relpois functions: 
\code{\link{RPL}},
\code{\link{relpois}()},
\code{\link{relpois_ag}()}
}
\author{
Joonas Miettinen
}
\concept{relpois functions}