Description Usage Arguments Details Value References Examples
Evaluates the negative penalised log-likelihood function of the HSMM (internal function, called by the function pmleHSMM
).
1 2 3 |
parvect |
vector of unconstraint working parameter as returned by the function |
N |
number of states of the HSMM, integer greater than 1. |
y |
vector containing the observed time series. |
R_vec |
vector of length |
lambda |
vector of length |
order_diff |
order of the differences used for the penalty term, positive integer which does not exceed the length of the unstructured starts. |
y_dist |
character determining the class of state-dependent distributions. Supported values are |
stationary |
Logical, if |
T_y |
length of the observed time series. |
p_ref |
positive integer determining the reference dwell-time probability used for the multinomial logit parameter transformation. Default value is 2. Only needs to be changed if the dwell-time probability for dwell time r=2 is estimated very close to zero in order to avoid numerical problems. |
The penalised log-likelihood function relies on the exact HMM representation of the HSMM and is evaluated using the forward algorithm which is implemented in C++
to speed up the calculation.
Returns the value of the negative penalised HSMM log-likelihood function for the given parameters and time series.
Pohle, J., Adam, T. and Beumer, L.T. (2021): Flexible estimation of the state dwell-time distribution in hidden semi-Markov models. arXiv:https://arxiv.org/abs/2101.09197.
Zucchini, W., MacDonald, I.L. and Langrock, R. (2016): Hidden Markov models for time series: An introduction using R. 2nd edition. Chapman & Hall/CRC, Boca Raton.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # 3-state gamma HSMM and hourly muskox step length
# natural parameters
p_list0<-list()
p_list0[[1]]<-c(dgeom(0:9,0.2),1-pgeom(9,0.2))
p_list0[[2]]<-c(dgeom(0:9,0.2),1-pgeom(9,0.2))
p_list0[[3]]<-c(dgeom(0:9,0.2),1-pgeom(9,0.2))
omega0<-matrix(0.5,3,3)
diag(omega0)<-0
mu0<-c(5,100,350)
sigma0<-c(3,90,300)
R_vec<-sapply(p_list0,length)-1 # lengths of the unstructured starts
# working parameter vector
parvect<-n2wHSMM(N=3,p_list=p_list0,mu=mu0,sigma=sigma0,
omega=omega0,y_dist='gamma')
# evaluate the negative penalised log-likelihood function
npllHSMM(parvect,N=3,muskox$step,R_vec=R_vec,lambda=c(1000,1000,1000),
order_diff=2,y_dist="gamma",T_y=nrow(muskox))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.