Learn R Programming

popEpi (version 0.2.1)

sirspline: Estimate splines for SIR or SMR

Description

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, a gegroups or follow-up intervals. Splines can be fitted for these time dimensions separately or in the same model.

Usage

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)

Arguments

coh.data
cohort data with observations and at risk time variables
coh.obs
variable name for observed cases
coh.pyrs
variable name for person-years in cohort data
ref.data
aggregated population data
ref.obs
variable name for observed cases
ref.pyrs
variable name for person-years in population data
ref.rate
population rate observed/expected. This overwrites the parameters ref.pyrs and ref.obs.
subset
logical condition to subset coh.data before any computations
print
variable names for which to estimate SIRs/SMRs and associated splines separately
adjust
variable names for adjusting the expected cases
mstate
set column names for cause spesific observations. Relevant only when coh.obs length is two or more. See help for sir.
spline
variable name(s) for the splines
knots
number knots (vector), pre-defined knots (list of vectors) or for optimal number of knots left NULL
reference.points
fixed reference values for rate ratios. If left NULL the smallest value is the reference point (where SIR = 1). Ignored if dependent.splines = FALSE
dependent.splines
logical; if TRUE, all splines are fitted in same model.

Value

  • A list of date.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

Details

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. print 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 agegroup (print = 'agegroup'). p-values The outputted 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.

See Also

plot.sirspline, sir, splitMulti ../doc/sir.html{A SIR calculation vignette}

Examples

Run this code
## for examples see: vignette('sir')

Run the code above in your browser using DataLab