init.theta.MSAR: Initialisation function for MSAR model fitting

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

View source: R/init.theta.MSAR.R

Description

Initialization before fitting (non) homogeneous Markov switching autoregressive models by EM algorithm. Non homogeneity may be introduce at the intercept level or in the probability transitions. The link functions are defined here.

Usage

1
2
init.theta.MSAR(data, ..., M, order, regime_names = NULL, nh.emissions = NULL, 
nh.transitions = NULL, label = NULL, ncov.emis = 0, ncov.trans = 0,cl.init="mean")

Arguments

data

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

M

number of regimes

order

order of AR processes

label

"HH" (default) for homogeneous MS AR model \ "HN" for non homogeneous emissions \ "NH" for non homogeneous transitions \ "NN" for non homogeneous emissions and non homogeneous transitions

regime_names

(optional) regime's names may be chosen

nh.emissions

link function for non homogeneous emissions. If nh.emissions="linear" (default) linear link is used. If you define an other function it should follow the sample nh.emissions <- function(covar,par.emis) with par.emis of dimension M by ncov.emis+1.

nh.transitions

link function for non homogeneous transitions. If nh.transitions="gauss" (default) gaussian link is used. If M=2, "logistic" may be chosen. If you define an other function it should follow the sample nh.transitions <- function(covar,par.trans,transma) with par.emis of dimension M by ncov.trans+1.

ncov.emis

number of covariates in HN model

ncov.trans

number of covariates in NH model

cl.init

allows to choose the initialization method.

...

Details

The default implemented link function for non homogneneous intercept is the linear function

A0_t^{(x)} = θ_{A0}^{(x)} Z(t)

θ_{A0}^{(x)} denotes a line vector here. Other link functions can be defined using nh.emissions (see above).

The default implemented link function for non homogneneous transitions is the Gauss function. Transition from i to j is defined as follows.

f(Z,θ_Q,Q;i,j) = Q_{ij} \exp≤ft(-\frac{1}{2}\frac{(Z-θ_Q^{(j)}(1))^2}{θ_Q^{(j)}(2)}\right)

then f is normalized in order to define a stochastic matrix.

When, only two regimes are considered, the logistic link can be used. Probability of staying in state i is defined as follows

f(Z,θ_Q,Q;i,i) = ε+(-2-ε)/(1+\exp(θ_Q^{(i)}(1)+θ_Q^{(i)}[2:(d_Z+1)] Z))

f(Z,θ_Q,Q;i,j) = 1-f(Z,θ_Q,Q;i,i)

with Z the covariate and eqnd_Z its dimension (number of covariates)

Value

return a list of class MSAR including

theta

parameter

..$transmat

transition matrix

..$prior

prior probabilities

..$A

list including the autoregressive coefficients (or matrices)

..$A0

intercepts

..$sigma

variances of innovations

..$par.emis

parameters of non homogeneous emissions

..$par.trans

parameters of non homogeneous transitions

label

model's label

Author(s)

Val\'erie Monbet, valerie.monbet at univ-rennes1.fr

References

Ailliot, Monbet

See Also

fit.MSAR

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
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]

# Fit Homogeneous MS-AR models
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=10)
regimes.plot.MSAR(mod.hh,data,ylab="temperatures") 

## Not run
# Fit Non Homogeneous MS-AR models
#theta.init = init.theta.MSAR(data,M=M,order=order,label="NH",nh.transitions="gauss")
#attributes(theta.init)
#mod.nh = fit.MSAR(array(data[2:T,,],c(T-1,N.samples,1)),theta.init,verbose=TRUE,MaxIter=50,
#covar.trans=array(data[1:(T-1),,],c(T-1,N.samples,1)))
#regimes.plot.MSAR(mod.nh,data,ex=40,ylab="temperature (deg. C)")

## Not run
# Fit Non Homogeneous MS-AR models to lynx data
#data(lynx)
#data = array(lynx,c(length(lynx),1,1))
#theta.init = init.theta.MSAR(data,M=2,order=2,label="NH",nh.transitions="logistic")
#attributes(theta.init)
#mod.lynx = fit.MSAR(array(data[2:T,,],c(T-1,1,1)),theta.init,verbose=TRUE,MaxIter=200,
#covar.trans=array(data[1:(T-1),,],c(T-1,1,1)))
#regimes.plot.MSAR(mod.lynx,data,ylab="Captures number")

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