NH-MSAR-package: (Non) Homogeneous Markov switching autoregressive model

Description Details Author(s) References Examples

Description

NH-MSAR-package is a set of functions to fit, simulate and validate (non) homogeneous Markov Switching Autoregressive models with Gaussian or von Mises innovations.

Details

Package: NH-MSAR
Type: Package
Version: 1.0
Date: 2014-08-11
License: What license is it under?

~~ An overview of how to use the package, including the most important ~~ ~~ functions ~~

Author(s)

Val\'e'rie Monbet, [email protected]

References

Hamilton J.D. (1989). A New Approach to the Economic Analysis of Nonstionary Time Series and the Business Cycle. Econometrica 57: 357-384. Ailliot P., Monbet V., (2012), Markov-switching autoregressive models for wind time series. Environmental Modelling & Software, 30, pp 92-101. Ailliot P., Bessac J., Monbet V., Pene F., (2014) Non-homogeneous hidden Markov-switching models for wind time series. JSPI.

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
	# Fit Homogeneous MS-AR models - univariate time series
data(meteo.data)
data = array(meteo.data$temperature,c(31,41,1)) 
k = 40
T = dim(data)[1]
N.samples = dim(data)[2]
d = dim(data)[3]
M = 2
order = 2
theta.init = init.theta.MSAR(data,M=M,order=order,label="HH") 
mod.hh = fit.MSAR(data,theta.init,verbose=TRUE,MaxIter=20)
regimes.plot.MSAR(mod.hh,data,ylab="temperatures") 
#Y0 = array(data[1:2,sample(1:dim(data)[2],1),],c(2,1,1))
#Y.sim = simule.nh.MSAR(mod.hh$theta,Y0 = Y0,T,N.samples = 1)

## Not run
# Fit Non Homogeneous MS-AR models - univariate time series
#data(lynx)
#T = length(lynx)
#data = array(log10(lynx),c(T,1,1))
#theta.init = init.theta.MSAR(data,M=2,order=2,label="HH")
#mod.lynx.hh = fit.MSAR(data,theta.init,verbose=TRUE,MaxIter=200)
#regimes.plot.MSAR(mod.lynx.hh,data,ylab="Captures number")
## End (not run)

Example output

[1] iteration         1                   loglik =        -2483.76821398985
[1] iteration         2                   loglik =        -2481.46191316325
[1] iteration         3                   loglik =        -2480.50800481965
[1] iteration         4                   loglik =        -2478.91074475992
[1] iteration        5                  loglik =       -2476.9747310187
[1] iteration        6                  loglik =       -2475.1342318885
[1] iteration         7                   loglik =        -2473.64252294242
[1] iteration         8                   loglik =        -2472.53158618905
[1] iteration         9                   loglik =        -2471.70564169704
[1] iteration         10                  loglik =        -2471.04140078367
[1] iteration         11                  loglik =        -2470.43217996723
[1] iteration        12                 loglik =       -2469.7793783761
[1] iteration         13                  loglik =        -2468.94324364113
[1] iteration         14                  loglik =        -2467.65737278721
[1] iteration         15                  loglik =        -2465.61710058432
[1] iteration         16                  loglik =        -2463.09808638148
[1] iteration         17                  loglik =        -2460.73052088291
[1] iteration         18                  loglik =        -2458.75581275823
[1] iteration        19                 loglik =       -2457.1641152218
[1] iteration         20                  loglik =        -2455.85659893545
 [1] NA NA  2  2  2  2  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  2  2
[26]  2  1  1  1  1  1  1  1

NHMSAR documentation built on Dec. 5, 2017, 9:03 a.m.