Splines for standardised incidence or mortality ratio. A useful tool to e.g. check whether a constant SIR can be assumed for all calendar periods, age groups or follow-up intervals. Splines can be fitted for these time dimensions separately or in the same model.
sirspline(
coh.data,
coh.obs,
coh.pyrs,
ref.data = NULL,
ref.obs = NULL,
ref.pyrs = NULL,
ref.rate = NULL,
subset = NULL,
print = NULL,
adjust = NULL,
mstate = NULL,
spline,
knots = NULL,
reference.points = NULL,
dependent.splines = TRUE
)
A list of data.frames and vectors.
Three spline estimates are named as spline.est.A/B/C
and the corresponding values
in spline.seq.A/B/C
for manual plotting
cohort data with observations and at risk time variables
variable name for observed cases
variable name for person-years in cohort data
aggregated population data
variable name for observed cases
variable name for person-years in population data
population rate observed/expected. This overwrites the parameters
ref.pyrs
and ref.obs
.
logical condition to subset coh.data
before any computations
variable names for which to estimate SIRs/SMRs and associated splines separately
variable names for adjusting the expected cases
set column names for cause specific observations. Relevant only
when coh.obs length is two or more. See help for sir
.
variable name(s) for the splines
number knots (vector), pre-defined knots (list of vectors) or for optimal number of knots left NULL
fixed reference values for rate ratios. If left NULL
the smallest value is the reference point (where SIR = 1).
Ignored if dependent.splines = FALSE
logical; if TRUE, all splines are fitted in same model.
Matti Rantanen, Joonas Miettinen
See sir
for help on SIR/SMR estimation in general; usage of splines
is discussed below.
The spline variables
The model can include one, two or three splines variables.
Variables can be included in the same model selecting dependent.splines = TRUE
and SIR ratios are calculated (first one is the SIR, others SIR ratios).
Reference points vector can be set via reference.points
where first element of the vector is the reference point for first ratio.
Variable(s) to fit splines are given as a vector in argument spline
.
Order will affect the results.
dependent.splines
By default dependent.splines is FALSE and all splines are fitted in separate models.
If TRUE, the first variable in spline
is a function of a SIR and other(s) are ratios.
knots
There are three options to set knots to splines:
Set the number of knots for each spline variable with a vector. The knots are automatically placed to the quantiles of observed cases in cohort data. The first and last knots are always the maximum and minimum values, so knot value needs to be at least two.
Predefined knot places can be set with a list of vectors. The vector for each spline in the list specifies the knot places. The lowest and the largest values are the boundary knots and these should be checked beforehand.
If knots
is left NULL, the model searches the optimal number
of knots by model AIC by fitting models iteratively from 2 to 15 knots and
the one with smallest AIC is selected.
If dependent.splines = TRUE
, the number of knots is searched by fitting each spline
variable separately.
Splines can be stratified by the levels of variable given in print
. If
print
is a vector, only the first variable is accounted for. The knots
are placed globally for all levels of print
. This also ensures that the likelihood
ratio test is valid.
Splines are also fitted independently for each level of print
.
This allows for searching interactions, e.g. by fitting spline for period
(splines='period'
) for each age group (print = 'agegroup'
).
p-values
The output p-value is a test of whether the splines are equal (homogenous)
at different levels of print
.
The test is based on the likelihood ratio test, where the full model
includes print
and is
compared to a null model without it.
When (dependent.splines = TRUE)
the p-value returned is a global p-value.
Otherwise the p-value is spline-specific.
splitMulti
A SIR calculation vignette
Other sir functions:
lines.sirspline()
,
plot.sirspline()
,
sir()
,
sir_exp()
,
sir_ratio()
Other main functions:
Surv()
,
rate()
,
relpois()
,
relpois_ag()
,
sir()
,
survmean()
,
survtab()
,
survtab_ag()
# \donttest{
## for examples see: vignette('sir')
# }
Run the code above in your browser using DataLab