View source: R/trendAnalysis.R
change | R Documentation |
Computes the estimated percentual change in the population between two given time points, and an approximate confidence interval for the change.
change(trend, start, end, alpha = 0.05)
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. |
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.
A list containing the estimated change, and start and end points.
If start
or end
are not contained in the trendgrid
argument of the ptrend
function,
the change is computed between the values in the grid that are closest to these points.
Jonas Knape
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.