plot.apc: Plot the estimates from a fitted Age-Period-Cohort model

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function plots the estimates created by apc.fit in a single graph. It just calls apc.frame after computing some sensible values of the parameters, and subsequently plots the estimates using apc.lines.

Usage

1
2
3
## S3 method for class 'apc'
plot( x, r.txt="Rate", ...)
          apc.plot( x, r.txt="Rate", ...)

Arguments

x

An object of class apc.

r.txt

The text to put on the vertical rate axis.

...

Additional arguments passed on to apc.lines.

Details

plot.apc is just a wrapper for apc.plot.

Value

A numerical vector of length two, with names c("cp.offset","RR.fac"). The first is the offset for the cohort period-axis, the second the multiplication factor for the rate-ratio scale. Therefore, if you want to plot at (x,y) in the right panel, use (x-res["cp.offset"],y/res["RR.fac"]) =(x-res[1],y/res[2]). This vector should be supplied for the parameter frame.par to apc.lines if more sets of estimates is plotted in the same graph, however see cp.points.

Author(s)

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

See Also

apc.lines, lines.apc, apc.frame, apc.fit

Examples

1
2
3
4
5
6
7
data( lungDK )
attach( lungDK )
apc1 <- apc.fit( A=Ax, P=Px, D=D, Y=Y/10^5 )
fp <- apc.plot( apc1 )
apc.lines( apc1, frame.par=fp, drift=1.01, col="red" )
for( i in 1:11 )
  apc.lines( apc1, frame.par=fp, drift=1+(i-6)/100, col=rainbow(12)[i] )

Example output

Attaching package: 'Epi'

The following object is masked from 'package:base':

    merge.data.frame

[1] "ML of APC-model Poisson with log(Y) offset : ( ACP ):\n"

Analysis of deviance for Age-Period-Cohort model

                  Resid. Df Resid. Dev Df Deviance  Pr(>Chi)    
Age                     215    15568.2                          
Age-drift               214     6965.1  1   8603.2 < 2.2e-16 ***
Age-Cohort              211     1152.5  3   5812.5 < 2.2e-16 ***
Age-Period-Cohort       208      549.4  3    603.2 < 2.2e-16 ***
Age-Period              211     3211.4 -3  -2662.1 < 2.2e-16 ***
Age-drift               214     6965.1 -3  -3753.6 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
No reference period given:
 Reference period for age-effects is chosen as
 the median date of birth for persons  with event:  1911.333 .

Epi documentation built on July 4, 2017, 9:25 a.m.

Search within the Epi package
Search all R packages, documentation and source code