trendlines: Extract 'overall' trendlines

View source: R/trim_overall.R

trendlinesR Documentation

Extract 'overall' trendlines

Description

Extract 'overall' trendlines

Usage

trendlines(x)

Arguments

x

An object of class trim.overall

Value

A data.frame containing the information on all trendline segments and their uncertainty. The data.frame has the following columns:

segment

segment ID, starting at 1

year

year for which value, lo and hi are given

value

the y coordinate of the trendline segment

lo

lower value of the uncertainty band

hi

upper value of the uncertainty interval

See Also

Other analyses: coef.trim(), confint.trim(), gof(), index(), now_what(), overall(), overdispersion(), plot.trim.index(), plot.trim.overall(), plot.trim.smooth(), results(), serial_correlation(), summary.trim(), totals(), trim(), vcov.trim(), wald()

Examples

data(skylark2)
z <- trim(count ~ site+year, data=skylark2, model=3)
tt <- totals(z, long=TRUE)       # collect time-totals
tl <- trendlines(overall(z))     # collect overall trend line

# define plot limits
xr <- range(tt$year)
yr <- range(tl$lo, tl$hi, tt$value)
plot(xr, yr, type='n', xlab="Year", ylab="Total counts")

# Plot uncertainty band
ubx <- c(tl$year, rev(tl$year))
uby <- c(tl$lo, rev(tl$hi))
polygon(ubx, uby, col=gray(0.9), border=NA)

# Plot trend line
lines(tl$year, tl$value, col="black", lwd=2)

# Plot time-totals
lines(tt$year, tt$value, col="red", lwd=2)
points(tt$year, tt$value, col="red", pch=16, cex=1.5)


rtrim documentation built on June 22, 2024, 10:39 a.m.