aapc: Average annual per cent change in segmented trend analysis

View source: R/aapc.r

aapcR Documentation

Average annual per cent change in segmented trend analysis

Description

Computes the average annual per cent change to summarize piecewise linear relationships in segmented regression models.

Usage

aapc(ogg, parm, exp.it = FALSE, conf.level = 0.95, wrong.se = TRUE, 
    .vcov=NULL, .coef=NULL, ...)

Arguments

ogg

the fitted model returned by segmented.

parm

the single segmented variable of interest. It can be missing if the model includes a single segmented covariate. If missing and ogg includes several segmented variables, the first one is considered.

exp.it

logical. If TRUE, the per cent change is computed, namely \exp(\hat\mu)-1 where \mu=\sum_j \beta_jw_j, see ‘Details’.

conf.level

the confidence level desidered.

wrong.se

logical, if TRUE, the 'wrong” standard error (as discussed in Clegg et al. (2009)) ignoring uncertainty in the breakpoint estimate is returned as an attribute "wrong.se".

.vcov

The full covariance matrix of estimates. If unspecified (i.e. NULL), the covariance matrix is computed internally by vcov(ogg,...).

.coef

The regression parameter estimates. If unspecified (i.e. NULL), it is computed internally by coef(ogg).

...

further arguments to be passed on to vcov.segmented(), such as var.diff or is.

Details

To summarize the fitted piecewise linear relationship, Clegg et al. (2009) proposed the 'average annual per cent change' (AAPC) computed as the sum of the slopes (\beta_j) weighted by corresponding covariate sub-interval width (w_j), namely \mu=\sum_j \beta_jw_j. Since the weights are the breakpoint differences, the standard error of the AAPC should account for uncertainty in the breakpoint estimate, as discussed in Muggeo (2010) and implemented by aapc().

Value

aapc returns a numeric vector including point estimate, standard error and confidence interval for the AAPC relevant to variable specified in parm.

Note

exp.it=TRUE would be appropriate only if the response variable is the log of (any) counts.

Author(s)

Vito M. R. Muggeo, vito.muggeo@unipa.it

References

Clegg LX, Hankey BF, Tiwari R, Feuer EJ, Edwards BK (2009) Estimating average annual per cent change in trend analysis. Statistics in Medicine, 28; 3670-3682.

Muggeo, V.M.R. (2010) Comment on ‘Estimating average annual per cent change in trend analysis’ by Clegg et al., Statistics in Medicine; 28, 3670-3682. Statistics in Medicine, 29, 1958–1960.

Examples

set.seed(12)
x<-1:20
y<-2-.5*x+.7*pmax(x-9,0)-.8*pmax(x-15,0)+rnorm(20)*.3
o<-lm(y~x)
os<-segmented(o, psi=c(5,12))
aapc(os)

segmented documentation built on Nov. 28, 2023, 1:07 a.m.