Re: Question about Cilla example and my own species variogram

331 views
Skip to first unread message

Marina FP

unread,
Apr 9, 2018, 3:48:53 PM4/9/18
to ctmm R user group
Hello, 

I have two questions regarding some behavior of the CTMM package. 

1) I was running the example code featuring Cilla today (04/09/2018) and I didn't get the same summary info. Only one model type is given from summary(fitted.mods) (Picture attached). I ran this code last week and the summary() function gave the same results shown in the publication. I am not sure what is different this week?

2) I created a variogram for an individual from my data but it seems really odd....Maybe it is the amount of data? There are only 42 locations spread over two months with only 14 days of location data. And at max there are 5 locations a day, with a minimum of 1 per day. I have attached a pic with my code, head of data, and variogram. 

Thanks for your help. 

Best-Marina
Cilla.JPG
MySpecies.JPG

Christen Fleming

unread,
Apr 10, 2018, 4:00:54 PM4/10/18
to ctmm R user group
Hi Marina,

1) Maybe you updated the ctmm package? Newer versions of the ctmm package include too many possible models to attempt all models, so the code is a little smarter about only attempting more likely models. You can force all nearby models to be considered with the level=1 argument.

2) You might want to try the dt argument with something like dt=c(1/5,1) %#% "day" or whatever seems appropriate, and also maybe fast=FALSE. There is a vignette section on the dt argument in vignette("variogram"). Variograms require somewhat regular data for visualization, but the model fitting does not require this.

Best,
Chris

Marina FP

unread,
Apr 10, 2018, 4:11:07 PM4/10/18
to ctmm R user group
Hi Chris, 

Okay, thank you for the clarification. And yeah I have the most up-to-date version of ctmm so that is probably it. 

So the oddness of the variogram won't negatively affect the models and I shouldn't worry about the visualization? I can just run the models with the data I have and they will estimate home range size effectively? At least as effectively as the data will allow at least. 

Thanks again-Marina

Christen Fleming

unread,
Apr 11, 2018, 10:42:18 PM4/11/18
to ctmm R user group
Hi Marina,

The variograms are used for two things:
1) To get a good initial guess for optim to find the MLE. You can get around this by making a scatter shot of biologically plausible initial guesses for parameters, checking for convergence, re-fitting, adding one new parameter at a time, etc..
2) To check to make sure that the model resembles/explains the data at all timescales. You won't be able to do this if you can't make good variograms. This doesn't impact fitting, but the result becomes somewhat blackbox.

If you have multiple individuals, you might might also consider pooling a list of shoddy variograms with the mean() function... in addition to the dt argument.

Best,
Chris

Marina FP

unread,
Apr 17, 2018, 3:17:39 PM4/17/18
to ctmm R user group
Hi Chris, 

Okay thanks for the clarification. Sorry for the delay in my response. 

I have 20 individuals with 2 individuals that have data from two different years. How would I pool the variograms and how would that be integrated into a species model for home range? Would you will willing to provide some example code? I am only just starting to use this package and I am relatively new to home range analysis. 

Thank you for your help. 

Best-Marina

Christen Fleming

unread,
Apr 18, 2018, 9:40:55 AM4/18/18
to ctmm R user group
Hi Marina,

To pool the variograms, you just apply the mean() function to a list of variograms. There is a help file with example for this under help("mean.variogram") and also a section covering this in vignette("variogram").

In your case, if the sampling is very irregular, you also need to be careful about calculating each variogram with compatible dt arguments. From what you said, I guessed dt=c(1/5,1) %#% "day" and fast=FALSE inside variogram(), but you might have to fiddle with dt.

The average variogram could then be used for initial parameter guesses and to compare against the selected model as usual in vignette("variogram"), just keeping in mind that individual model fits don't have to be exactly like the average variogram.

Best,
Chris

Marina FP

unread,
Apr 18, 2018, 4:01:46 PM4/18/18
to ctmm R user group
Hi Chris, 

I hadn't found the vignette so thank for that! It is very helpful. 

In an attempt to work with all my individuals together, I am trying to important a large csv with all my individuals into R. However I run into this warning message when using this code Allbird_tel<-as.telemetry(Allbird,timezone="HST", projection=NULL)
Warning messages:
1: In max(v) : no non-missing arguments to max; returning -Inf
2: In min(dt) : no non-missing arguments to min; returning Inf

