I am having trouble with fit an ssm using a move persistence model. The current issue is: Error in rep$pdHess : $ operator is invalid for atomic vectors
As all my columns are atomic vectors, I am not to sure how to fix this issue.
Also, bonus question as this model only allows me to run through one animal at a time do you know an easy way for me to run through them all such as in a loop - I have over 60 animals.
Below is a snipet of data I am working with for one of my animals: My code is:
fit <- fit_ssm(Shark3,
vmax = 3,
model = "mp",
time.step = 24,
control = ssm_control(verbose = 0))
id date lc lat lon
3 03/16/2016 00:36:39 A -31.50391 106.90178
3 03/16/2016 00:36:39 A -31.50391 106.90178
3 03/16/2016 00:36:39 A -31.50391 106.90178
3 03/16/2016 08:48:20 B -39.82062 146.76394
3 03/16/2016 15:58:14 B -39.93783 146.81515
3 03/17/2016 06:44:00 B -40.0844 146.89076
3 03/19/2016 18:53:24 B -41.0345 148.13549
3 08/11/2016 03:17:00 1 -25.46735 153.41662
3 08/11/2016 03:17:00 1 -25.46735 153.41662
3 08/11/2016 03:17:00 1 -25.46735 153.41662
3 04/18/2016 22:50:43 B -40.23962 147.57244
3 04/19/2016 00:37:50 B -40.20943 147.56543
3 04/19/2016 00:37:50 B -40.20943 147.56543
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 06:26:00 2 -40.57273 148.41413
3 04/10/2016 08:52:00 B -40.58898 148.4267
3 04/11/2016 23:41:00 A -40.60004 148.32712
3 04/11/2016 23:41:00 A -40.60004 148.32712
3 04/11/2016 23:41:00 A -40.60004 148.32712
3 04/12/2016 13:33:00 A -40.53807 148.3033
3 04/12/2016 13:33:00 A -40.53807 148.3033
3 04/12/2016 13:33:00 A -40.53807 148.3033
3 04/14/2016 22:11:31 B -40.5596 148.37321
3 04/14/2016 22:11:31 B -40.5596 148.37321
3 04/16/2016 21:13:08 0 -40.30304 147.74462
3 04/16/2016 21:13:08 0 -40.30304 147.74462
3 04/16/2016 21:13:08 0 -40.30304 147.74462
3 04/16/2016 21:13:08 0 -40.30304 147.74462
3 04/17/2016 05:13:25 B -40.30302 147.72642
3 04/18/2016 03:13:06 B -40.35905 147.66374
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/18/2016 21:50:10 3 -40.2418 147.57622
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 04/24/2016 03:46:23 3 -40.43101 147.94571
3 05/11/2016 15:19:00 B -40.58412 148.49763
3 05/11/2016 07:34:00 1 -40.5991 148.50535
3 05/11/2016 07:34:00 1 -40.5991 148.50535
3 05/11/2016 07:34:00 1 -40.5991 148.50535
3 05/11/2016 07:34:00 1 -40.5991 148.50535
The issue lies with the
TMBpackage, which is a dependency ofaniMotum. ForaniMotumto work,TMBneeds theMatrixpackage, you need to haveMatrix_1.6-5installed, withR 4.3.2. So in this exact order first run:then quit R/RStudio. Also, update R to the latest version if necessary. Second, start R/RStudio and run:
and now try again:
It will throw this warning, maybe due to your sample data being a subset, or your data are not well suited for ssm and/or mp, but cannot confirm:
Either way, here are the results:
And for the bonus question: obviously this is a sub-optimal example given the size of the data, but it is ok for illustrative purposes: