MTDest {hdMTD} | R Documentation |
EM estimation of MTD parameters
Description
Estimation of MTD parameters through the Expectation Maximization (EM) algorithm.
Usage
MTDest(
X,
S,
M = 0.01,
init,
iter = FALSE,
nIter = 100,
A = NULL,
oscillations = FALSE
)
Arguments
X |
A vector or single-column data frame containing an MTD chain sample ( |
S |
A numeric vector of positive integers. Typically, |
M |
A stopping point for the EM algorithm. If |
init |
A list with initial parameters: |
iter |
Logical. If |
nIter |
An integer positive number with the maximum number of iterations. |
A |
A vector with positive integers representing the state space. If not informed,
this function will set |
oscillations |
Logical. If |
Details
Regarding the M
parameter: it functions as a stopping
criterion within the EM algorithm. When the difference between
the log-likelihood computed with the newly estimated parameters
and that computed with the previous parameters falls below M
,
the algorithm halts. Nevertheless, if the value of nIter
(which represents the maximum number of iterations) is smaller
than the number of iterations required to meet the M
criterion,
the algorithm will conclude its execution when nIter
is reached.
To ensure that the M
criterion is effectively utilized, we
recommend using a higher value for nIter
, which is set to a
default of 100.
Concerning the init
parameter, it is expected to be a list
comprising either 2 or 3 entries. These entries consist of:
an optional vector named p0
, representing an independent
distribution (the probability in the first entry of p0
must be
that of the smallest element in A
and so on), a required list
of matrices pj
, containing a stochastic matrix for each
element of S
( the first matrix must refer to the smallest
element of S
and so on), and a vector named lambdas
representing
the weights, the first entry must be the weight for p0
, and then one entry
for each element in pj
list. If your MTD model does not have an independent
distribution p0
, set init$lambda[1]=0
.
Value
A list with the estimated parameters of the MTD model.
References
Lebre, Sophie and Bourguignon, Pierre-Yves. (2008). An EM algorithm for estimation in the Mixture Transition Distribution model. Journal of Statistical Computation and Simulation, 78(1), 1-15. doi:10.1080/00949650701266666
Examples
# Simulating data.
# Model:
MTD <- MTDmodel(Lambda=c(1,10),A=c(0,1),lam0=0.01)
# Sampling a chain:
X <- hdMTD::perfectSample(MTD,N=2000)
# Initial Parameters:
init <- list('p0'=c(0.4,0.6),'lambdas'=c(0.05,0.45,0.5),
'pj'=list(matrix(c(0.2,0.8,0.45,0.55),byrow = TRUE,ncol=2),
matrix(c(0.25,0.75,0.3,0.7),byrow = TRUE,ncol=2)))
# MTDest() ------------------------------------
MTDest(X,S=c(1,10),M=1,init)
MTDest(X,S=c(1,10),init=init,iter = TRUE)
MTDest(X,S=c(1,10),init=init,iter = TRUE,nIter=5)
MTDest(X,S=c(1,10),init=init,oscillations = TRUE)