fit.MSAR.VM: Fit von Mises (non) homogeneous Markov switching...

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

View source: R/fit.MSAR.VM.R

Description

Fit von Mises (non) homogeneous Markov switching autoregressive models by EM algorithm. Non homogeneity may be introduced at the intercept level or in the probability transitions. The link functions are defined in the initialisation step (running init.theta.MSAR.VM.R).

Usage

1
2
3
4
fit.MSAR.VM(data, theta, 
           MaxIter = 100, eps = 1e-05, verbose = FALSE, 
           covar.emis = NULL, covar.trans = NULL, 
           method = NULL, constr = 0, ...)

Arguments

data

array of univariate or multivariate series with dimension T*N.samples*d. T: number of time steps of each sample, N.samples: number of realisations of the same stationary process, d: dimension.

theta

initial parameter obtained running function init.theta.MSAR.R; object of class MSAR.

MaxIter

maximum number of iteration for EM algorithm (default : 100)

eps

Tolerance for likelihood.

verbose

if verbose=TRUE, the value of log-likelihood is printed at each EM-algorithm's iteration

covar.emis

array of univariate or multivariate series of covariate to take into account in the intercept of the autoregressive models. The link function is defined in the initialisation step (running init.theta.MSAR.R).

covar.trans

array of univariate or multivariate series of covariate to take into account in the transition probabilities. The link function is defined in the initialisation step (running init.theta.MSAR.R).

method

permits to choice the optimization algorithm if numerical optimisation is required in M step. Default : "ucminf". Other choices : "L-BFGS-B", "BFGS"

constr

if constr = 1 constraints are added to theta

...

other arguments

Details

The homogeneous MSAR model is labeled "HH" and it is written

P(X_t|X_{t-1}=x_{t-1}) = Q_{x_{t-1},x_t}

with X_t the hidden univariate process defined on \{1,\cdots,M \}

Y_t|X_t=x_t,y_{t-1},...,y_{t-p}

has a von Mises distribution with density

p_2(y_t|x_t,y_{t-s}^{t-1}) = \frac {1}{b(x_t,y_{t-s}^{t-1})} \exp≤ft(κ_0^{(x_t)} \cos(y_t-φ_0^{(x_t)})+ ∑_{\ell=1}^sκ_\ell^{(x_t)} \cos(y_t-y_{t-\ell}-φ_\ell^{(x)})\right)

which is equivalent to

p_2(y_t|x_t,y_{t-s}^{t-1}) =\frac{1}{b(x_t,y_{t-s}^{t-1})} ≤ft|\exp≤ft([γ_0^{(x_t)} + ∑_{\ell=1}^sγ_\ell^{(x_t)} e^{iy_{t-\ell}}]e^{-iy_t}\right)\right|

b(x_t,y_{t-s}^{t-1}) is a normalization constant.

Both the real and the complex formulation are implemented. In practice, the complex version is used if the initial κ is complex.

The model with non homogeneous transitions is labeled "NH" and it is written

P(X_t|X_{t-1}=x_{t-1}) = q(z_t,θ_{z_t})

with X_t the hidden process and q von Mises link function such that

p_1(x_t|x_{t-1},z_{t}) =\frac{ q_{x_{t-1},x_t}≤ft|\exp ≤ft(\tildeλ_{x_{t-1},x_t} e^{-iz_{t}} \right)\right|} {∑_{x'=1}^M q_{x_{t-1},x'}≤ft|\exp ≤ft(\tildeλ_{x_{t-1},x'} e^{-iz_{t}} \right)\right|},

with \tildeλ_{x,x'} a complex parameter (by taking \tildeλ_{x,x'}=λ_{x,x'} e^{iψ_{x,x'}}).

Value

For fit.MSAR and its methods a list of class "MSAR" with the following elements:

Returns a list including:

..$theta

object of class MSAR containing the estimated values of the parameter and some descriptors of the fitted model. See init.theta.MSAR.VM for a detailled description.

..$ll_history

log-likelihood for each iterations of the EM algorithm.

..$Iter

number of iterations run before EM converged

..$Npar

number of parameters in the model

..$BIC

Bayes Information Criterion

..$smoothedprob

smoothing probabilities P(X_t|y_0,\cdots,y_T)

Author(s)

Valerie Monbet, valerie.monbet at univ-rennes1.fr

References

Ailliot P., Bessac J., Monbet V., Pene F., (2014) Non-homogeneous hidden Markov-switching models for wind time series. JSPI.

See Also

init.theta.MSAR.VM, regimes.plot.MSAR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
	## Not run
# data(WindDir)
# T = dim(WindDir)[1]
# N.samples = dim(WindDir)[2]
# Y = array(WindDir,c(T,N.samples,1))
# von Mises homogeneous MSAR
# M = 2
# order = 2
# theta.init = init.theta.MSAR.VM(Y,M=M,order=order,label="HH")
# res.hh = fit.MSAR.VM(Y,theta.init,MaxIter=3,verbose=TRUE,eps=1e-8)
## von Mises non homogeneous MSA
# theta.init = init.theta.MSAR.VM(Y,M=M,order=order,label="NH",ncov=1,nh.transitions="VM")
#theta.init$mu = res.hh$theta$mu
#theta.init$kappa = res.hh$theta$kappa
#theta.init$prior = res.hh$theta$prior
#theta.init$transmat = res.hh$theta$transmat
#theta.init$par.trans = matrix(c(res.hh[[M]][[order+1]]$theta$mu,.1*matrix(1,M,1)),2,2)
#Y.tmp = array(Y[2:T,,],c(T-1,N.samples,1))
#Z = array(Y[1:(T-1),,],c(T-1,N.samples,1))
#res.nh = fit.MSAR.VM(Y.tmp,theta.init,MaxIter=10,verbose=T,eps=1e-8,covar.trans=Z)

Example output



NHMSAR documentation built on Feb. 9, 2022, 9:06 a.m.

Related to fit.MSAR.VM in NHMSAR...