Help with ctmm fractal fits and speed() errors on deer telemetry (camera trap data)

28 views
Skip to first unread message

Sierra McMurry

unread,
May 15, 2025, 4:20:19 PMMay 15
to ctmm R user group

Subject: Help with ctmm fractal fits and speed() errors on deer telemetry


Dear Chris,

I hope you’re doing well. I’m a PhD student using ctmm (v1.2.0) to estimate smoothed average speeds (km/day) for White-tailed Deer from AI-derived camera-trap coordinates, and I’ve run into a few roadblocks. Below is a concise summary of my workflow, the errors/warnings I’m seeing, and the specific guidance I’m hoping you could provide.


1. My current workflow

  • Data prep: Read and merge two CSVs (merged_results_pilot.csv + sequences_pilot.csv), filter to common_name == "White-tailed Deer", parse timestamps with mdy_hms(), rename AI outputs to longitude/latitude, and drop duplicates by (sequence_id, timestamp).

  • Telemetry object: Thin the data to one fix every 5 s, then call

tel5 <- as.telemetry(

  df_thin5,

  timeformat = "auto",

  timezone   = "UTC",

  projection = "+proj=utm +zone=12 +datum=WGS84 +units=m +north"

)


  • Model fitting loop: For each track in tel5, I do

GUESS <- ctmm.guess(tel_i, CTMM = ctmm(error = 1.19), interactive = FALSE)

FIT   <- ctmm.fit (tel_i, GUESS)

spd   <- speed   (tel_i, CTMM = FIT, dt.max = 86400, robust = TRUE)

speed_results[[id]] <- spd$CI["speed (kilometers/day)", "est"]


2. What’s happening

  • ctmm.fit() often fails with warnings like

pREML failure: indefinite ML Hessian or divergent REML gradient  

MLE is near a boundary or optimizer failed  

Movement model is fractal.


  • When a fit returns an IID/fractal model, speed() errors out:

Movement model is fractal.

subscript out of bounds

no applicable method for 'speed' applied to an object of class "logical"


  • Even when I force an OU fit and then call

spd_ou <- ctmm::speed(

  tel_i,

  CTMM   = ou_fit,

  dt.max = 86400,

  robust = TRUE

)

# Warning: Movement model is fractal.


  • I still get Warning: Movement model is fractal. and no km/day estimate.


3. What I need help with

  1. Forcing or reliably fitting an OU or OUF model (with finite range and/or velocity autocorrelation) so that speed() will return meaningful km/day estimates.

  2. Best practice for excluding the fractal/IID family—should I specify model="OU" or model="OUF" in ctmm.guess(), or supply a custom CTMM = list(...) to ctmm.select()?

  3. Tuning suggestions for UERE settings, optimizer controls (e.g. control=list(maxit=…)), or ctmm.guess() parameters to avoid boundary/divergence issues.

Any pointers to code examples, CTMM internals, or vignette sections would be hugely appreciated. Thank you for your time and for developing this fantastic package!

Best regards,
Sierra McMurry
PhD Candidate, Dept. of Wildlife Biology



Christen Fleming

unread,
Jun 4, 2025, 12:03:45 AMJun 4
to ctmm R user group
Hi  Sierra,

pREML failure: indefinite ML Hessian or divergent REML gradient  
MLE is near a boundary or optimizer failed  

These are warnings (not errors) to let you know that ctmm.select() should be used over ctmm.fit(), as there are unsupported parameters in the model.

Movement model is fractal.

This is a warning that the model doesn't have continuous velocities. This isn't an error yet though.

subscript out of bounds

This error is happening because you are referencing the row with specific units, but the units changed. To keep the units fixed, you can use the argument units=FALSE and then everything will come out in meters per second (SI units).

The IID and OU models will not provide finite speed estimates, though they may be the best models for the data. I haven't seen your data, so I can't say if that should be the case or not. This could be correct, or it could be that the error model is too conservative or something. I would plot some tracks colored by time to see if you can see any indication of persistence of motion.

Something else that the OU model can still provide are diffusion rate estimates from summary() of the fit object. This is an alternative measure of movement rate.

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