inferf | R Documentation |
The function inferf is used to create a sample from the posterior distribution of φ. The function uses the eq.10 (Tyralis and Koutsoyiannis 2014) to make inference on φ and an Accept-Reject algorithm (see Robert and Casella 2004, Algorithm A.4).
inferf(data, n, add = 0.001, minu = -0.999, maxu = 0.999)
data |
time series data |
n |
The size of the simulated sample |
add |
A number added to the maximum value of the natural logarithm of eq.10, to avoid bugs of the Accept-Reject algorithm due to computation errors |
minu |
A lower bound to the parameter φ |
maxu |
An upper bound to the parameter φ |
Vector with the simulated sample.
Hristos Tyralis
Robert CP, Casella G (2004) Monte Carlo Statistical Methods. New York: Springer. doi: 10.1007/978-1-4757-4145-2.
Tyralis H, Koutsoyiannis D (2014) A Bayesian statistical model for deriving the predictive distribution of hydroclimatic variables. Climate Dynamics 42(11-12):2867–2883. doi: 10.1007/s00382-013-1804-y.
# Posterior distribution of the phi parameter of the AR(1) process for the Nile # time series. set.seed(12345) samp.sim <- inferf(Nile,500) hist(samp.sim, breaks = 20, main = expression(paste("Histogram of ",phi)), xlab = expression(phi))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.