variogram.fit error

106 views
Skip to first unread message

Sérgio Ferreira

unread,
Oct 2, 2020, 2:55:54 PM10/2/20
to ctmm R user group
Hi,

I am working on CTMM variogram vignette and I faced an unexpected behaviour in the last part of the code following:

###
setwd("~/Documents/R/wd/ctmm")
library(ctmm)
dataDF<-read.csv("~/R/csv/m04.csv")
m04 <- as.telemetry(dataDF,timezone="GMT",projection=NULL)
plot(m04, type="o", main=" Relocations, col="blue")
vg.m04 <- variogram(m04)
level <- c(0.5,0.95) # 50% and 95% CIs
xlim <- c(0,12 %#% "hour") # 0-12 hour window
plot(vg.m04,xlim=xlim,level=level)
plot(vg.m04,fraction=0.65,level=level)
### here the problem begins
variogram.fit(vg.m04, CTMM=ctmm(),name="GUESS", interactive = TRUE, fraction=0.5)
FITS <- ctmm.select(dataDF,GUESS,verbose=TRUE)

  The sliders that should be shown after "variogram.fit" function be applied doesn't appeared neither "guesstimate" button. But the related variogram image was generated. Also the "GUESS" variable wasn't created by the function and the next step (model selection) falls into error.
# the error message
Error in ctmm.select(dataDF, GUESS, verbose = TRUE) :
  object 'GUESS' not found


I had tried to run through a "hard way" method, as It is in the vignette, and everything works fine for me. I am wondering if there is a bug, something that I put out of the place in the "easy way" method or something that I missed?

As I am a beginner with ctmm package any help will be very welcomed.

Best regards,
Sergio.


Christen Fleming

unread,
Oct 2, 2020, 4:54:54 PM10/2/20
to ctmm R user group
Hi Sergio,

I think a recent update to either the manipulate R package or RStudio has been giving people random issues with slider functionality. I had the same issue with zoom() a while back and just checked today and it's magically fixed itself. I would keep the manipulate package and Rstudio updated, and run the slider function twice if necessary. In the TWS workshop Tuesday (~50 participants), we had ~3 people with this issue, unfortunately. One participant fixed it by loading the manipulate package explicitly with library(manipulate), and I think the other participants had it work after running the function twice.

To run the function non-interactively, which doesn't require a button to click, you can just do

GUESS <- ctmm.guess(m04,variogram=vg.m04,interactive=FALSE)

Best,
Chris
Message has been deleted

Sérgio Ferreira

unread,
Oct 2, 2020, 8:08:36 PM10/2/20
to ctmm R user group
Hi Chris,

thanks for the prompt answer.

I ran non-interactively way, exactly as you recommended, but now there is another one error output:

 > Error in z[i, ] : subscript out of bounds 

This message can be useful?

I am working on Linux Debian 10, RStudio version 1.3.1073 and CTMM 0.5.10. I will try downgrade "manipulate" library. If It works I will let you know.

As I am able to run in "hard way", I believed there is no OS library problem (missing or incompatible). 

Best regards,

Sergio

Christen Fleming

unread,
Oct 2, 2020, 9:06:46 PM10/2/20
to ctmm R user group
Hi Sergio,

I suspect you put the variogram object first into the ctmm.guess() function? It takes the telemetry object first, with the variogram object as optional. This function has superseded the old variogram.fit() function, which only has the variogram argument.

Best,
Chris
Message has been deleted

Sérgio Ferreira

unread,
Oct 17, 2020, 1:40:57 AM10/17/20
to ctmm R user group


Hi Chris,

right between the eyes!!!

Tks,

Sergio.
Reply all
Reply to author
Forward
0 new messages