R: Posterior distribution of the phi parameter of the AR(1)...
inferfmetrop
R Documentation
Posterior distribution of the φ
parameter of the AR(1) process, using a Metropolis algorithm.
Description
The function inferfmetrop is used to create a sample from the posterior
distribution of φ. The function uses
the eq.10 in Tyralis and Koutsoyiannis (2014) and a Metropolis algorithm to make
inference on φ.
Starting values for the sampling. Must be of the appropriate
dimension. It must also be the case that fun(theta.init, ...) is greater
than -Inf.
burnin
The number of burn-in iterations for the sampler.
mcmc
The number of MCMC iterations after burnin.
thin
The thinning interval used in the simulation. The number of MCMC
iterations must be divisible by this value.
tune
The tuning parameter for the Metropolis sampling. Can be either a
positive scalar or a k-vector, where k is the length of
theta.
verbose
A switch which determines whether or not the progress of the
sampler is printed to the screen. If verbose is greater than 0 the
iteration number, the theta vector, the function value, and the
Metropolis acceptance rate are sent to the screen every verboseth
iteration.
seed
The seed for the random number generator. If NA, the Mersenne
Twister generator is used with default seed 12345; if an integer is passed it is
used to seed the Mersenne twister. The user can also pass a list of length two
to use the L'Ecuyer random number generator, which is suitable for parallel
computation. The first element of the list is the L'Ecuyer seed, which is a
vector of length six or NA (if NA a default seed of rep(12345,6) is
used). The second element of list is a positive substream number. See the
MCMCpack specification for more details.
Value
An mcmc object that contains the posterior sample. This object can be summarized
by functions provided by the coda package.
Note
The Metropolis algorithm uses the function MCMCmetrop1R from the package
MCMCpack (Martin et al. 2011).
Author(s)
Hristos Tyralis
References
Martin A.D., Quinn K.M., Park J.H. (2011) MCMCpack: Markov chain Monte Carlo in
R, Journal of Statistical Software42(9), 1–21.
http://www.jstatsoft.org/v42/i09.
Tyralis H., Koutsoyiannis, D. (2014) A Bayesian statistical model for deriving
the predictive distribution of hydroclimatic variables, Climate Dynamics42(11-12), 2867–2883.
http://dx.doi.org/10.1007/s00382-013-1804-y.
Examples
# Posterior distribution of the phi parameter of the AR(1) process for the Nile
# time series.
samp.sim <- inferfmetrop(Nile,theta.init = 0.7,burnin = 500,mcmc = 500,thin = 1,
tune = 1,seed = 12345)
hist(samp.sim,breaks = 20,main = expression(paste("Histogram of ",phi)),
xlab = expression(phi))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HKprocess)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HKprocess/inferfmetrop.Rd_%03d_medium.png", width=480, height=480)
> ### Name: inferfmetrop
> ### Title: Posterior distribution of the phi parameter of the AR(1)
> ### process, using a Metropolis algorithm.
> ### Aliases: inferfmetrop
> ### Keywords: models
>
> ### ** Examples
>
> # Posterior distribution of the phi parameter of the AR(1) process for the Nile
> # time series.
>
> samp.sim <- inferfmetrop(Nile,theta.init = 0.7,burnin = 500,mcmc = 500,thin = 1,
+ tune = 1,seed = 12345)
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The Metropolis acceptance rate was 0.70500
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>
> hist(samp.sim,breaks = 20,main = expression(paste("Histogram of ",phi)),
+ xlab = expression(phi))
>
>
>
>
>
> dev.off()
null device
1
>