I'm slowly learning to use the excellent simHMM function to simulate data. Everything works great with a HMMcjs model, but I'm getting an error for a JS specification and I can't figure out why (didn't see any restrictions in the documentation either). Any help to resolve or circumvent would be appreciated.

Example of the issue with some fake data:

- Code: Select all
`library(dplyr)`

library(marked)

df <- structure(list(ch = c("100000000000", "100000000000", "100000000000",

"010000000000", "010000000000", "010000000000", "001000000000",

"001000000000", "001000000000", "000100000000", "000100000000",

"000100000000", "000010000000", "000010000000", "000010000000",

"000001000000", "000001000000"), Group = structure(c(1L,

2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L

), .Label = c("a", "b", "c"), class = "factor"), freq = c(21,

14, 3, 47, 62, 14, 48, 43, 8, 64, 67, 25, 65, 63, 17, 82, 55)), row.names = c(1L,

2L, 3L, 6L, 7L, 8L, 15L, 16L, 17L, 24L, 25L, 26L, 33L, 34L, 35L,

43L, 44L), class = "data.frame")

Then specifying the sim structure

- Code: Select all
`modelspec <- list(Phi = list(formula = ~ 1), p = list(formula = ~ 1),`

pent = list(formula = ~ 1), N = list(formula = ~ 1))

dp.sim <- marked::process.data(df, model="JS")

ddl.sim <- marked::make.design.data(dp.sim)

phi <- 1

p <- -2.8

pent <- -2.6

N <- 6

initial <- list(Phi = phi, p = p, pent = pent, N = N)

realization <- simHMM(dp.sim, ddl.sim, model = "JS", model.parameters = modelspec, initial = initial)