Description Usage Arguments Details Author(s) Examples
Probability density function and random generation for seasonal temperatures
1 2 3 |
x |
vector of temperatures |
mean.t |
mean annual temperature |
amp.t |
amplitude of the seasonal cycle |
sd.t |
inter-annual standard deviation of temperature at a given point in the seasonal cycle |
return |
return densities for temperatures x, or a function to do so, Default: c("density", "FUN") |
res |
resolution of the temperature vectors to be convolved, Default: 0.01 |
n |
number of samples |
The seasonal temperature cycle is approximated as a sine wave with gaussian noise. The probability density function is obtained by numerically convoluting a scaled sine wave and normal PDF with mean = 0. Random deviates are generated by adding gaussian noise to points sampled uniformly from the scaled sine wave on the interval 0 to 2*pi
Andrew Dolman
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
if(interactive()){
amp.t <- 10
mean.t <- 25
sd.t <- 0.75
x <- seq(mean.t-amp.t, mean.t+amp.t, length.out = 1000)
Z <- rSeas(n = 100000, mean.t, amp.t, sd.t)
hist(Z, freq=F,breaks=100)
lines(x, dSeas(x, mean.t, amp.t, sd.t, res = 0.1), col = "Blue")
lines(x, dSeas(x, mean.t, amp.t, sd.t, res = 0.01), col = "Green")
lines(x, dSeas(x, mean.t, amp.t, sd.t, res = 0.001), col = "Red")
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.