Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lines.apc

Plot APC-estimates in an APC-frame.


Description

When an APC-frame has been produced by apc.frame, this function draws a set of estimates from an APC-fit in the frame. An optional drift parameter can be added to the period parameters and subtracted from the cohort and age parameters.

Usage

## S3 method for class 'apc'
lines( x, P, C,
        scale = c("log","ln","rates","inc","RR"),
    frame.par = options()[["apc.frame.par"]],
        drift = 0,
           c0 = median( C[,1] ),
           a0 = median( A[,1] ),
           p0 = c0 + a0,
           ci = rep( FALSE, 3 ),
          lwd = c(3,1,1),
          lty = 1,
          col = "black",
         type = "l",
        knots = FALSE,
        shade = FALSE,
          ... )
 apc.lines( x, P, C,
        scale = c("log","ln","rates","inc","RR"),
    frame.par = options()[["apc.frame.par"]],
        drift = 0,
           c0 = median( C[,1] ),
           a0 = median( A[,1] ),
           p0 = c0 + a0,
           ci = rep( FALSE, 3 ),
          lwd = c(3,1,1),
          lty = 1,
          col = "black",
         type = "l",
        knots = FALSE,
        shade = FALSE,
          ... )

Arguments

x

If an apc-object, (see apc.fit), then the arguments P, C, c0, a0 and p0 are ignored, and the estimates from x plotted.

Can also be a 4-column matrix with columns age, age-specific rates, lower and upper c.i., in which case period and cohort effects are taken from the arguments P and C.

P

Period effects. Rate-ratios. Same form as for the age-effects.

C

Cohort effects. Rate-ratios. Same form as for the age-effects.

scale

Are effects given on a log-scale? Character variable, one of "log", "ln", "rates", "inc", "RR". If "log" or "ln" it is assumed that effects are log(rates) and log(RRs) otherwise the actual effects are assumed given in A, P and C. If A is of class apc, it is assumed to be "rates".

frame.par

2-element vector with the cohort-period offset and RR multiplicator. This will typically be the result from the call of apc.frame. See this for details.

drift

The drift parameter to be added to the period effect. If scale="log" this is assumed to be on the log-scale, otherwise it is assumed to be a multiplicative factor per unit of the first columns of A, P and C

c0

The cohort where the drift is assumed to be 0; the subtracted drift effect is drift*(C[,1]-c0).

a0

The age where the drift is assumed to be 0.

p0

The period where the drift is assumed to be 0.

ci

Should confidence interval be drawn. Logical or character. If character, any occurrence of "a" or "A" produces confidence intervals for the age-effect. Similarly for period and cohort.

lwd

Line widths for estimates, lower and upper confidence limits.

lty

Linetypes for the three effects.

col

Colours for the three effects.

type

What type of lines / points should be used.

knots

Should knots from the model be shown?

shade

Should confidence intervals be plotted as shaded areas? If true, the setting of ci is ignored.

...

Further parameters to be transmitted to points lines, matpoints or matlines used for plotting the three sets of curves.

Details

There is no difference between the functions apc.lines and lines.apc, except the the latter is the lines method for apc objects.

The drawing of three effects in an APC-frame is a rather trivial task, and the main purpose of the utility is to provide a function that easily adds the functionality of adding a drift so that several sets of lines can be easily produced in the same frame.

Value

apc.lines returns (invisibly) a list of three matrices of the effects plotted.

Author(s)

Bendix Carstensen, Steno Diabetes Center, http://bendixcarstensen.com

See Also


Epi

Statistical Analysis in Epidemiology

v2.44
GPL-2
Authors
Bendix Carstensen [aut, cre], Martyn Plummer [aut], Esa Laara [ctb], Michael Hills [ctb]
Initial release
2021-02-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.