generate.trend {emon} | R Documentation |
Generates a set of mean values.
Description
This function is used to generate mean value scenarios for use in power.trend
.
Usage
generate.trend(nyears, mu1=0, change, change.type="A", type = c("linear", "incident",
"step", "updown"), changeyear, symmetric=F)
Arguments
nyears |
Defines the number of time points for X axis |
mu1 |
The mean Y value for the first time point |
change |
Difference between |
change.type |
Whether the parameter |
type |
Type of trend to assess the power against. Can be any of |
changeyear |
Year in which change in gradient occurs, for options |
symmetric |
If |
Details
Assumes that surveys take place in years 1 to nyears
(or could be any other equally spaced unit).
Generates a set of mean values (or signal) for a specified trend over that time period. The approach
is based on Fryer and Nicholson (1993, 1999). For type="linear"
, the slope is generated by b=k/(nyears-1)
.
If type="updown"
, the slope until changeyear
is generated by b=k/(changeyears-1)
. After
changeyear
, the slope is -b
(except for the special case outlined by the symmetric
parameter above, where changeyear
and changeyear+1
are k
and then the slope continues as -b).
Value
Generates a data frame where the first column ($i) is year and the second column ($mu) is the mean value.
Author(s)
David Maxwell: David.Maxwell@cefas.co.uk
References
Fryer RJ & Nicholson MD (1993) The power of a contaminant monitoring programme to detect linear trends and incidents. ICES Journal of Marine Science, 50, 161-168.
Fryer & Nicholson 1999 Using smoothers for comprehensive assessments of contaminant time series in marine biota. ICES Journal of Marine Science, 56, 779-790.
See Also
Examples
lin0 = generate.trend(nyears=10, change=0, type="linear")
lin5 = generate.trend(nyears=10, change=5, type="linear")
inc5 = generate.trend(nyears=10, change=5, type="incident", changeyear=6)
step5 = generate.trend(nyears=10, change=5, type="step", changeyear=6)
updeven = generate.trend(nyears=10, change=5, type="updown", changeyear=5, symmetric=TRUE)
updodd = generate.trend(nyears=9, change=5, type="updown", changeyear=3)
par(mfrow=c(2,3))
plot(lin0$i, lin0$mu, type="o", pch=16, xlab='Time', ylab='Y')
plot(lin5$i, lin5$mu, type="o", pch=16, xlab='Time', ylab='Y')
plot(inc5$i, inc5$mu, type="o", pch=16, xlab='Time', ylab='Y')
plot(step5$i, step5$mu, type="o", pch=16, xlab='Time', ylab='Y')
plot(updeven$i, updeven$mu, type="o", pch=16, xlab='Time', ylab='Y')
plot(updodd$i, updodd$mu, type="o", pch=16, xlab='Time', ylab='Y')