When I just try to import one individual I don't get the error. I get the same error with both the CRAN and GitHub version. Used CRAN first than uninstalled and downloaded form GitHub. 

I have attached what my data looks like before using as.telemetry()

Thanks again for all your help!

Best-Marina
AllData.JPG

Christen Fleming

unread,
Apr 19, 2018, 4:11:49 PM4/19/18
to ctmm R user group
Hi Marina,

I haven't seen that error. If you can message/email me a copy of your data, then I can take a look at it.

Best,
Chris

Marina FP

unread,
Apr 19, 2018, 4:20:07 PM4/19/18
to ctmm R user group
Hi Chris, 

Yeah I can email it. Do you have an email address your prefer? If you don't want to post it here my work email is marina.fis...@nau.edu

Thanks-Marina

Christen Fleming

unread,
Apr 21, 2018, 3:41:42 PM4/21/18
to ctmm R user group
Hi Marina,

R's as.POSIXct() is very finicky. I supplied what seemed like the proper timeformat argument, and the import looked sane after that

> DATA <- as.telemetry("../DATA/Marina Fisher-Phelps/MergeBird.csv",timezone="HST",timeformat="%m/%d/%Y %H:%M")
Maximum speed of 0.238 m/s observed in AL
Minimum sampling interval of 5 minutes in AL
Maximum speed of 0.303 m/s observed in Bill
Minimum sampling interval of 5 minutes in Bill
Maximum speed of 0.188 m/s observed in BK/DB
Minimum sampling interval of 5 minutes in BK/DB
Maximum speed of 0.348 m/s observed in BK/WH
Minimum sampling interval of 5 minutes in BK/WH
Maximum speed of 0.292 m/s observed in DB/DB/DB
Minimum sampling interval of 2 minutes in DB/DB/DB
Maximum speed of 0.253 m/s observed in DB/PK
Minimum sampling interval of 5 minutes in DB/PK
Maximum speed of 0.278 m/s observed in Earl
Minimum sampling interval of 5 minutes in Earl
Maximum speed of 0.272 m/s observed in Joe
Minimum sampling interval of 5 minutes in Joe
Maximum speed of 0.431 m/s observed in NE2002
Minimum sampling interval of 5 minutes in NE2002
Maximum speed of 0.422 m/s observed in NE2004
Minimum sampling interval of 5 minutes in NE2004
Maximum speed of 0.19 m/s observed in net12
Minimum sampling interval of 5 minutes in net12
Maximum speed of 0.894 m/s observed in PK/GR
Minimum sampling interval of 60 seconds in PK/GR
Maximum speed of 1.29 m/s observed in RD/DB
Minimum sampling interval of 4 minutes in RD/DB
Maximum speed of 0.187 m/s observed in RD/RD
Minimum sampling interval of 5 minutes in RD/RD
Maximum speed of 0.336 m/s observed in RD/RD.DB
Minimum sampling interval of 5 minutes in RD/RD.DB
Maximum speed of 4.72 m/s observed in RD/WH
Minimum sampling interval of 5 minutes in RD/WH
Maximum speed of 2.11 m/s observed in RD/WH.RD
Minimum sampling interval of 2 minutes in RD/WH.RD
Maximum speed of 0.513 m/s observed in Wog
Minimum sampling interval of 5 minutes in Wog
Maximum speed of 0.477 m/s observed in YE/DB
Minimum sampling interval of 5 minutes in YE/DB
Maximum speed of 2.06 m/s observed in YE/RD
Minimum sampling interval of 5 minutes in YE/RD
Maximum speed of 6.75 m/s observed in YE/YE.DB
Minimum sampling interval of 3 minutes in YE/YE.DB
Maximum speed of 0.285 m/s observed in YE/YE3_2003
Minimum sampling interval of 5 minutes in YE/YE3_2003
Maximum speed of 0.324 m/s observed in YE/YE3_2004
Minimum sampling interval of 5 minutes in YE/YE3_2004

Best,
Chris

Marina FP

unread,
Apr 24, 2018, 2:31:56 PM4/24/18
to ctmm R user group
Hi Chris, 

Sorry for my delay in responding. Thank you so much for helping me with that! 

