Last data update: 2014.03.03

R: Bayesian inference for mu and sigma^2 for the AR(1) process.
infermsfmetropR Documentation

Bayesian inference for μ and σ^2 for the AR(1) process.

Description

The function infermsmetrop is used to create a sample from the posterior distribution of μ and σ^2, using eqs. 8,9 in Tyralis and Koutsoyiannis (2014) for the AR(1) process.

Usage

infermsfmetrop(fbayes,data)

Arguments

data

time series data

fbayes

phi parameter simulation sample, should be a vector

Value

A matrix with two columns, the first corresponding to the sample of μ and the second corresponding to the sample of σ^2.

Author(s)

Hristos Tyralis

References

Tyralis H., Koutsoyiannis, D. (2014) A Bayesian statistical model for deriving the predictive distribution of hydroclimatic variables, Climate Dynamics 42(11-12), 2867–2883. http://dx.doi.org/10.1007/s00382-013-1804-y.

Examples

# Posterior distribution of the mu and sigma parameters of the AR(1) process for
# the Nile time series.

set.seed(12345)

samp.sim1 <- inferf(Nile,500)

samp.sim2 <- infermsfmetrop(samp.sim1,Nile)

hist(samp.sim2[,1],breaks = 20,main = expression(paste("Histogram of ",mu)),
xlab = expression(paste(mu)))

hist(sqrt(samp.sim2[,2]),breaks = 20,
main = expression(paste("Histogram of ",sigma)),xlab = expression(paste(sigma)))

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/infermsfmetrop.Rd_%03d_medium.png", width=480, height=480)
> ### Name: infermsfmetrop
> ### Title: Bayesian inference for mu and sigma^2 for the AR(1) process.
> ### Aliases: infermsfmetrop
> ### Keywords: models
> 
> ### ** Examples
> 
> # Posterior distribution of the mu and sigma parameters of the AR(1) process for
> # the Nile time series.
> 
> set.seed(12345)
> 
> samp.sim1 <- inferf(Nile,500)
> 
> samp.sim2 <- infermsfmetrop(samp.sim1,Nile)
> 
> hist(samp.sim2[,1],breaks = 20,main = expression(paste("Histogram of ",mu)),
+ xlab = expression(paste(mu)))
> 
> hist(sqrt(samp.sim2[,2]),breaks = 20,
+ main = expression(paste("Histogram of ",sigma)),xlab = expression(paste(sigma)))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>