Issues integrating ctmm output into amt for iSSF

15 views
Skip to first unread message

Ashlyn Halseth

unread,
Sep 4, 2025, 4:27:00 PMSep 4
to ctmm R user group
ctmm newbie here. I am using amt to do an iSSA. I'm working with a GPS collar data set where 3 of my collars were set to a 3-hour fix rate, and 7 of them were set to a 2-hour fix rate. Rather than rarefy my data to 6-hour intervals, I was hoping to use the simulate function in ctmm to "retake" points every 2 hours for my collars set to the 3-hour fix rate. The ctmm part of my code is working like a charm, my issue is when I start integrating it into amt. Here, when I use the amt function track_resample, to make my bursts (which iSSA needs to make the random points), my fix rates switch back to three hours and I lose A LOT of points. Any ideas where the problem could be? Snippets of my code are below:

Here is what I am doing in ctmm:
#animal1 is a dataframe with GPS locations of one animals with three-hour fix rates
animal1 <- as.telemetry(animal1)
guess1 <- ctmm.guess(animal1, interactive = FALSE)
fit_animal1 <- ctmm.fit(animal1, guess1)
new_dt <- 2 %#% "hours"
resampled_animal1 <- simulate(animal1, CTMM = fit_animal1,
                              complete = TRUE,  dt = new_dt)
#then I saved my output as a dataframe, which looks like this:
Screenshot 2025-09-04 162217.png

Here is what I'm doing with amt: 
#locations is my new as.data.frame where I combined all my cleaned data points together
tempdeer <- filter(locations, id == animal1)
tempdeertk <- make_track(tempdeer, .x = x, .y = y, .t = datetime, crs = crs_zone, id = id)
#when I check my average fix rate here, it is 1.65 hours for animal1 with 6384 points
 tempdeertk <- track_resample(tempdeertk, rate = hours(2), tolerance = minutes(5))
#when I check my average fix rate here, it is 2.99 hours for animal1, with 3529 points

At this point, my tempdeerktk now looks like this:
Screenshot 2025-09-04 162434.png
For animals that I did not have to change the fix rate with ctmm (the collars originally set to 2 hours) my fix rate and number of points stays the same. I've also changed my tolerance threshold to different settings to try and see if this will help, it doesn't.  

Thanks in advance for any help with my problem, or if you see an error in my code that I am not currently seeing. 

Ashlyn

Jesse Alston

unread,
Sep 4, 2025, 4:50:36 PMSep 4
to Ashlyn Halseth, ctmm R user group
Hi Ashlynn,

Your date_time column is showing 1.5-hr steps, so I think this code is just dividing the 3-hour gap by 2. I personally would use the t= argument to generate a sequence of times at which to sample the data.

This is a cool idea and something I've been trying to convince colleagues to try, but I would also do something like create an occurrence distribution and check probabilities for the pixels that your simulated points fall within, to make sure the deer likely did visit those pixels. You will also want to use GEEs or something similar to make sure the CIs for your selection coefficients are robust.

Jesse

--
You received this message because you are subscribed to the Google Groups "ctmm R user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ctmm-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ctmm-user/7ad26912-718d-4beb-88ed-6b0c94648febn%40googlegroups.com.


--

Christen Fleming

unread,
Sep 14, 2025, 4:56:56 PM (6 days ago) Sep 14
to ctmm R user group
Hi Ashlynn,

The dt argument here was coded for filling in gaps rather than resampling, so the output isn't what you want, but like Jesse said, you can specify an exact time sequence that you want with the t argument.
Additionally, there is an internal function ctmm:::grid.init() that will optimize the start time to best match a grid of given resolution to the times sampled in the data: https://github.com/ctmm-initiative/ctmm/blob/7ecaf01ba5f1e5d5aea1d92c8244e1696b3c6eeb/R/variogram.R#L152
Otherwise, there is ambiguity in how to align the sequence when you are completely changing the sampling like this. I could export and document this function if people wanted to use it more widely.

Best,
Chris
Reply all
Reply to author
Forward
0 new messages