So before you had mentioned that I would need to supply something to the dt argument (fast=FALSE) because of my inconsistent sampling scheme. I have played around with DT and don't really get anything better...different. I have attached the DT you suggested (IndivdualVario_DTchange). I have also done the mean variogram (no DT specified=PopVario_DTstandard) and played with dt (PopVario_DTchanged). I have also ran some periodogram diagnostics on some of the individuals and it seems that periodicity isn't a huge issue...just the inconsistent sampling scheme. 

I was reading the supplementary info about the individual Pepper within your paper in Methods in Ecology. So with everything I have tried and still getting weird variograms for all individuals and population...Would it be fair to say that the CTMM models based on my variograms are at least indicative of home range size for these individuals and population? Or is the data just too sporadic? 

Thank again for all your help. 

Best-Marina
IndivdualVariogram_DTchange.JPG
PopVario_DTchange.JPG
PopVario_DTstandard.JPG

Christen Fleming

unread,
Apr 25, 2018, 5:15:15 PM4/25/18
to ctmm R user group
Hi Marina,

The population variogram with dt argument looks good enough to make out range residence. I would compare my models to that to see that the asymptote is roughly consistent.

The data can be too sporadic for the variograms to look good, but model fitting is more robust and will just have some wider confidence intervals.

Best,
Chris

Marina FP

unread,
Apr 27, 2018, 3:51:05 PM4/27/18
to ctmm R user group
Hi Chris, 

Great! Thank you for your help and advice with these individuals! 

Best-Marina

Marina FP

unread,
May 1, 2018, 3:33:50 PM5/1/18
to ctmm R user group
Hi Chris, 

I would like to compare home range estimates via auto-correlated kernel density estimation and uncorrelated KDE. I saw in your Methods pub that this is done using the akde() function with CTMM=ouf and CTMM=iid, respectively. 

However when I run ctmm.select from some of my models I do not get an IID model. Is there a way to coerce ctmm.select to report IID? Also some of my individuals get IID as the ideal model...though with some warnings....

>fitted.1 <- ctmm.select(AllTel[[1]], CTMM=GUESS, verbose=TRUE)
> summary(fitted.1)
                   dAICc DOF[mean]
OUF anisotropic 0.000000  23.90075
OU anisotropic  3.001458  22.10013


Also some of my individuals get IID as the ideal model...though with some warnings... I am assuming it is still fair to compare between IID and OUF but with the assumption that IID is better for this indivdual?

> fitted.2 <- ctmm.select(AllTel[[2]], CTMM=GUESS, verbose=TRUE)
Warning messages:
1: In cov.loglike(hess, grad) : MLE is near a boundary or optim failed.
2: In cov.loglike(hess, grad) : MLE is near a boundary or optim failed.
3: In cov.loglike(hess, grad) : MLE is near a boundary or optim failed.
> summary(fitted.2)
                    dAICc DOF[mean]
IID anisotropic  0.000000        56
OU anisotropic   2.149495        56
OUF anisotropic  4.380103        56
OU isotropic    14.468870        56


Also if I wanted to compare across individuals for home range size is it fair to compare across individuals that may using different model types (i.e. OUF vs OU vs IID)? 

Thanks for your help. 

Best-Marina


Christen Fleming

unread,
May 2, 2018, 8:40:54 PM5/2/18
to ctmm R user group
Hi Marina,

ctmm.select is more efficient now that the number of potential models has grown, but you can throw any model into the mix by concatenating with the list like for the above:

IID <- ctmm.fit(AllTel[[1]])
fitted.1 <- c(fitted.1,list(IID=IID))
summary(fitted.1)


Those warnings are expected in that case. If IID is selected, there is little support for tau_position in the OU model, which means that the ML tau_position is near the boundary of tau_position=0.

You always want to use the best model. Different movement behaviors & sampling schedules necessitate different movement models, with some having features not supported by all datasets. That doesn't mean the features do not exist in the animal's true movement behavior. It just means that the data cannot resolve those features.

Best,
Chris

Marina FP

unread,
May 3, 2018, 1:57:26 PM5/3/18
to ctmm R user group
Hi Chris, 

Great thank you! This helps immensely. I have really appreciated your continued help with understanding CTMM. 

Best-Marina
Reply all
Reply to author
Forward
0 new messages