simHMM with JS model

questions concerning analysis/theory using the R package 'marked'

simHMM with JS model

Postby SoConfused » Fri Nov 08, 2019 2:06 pm

Hello,

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)
   
SoConfused
 
Posts: 53
Joined: Wed Nov 05, 2014 8:25 am

Re: simHMM with JS model

Postby jlaake » Fri Nov 08, 2019 3:07 pm

No simHMM in RMark. The JS model is not an HMM (Hidden Markov Model) formulation. I don't think any model including N can be formulated as an HMM but I could be wrong about that. You could simulate the entrants and the time first seen and then feed that to the cjshmm to simulate the rest of the capture history. I'll look at code but I thought it would reject model if not an HMM.

--jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: simHMM with JS model

Postby SoConfused » Fri Nov 08, 2019 5:11 pm

Ah, I see where I went wrong. I knew that the marked package handled JS models, so just jumped to conclusions. Now have to figure out how to simulate JS data...
SoConfused
 
Posts: 53
Joined: Wed Nov 05, 2014 8:25 am

Re: simHMM with JS model

Postby cooch » Fri Nov 08, 2019 5:14 pm

Simple -- use MARK. You can simulate JS (and most other data types) right from within MARK.
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University


Return to analysis help

Who is online

Users browsing this forum: No registered users and 16 guests