rsf.fit() mean() error

28 views
Skip to first unread message

adrian...@gmail.com

unread,
Apr 6, 2026, 2:42:07 PMApr 6
to ctmm R user group
Hi Chris and Jesse,

I ran rsf.fit and now I am trying to run mean(). I got the error pasted below and have not been able to figure it out. I wonder if you have any guess what would be happening here:


for(i in 1:length(sheeps_2023))
{
  print(i)
  # fit horizontal movement model
  GUESS <- ctmm.guess(sheeps_20232[[i]],CTMM=ctmm(error=20),interactive=F)
  Y2023_FITS[[i]] <- ctmm.select(sheeps_20232[[i]],GUESS,trace=2, cores = -4)
 
  Y2023_AKDE[[i]] <- akde(sheeps_20232[[i]],Y2023_FITS[[i]],weights=T, SP=mask, SP.in = T, trace=TRUE)
  Y2023.RSF[i]] <- rsf.fit(sheeps_20232[[i]], Y2023_AKDE[[i]], R, formula= ~ slope+aspect+tri+elevation+
                              core_escape+near_escape+mid_escape+far_escape+water+
                              grassland+shrubland+coniferous+ndvi+south_facing, integrated= T,
                            standardize = T, trace=T)
}

Y2023.RSF is attached to this message. Thanks for the help. Best, Adrian

Y2023.RSF_mean<-mean(Y2023.RSF) Fitting location-mean model Dirac-δ(μ) Fitting location-mean model isotropic-μ Fitting location-mean model anisotropic-μ
Error in if (any(abs(par) == Inf)) { : missing value where TRUE/FALSE needed
iRSFSheep2023Apr6.Rdata

Christen Fleming

unread,
Apr 19, 2026, 4:49:36 PMApr 19
to ctmm R user group
Hi Adrian,

I can work on making the mean() code a little more robust in this example, but you need to use rsf.select() rather than rsf.fit() before meta-analytic methods like mean(), because the uncertainties become numerically ill conditioned when parameters aren't supported by the data. Additionally here, the number of covariates exceeds the degrees of freedom in some of the tracks, which means that the bias correction diverges. rsf.select() will fix this issue as well.

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