Setting initial parameter in Hidden Markov Model for vulture movement data

36 Views Asked by At

I want to perform HMM on the movement data of resident and migrating vultures with very high resolution sampling (5min resolution). I am facing problem in setting the initial parameter. The step lengths range from 3500m to 0.1m and the angles range from -4 to 2.5, roughly. I don't find any literature reference as well, particularly for birds or raptors. I am using 'hmmTMB' in R.

> #creating HMM object
> hmmhg1 <- HMM$new(obs = obs1, hid = hidhg1)
> hmmhg1
#######################
## Observation model ##
#######################
+ step ~ gamma2(mean, sd) 
* mean.state1 ~ 1
* mean.state2 ~ 1
* sd.state1 ~ 1
* sd.state2 ~ 1

+ angle ~ vm(mu, kappa) 
* mu.state1 ~ 1
* mu.state2 ~ 1
* kappa.state1 ~ 1
* kappa.state2 ~ 1

> Initial observation parameters (t = 1):
            state 1 state 2
step.mean         1       5
step.sd           1       5
angle.mu          0       0
angle.kappa       1       5

#########################
## State process model ##
#########################
        state 1 state 2
 state 1       .      ~1
 state 2      ~1       .

> Initial transition probabilities (t = 1):
        state 1 state 2
state 1     0.9     0.1
state 2     0.1     0.9

> #model fitting
> hmmhg1$fit(silent = TRUE)
Error in self$hid()$update_delta0(delta0) : 
  'delta0' should have 1 rows and 2 columns
 In addition: Warning message:
 In hmmhg1$fit(silent = TRUE) :
  Convergence code was not zero, indicating that the optimizer may not have converged to the     correct estimates. Please check by consulting the out() function which shows what optimx returned.`
1

There are 1 best solutions below

0
Théo Michelot On

Initial parameter values should ideally be close to the "true" parameters, to make model fitting easier from a numerical standpoint. So, a good approach is to look at the data, think about how the data might be divided into 2 (or more) states, and then come up with plausible values for the model parameters. You mentioned that the variable step ranges between 0.1 and 3500, for example, so it seems unlikely that the mean values you chose (1 and 5) are appropriate here.

It is difficult to make specific suggestions without seeing a histogram of the data, but maybe you could try 10m and 100m for the two states, i.e.:

# observation distributions
dists <- list(step = "gamma2", angle = "vm")

# initial parameter values
par0 <- list(step = list(mean = c(10, 100), sd = c(10, 100)),
             angle = list(mu = c(0, 0), kappa = c(1, 5)))

# create observation model
obs1 <- Observation$new(data = data, 
                        dists = dists,
                        n_states = 2,
                        par = par0)

Note that I just chose the same values for the standard deviations as for the means because, in my experience, they tend to be of the same order of magnitude.

Some general references that might be helpful:

  • We wrote a short vignette about selecting initial parameter values for animal movement HMMs a while ago, for the R package moveHMM, and many of the ideas apply regardless of the package: "A short guide to choosing initial parameter values for the estimation in moveHMM".

  • I also wrote about selecting initial parameter values for hmmTMB in Section 5 of the following vignette: "Advanced features of hmmTMB"

  • The hmmTMB function $suggest_initial() can help come up with initial parameter values. It uses K-means clustering to define some rough "states", and then returns parameter estimates for those states. You would call something like obs1$suggest_initial(), and update your initial parameter values accordingly. Note: this function might not work in the current CRAN version of the package (v1.0.2), and you might need to install the development version from Github, e.g. using devtools::install_github("TheoMichelot/hmmTMB").