Learn R Programming

poptrend (version 0.2.0)

change: Compute the change in the population over a time interval.

Description

Computes the estimated percentual change in the population between two given time points, and an approximate confidence interval for the change.

Usage

change(trend, start, end, alpha = 0.05)

Value

A list containing the estimated change, and start and end points.

Arguments

trend

A fitted object of class trend.

start

Start time for the comparison.

end

End time for the comparison.

alpha

alpha-level for approximate confidence interval.

Author

Jonas Knape

Details

The function computes the estimated change between two chosen time points. When random effects are present, the change is computed for the underlying linear or smooth trend term. For index models, the change is estimated from the difference between indices. Changes can only be computed between time points that were included in the trendGrid argument to ptrend, if the two time points are not included the nearest points in the grid are chosen.

Confidence intervals are computed using quantiles of the bootstrapped trends.

Examples

Run this code
## Simulate a data set with 10 sites and 30 years
data = simTrend(30, 10)
## Fit a smooth trend with fixed site effects, random time effects,
## and automatic selection of degrees of freedom
trFit = ptrend(count ~ trend(year, type = "smooth") + site, data = data)
## Check the estimated percent change from year 2 to 20
change(trFit, 10, 20)

Run the code above in your browser using DataLab