ngssm.bayes: Bayesian estimation of the non-Gaussian state space models...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/ngssm.bayes.r

Description

The function performs the Bayesian estimation for the static parameters of the model.

Usage

1
2
3
4
5
ngssm.bayes(formula,data,na.action="na.omit",pz=NULL,nBreaks=NULL,
model="Poisson",StaPar=NULL,amp=FALSE,a0=0.01,b0=0.01,prw=c(1,1),
prnu=NULL,prchi=NULL,prmu=NULL,prbetamu=NULL,prbetasigma=NULL,lower=NULL,
upper=NULL,ci=0.95,pointss=10,nsamplex=1000,mcmc=NULL,postplot=FALSE,contourplot=FALSE,
LabelParTheta=NULL,verbose=FALSE)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

a data frame containing the variables in the model. The variables are: - the time series of interest Yt (first column of the data frame). the explanatory time series to be inserted in the model. - Xt must be always specified as a matrix of order n by p (after Yt). - the explanatory time series to be inserted in the mean of volatility model. Zt must be always specified as a matrix of order n by p (after Xt). - a censoring indicator of the event (a vector), only for the PEM. If the model is the PEM, put the variable Event in the secon column of tha data frame after Yt, and he explanatory time series after the variable Event. The value 1 indicates failure.

na.action

a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. Optional argument.

pz

the number of the explanatory time series to be inserted in the mean of volatility model. Default: NULL. Optional argument.

nBreaks

the number of breaks used to build a vector with the interval limits, only for the PEM. Optional argument.

model

the chosen model for the observations. The options are: Poisson, Normal, Gamma, Weibull, Generalized Gamma, Laplace, GED and PEM models.

StaPar

a numeric vector of initial values for the static parameters. Optional argument.

amp

the interval width is taken in account in the estimation of parameter w which controls the loss of information over time, only for the PEM. For more details see Santos et al. (2017). Default: FALSE. Optional argument.

a0

the shape parameter of the initial Gamma distribution. Optional argument. Default: a0=0.01.

b0

the scale parameter of the initial Gamma distribution. Optional argument. Default: b0=0.01.

prw

a numeric vector of length 2, indicating the hyperparameters of the Beta prior distribution for the parameter w. Optional argument. The default value is c(1,1), which constitutes an uninformative prior for common data sets.

prnu

a numeric vector of length 2, indicating the hyperparameters of the Gamma prior distribution for the shape parameter nu. Optional argument.

prchi

a numeric vector of length 2, indicating the hyperparameters of the Gamma prior distribution for the shape parameter chi. Optional argument.

prmu

a numeric vector of length 2, indicating mean and standard deviation for the Gaussian prior distribution for the parameter mu. Optional argument. This prior can be used in Normal, Laplace and GED time series models.

prbetamu

a numeric vector of length p, indicating mean for the Gaussian prior distribution for the parameter beta, the regression coefficients. Optional argument.

prbetasigma

a numeric matrix of order p by p, indicating variance-covariance matrix of the Gaussian prior distribution for the parameter beta, the regression coefficients. Optional argument.

lower

an lower bound for the static parameters (StaPar) in the density support argument of the ARMS function (MCMC). Optional argument.

upper

an upper bound for the static parameters (StaPar) in the density support argument of the ARMS function (MCMC). Optional argument.

ci

the nominal level of credibility interval for the parameters. Default: ci=0.95. Optional argument.

pointss

the number of points/parts/breaks that the specified interval of the static parameters is partitioned. Default: pointss=10.

nsamplex

the number of samples of the posterior distribution of the static parameters, obtained by numerical integration. If this posterior is computed via ARMS, nsamplex is the number of samples from the posterior distribution of the static parameters, assuming a burn-in period of 1000. Default: samples=3000.

mcmc

If true, the ARMS method is used to sample the marginal posterior distribution of the static parameters. If false, a grid of points is used to sample the marginal posterior distribution of the static parameters. Otherwise, if the mcmc argument is NULL, a suitable chose is done. Default: mcmc=NULL. Optional argument.

postplot

If true, a graph with the marginal posterior distribution of the static parameters is provided. Optional argument.

contourplot

If true, a countour plot of the posterior distribution of the static parameters is provided. Optional argument.

LabelParTheta

If not NULL, the static parameters are called by the specified label. The default value is NULL. Optional argument.

verbose

A logical variable that gives the user the output of the model fit in the console. Default: TRUE. Optional argument.

Details

Typical usages are

1
2
3
ngssm.bayes(Ytm~Trend+CosAnnual+SinAnnual+CosSemiAnnual+SinSemiAnnual,
data=data.frame(Ytm,Xtm),model=model,StaPar=c(0.8,-0.8,0.01,0.01,0.01,0.01),
prw=c(1,1),prbetamu=rep(0,5),prbetasigma=diag(10, 5, 5),pointss=5,nsamplex=1000)

Value

[[1]]

This function returns the output of Bayesian estimation for the static parameters.

[[2]]

This function returns posterior samples of the static parameters using multinomial sampling scheme.

Note

This function provides summaries of the posterior distribution of the static parameters of the specified model. In an exact way, the posterior is built to make inferences for the static parameters, and samples of it are drawn using multinomial sampling. If the dimensionality of static parameters and the break number of the grid are high, there are many points to evaluate the posterior distribution and, hence, an MCMC method (ARMS) is used to sample the posterior distribution of the static parameters. Furthermore, it is necessary to specify the limits of the parametric space of the model for the ARMS function in the arguments 'lower' and 'upper'.

Author(s)

T. R. Santos

References

Gamerman, D., Santos, T. R., and Franco, G. C. (2013). A Non-Gaussian Family of State-Space Models with Exact Marginal Likelihood. Journal of Time Series Analysis, 34(6), 625-645.

Santos T. R., Gamerman, D., Franco, G. C. (2017). Reliability Analysis via Non-Gaussian State-Space Models. IEEE Transactions on Reliability, 66, 309-318.

See Also

SmoothingF ngssm.mle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
################################################################################ 
##
## PEM Example: the GTE data 
##
################################################################################ 
library(NGSSEML)
data(gte_data)
Ytm = gte_data$V1
## Event: failure, 1.
Event = gte_data$V2  
Breakm = NGSSEML:::GridP(Ytm, Event, nT = NULL)
Xtm = NULL
Ztm = NULL
model = "PEM"
amp = FALSE
##LabelParTheta = c("w")
StaPar = c(0.9)
p = length(StaPar)
nn = length(Ytm)
a0 = 0.01
b0 = 0.01
## points
pointss = 4 
## Posterior sample
nsamplex = 100 
ci = 0.95
alpha = 1-ci
#Bayesian fit
fitbayes = ngssm.bayes(Ytm~Event, data = data.frame(Ytm, Event), model = model, 
pz = NULL, amp = amp, a0 = a0, b0 = b0, prw = c(1, 1), prnu = NULL, 
prchi = NULL, prmu= NULL, prbetamu = NULL, prbetasigma = NULL, ci = ci, 
pointss = pointss, nsamplex = nsamplex, postplot = FALSE, contourplot = FALSE)
################################################################################

NGSSEML documentation built on Sept. 5, 2021, 5:36 p.m.

Related to ngssm.bayes in NGSSEML...