ctmm models questions

835 views
Skip to first unread message

Benoît CHTIOUI

unread,
Apr 24, 2017, 3:10:45 PM4/24/17
to ctmm R user group
Hello, 

So I have been sending a mail to some of the staff contributing ctmm and I have been advised to ask the question here, so there it is:

I am a Master year 1 student on a internship with Bonnaud Elsa and Castaneda Irene, working on the territorial behavior of domestic cats. 
I am trying to model the home range of a few cats depending on location and season.
So far I have done MCPs, I have had problems with finding the good parameters for KDE in the adehabitat package and I have been talking with Simon Benhamou about MKDEs.

My data has some holes in it but series of autocorrelated relocations which is what I understood aimed to be modelled in the ctmm package.

The problem I am encountering is that with my data the only models I end up with the command "summary(fitted.mods)" are half of the time OU & OUF, with OU being the best AIC and the other half of the time only OUF.

I have tried the commands in the Calabrese 2016 article with the buffalo Cilla data and there again I only end up with OUF model (instead of the 6 in the example in the article).

Could anyone of you help me with this problem?

Thank you very much, my best regards,


CHTIOUI Benoît

Christen Fleming

unread,
Apr 24, 2017, 4:16:54 PM4/24/17
to ctmm R user group
Hi Chtioui,

This is now covered in the FAQ: https://ctmm-initiative.github.io/ctmm/reference/ctmm-FAQ.html or help("ctmm-FAQ") in R.

In older versions of ctmm there was a small number of models to select from (3x2=6), but in the next version of ctmm (0.4.0) there is a much, much larger number of possible models, to the point where trying every possible model is highly prohibitive (and very wasteful). ctmm.select now semi-intelligently iterates though models as they seem probable, starting from the most complex autocorrelation model and working towards the most complex trend model. You can adjust this threshold with the level argument. level=1 will consider all nearby models each iteration.

If there are more models that you want to consider, you can always fit them and add them to the list before running summary(). I do this when I want to showoff how badly some basic movement modeling assumptions are.

If there are any cases where ctmm.select() fails to select the lowest AICc model, please let me know. In your case, if you take your data returning only OUF and use level=1, then I hope it will be the case that the OU models have much higher AICc.

Also, I would recommend the newest version of ctmm on CRAN (0.3.6) if you have very small sample sizes, as it has more correct multivariate AICc formulas and the selection algorithm becomes appropriately more aggressive in the small sample size regime.

Best,
Chris

Benoît CHTIOUI

unread,
Apr 25, 2017, 4:14:11 AM4/25/17
to ctmm R user group
Hello and thank you very much for the fast answer.

So I have been doing the level=1 with 2 dataset so far, one which had the OU+OUF, OU being the best and one wich had OUF only.
They both had 5 models showing: OU anis. OUF anis. IID anis. OU iso. and OUF iso.
Both showed me the OU being the best model (lowest dAICc) whereas without level I had one without this model: do you know why wouldnt the OU be showed in some dataset even though it is the best considering dAICc?

Also, as I have to compare quite a lot of datasets, what can I do if some dataset have not the same model having the best dAICc? Since they have to be compared, as far as I have been teached, they have to be modeled the same way, but my knowing falls short on this subject.

Thank you again, and by the way, my name is Benoît, in french sometime the surname/familyname can be placed first, which apparently does not exist in english.

Regards,

Benoît

Christen Fleming

unread,
Apr 25, 2017, 4:31:38 PM4/25/17
to ctmm R user group
Hi Benoît,

I confused your first name with Benoit. My French is not very good.

I am curious if you have data with a very small number of locations. I recently upgraded the AICc formulas from the standard univariate formula to a multi-variate approximation from Burnham & Anderson and made ctmm.select() more aggressive in the small sample size regime. If your sample size is very small, I would like to know if you get better results in the newer version of the package on CRAN (0.3.6).

If this issue is not solved by the latest package changes and if you can email me a data example, then I will investigate this to see what is going wrong. The asymptotic p-value for rejecting the null hypothesis of no parameter (from AIC) is ~15.7% and ctmm.select() is testing at 1% (1-level) by default, which should be fairly safe if the confidence intervals are reasonably correct I think.

As far as comparing data with different models, (1) you can still compare outputs like home-range area from akde(), and (2) these are nested models so they actually share many of the same parameters. OU and OUF share the same position autocorrelation timescale, which is roughly the time it takes for the animal to cross its range.

Best,
Chris

Benoît CHTIOUI

unread,
Apr 26, 2017, 7:59:54 AM4/26/17
to ctmm R user group
Hello,

No problem, this is because I am putting my name the french way.

So my data has between 200 and 1700 relocations for each dataset that needs a HR.
I have updated the ctmm i have to 3.6 and for the same data set, not including any levels in the command displays
                dAICc DOF[mean]
OUF anisotropic     0  355.4331

if I include levels = 1, it displays
                     dAICc DOF[mean]
OU anisotropic    0.000000  355.8520
OUF anisotropic   2.028319  355.4331
OU isotropic    131.286234  378.1549
OUF isotropic   133.304704  378.0072
IID anisotropic 399.920432  888.0000

That is what I find wierd, so should I send you the data I have which displays this?

Thanks,

Benoît 

Christen Fleming

unread,
Apr 26, 2017, 8:55:02 AM4/26/17
to ctmm R user group
Hi Benoît,

Please email me the data if you will. I would like to take a look at it.

Best,
Chris

Christen Fleming

unread,
Apr 27, 2017, 12:03:44 PM4/27/17
to ctmm R user group
Hi Benoît,

I have fixed two bugs that I came across when fitting to your data, but this will not be on CRAN for a while. If you have the package "devtools" installed, then you can update your package from GitHub via the command:

devtools::install_github("ctmm-initiative/ctmm")

Some other things I noticed in your data:
  1. With the sampling rate being so variable, increasing the "res" option of variogram made a difference.
  2. With the sampling rate being so high (~5 minute interval), you are in a regime where GPS errors are significant, as the distance the animal travels in 5 minutes can be comparable to the telemetry error. Unfortunately, I did not see any columns in the data that would correspond to error like "DOP" or the number of satellites. Turning on an error model in ctmm without this extra information then corresponds to homoscedastic errors, which is only an okay assumption if the GPS unit is kept out in the open. When fitting the OU model without error (which is default) I obtained a 7-9 minute estimate for the range crossing time. When fitting with error (which took forever) I obtained a 30-100 minute estimate for the range crossing time, 27-32 meter estimate for the error, and the AIC dropped by over 100. A better error model would probably perform even better and look more like the variogram. Are there any extra columns that you can get for this data?
Also, is this a domestic cat?

Best,
Chris

Benoît CHTIOUI

unread,
Apr 28, 2017, 9:58:19 AM4/28/17
to ctmm R user group
Hello,

Sorry for the late answer.

Thank you for the fix.

About the data: the phd student I am working with could not extract from the GPS's the column number of satellites and error estimated (with this kind of GPS, they need to do something before the data collecting which they did not know until now). I have tried to correct the data with ArcGis, deleting the high altitudes or too low and deleting relocations way too far away without a 5min interval path. The data seemed corrected the best we could with what we were provided from the GPS.
I do not know if we can do anything without this data (errors and numbers of satellites).

Yes the study are about domestic cats that are not ferals but associated with households.

I now have a new question: my tutor asked me if we could have the AKDE/OU 50% aside from the 95% so we can compare with the MCP's. Is there a way to apply a KDE50% to the models of your packages?

Excuse me if I don't understand all of the parameters/subtilities of your model as I have entered the home-range studies 3 weeks ago.

Thanks,

Benoît

Christen Fleming

unread,
Apr 28, 2017, 4:09:57 PM4/28/17
to ctmm R user group
Hi Benoît,

I would also try an OUF model with homoscedastic error (tweaking the model guess first to match the variogram calculated with high res~10 argument for the sampling variability).
I had faster and more accurate convergence on fitting the OU model + error using some new optimization routines that I have written, but aren't yet documented or fully tested. You can access this with control=list(method="pNewton") in ctmm.fit or ctmm.select. Both this method and the default Nelder Mead from R's optim are safe in that you can use the fit object again as a starting guess and see if you can get any further improvement.

With your data and its abundance, I think the biggest issue is the telemetry error, which, if not accounted for, will inflate the home range area estimate.

The UD object generated by akde() contains all possible % regions, which you can plot or summarize with the level.UD argument. 95% is just the default.

Best,
Chris

Benoît CHTIOUI

unread,
May 2, 2017, 3:45:11 AM5/2/17
to ctmm R user group
Hello,

I tried the control=list(method="pNewton") and the result were the same as without this in the ctmm.select.
For the OUF with homoscedastic error, I do not know how to do this.

And this telemetry error there is nothing I can do about it? If not I hope that the fact it appears on all my data will be biased the same way so there is no fake answer between the response variables.

I tried to do the akde 50:
plot(w.telem, UD=w.akde, level.UD=95)
summary(w.akde, level.UD=50)

w.telem is the telemetry and w.akde the akde of this telemetry.
The result I get for the plot:
Error in contour.default(kde$r, z = kde$CDF, levels = level, labels = labels,  : 
  valeurs de contours NA incorrectes

And the result I get for the summary
> summary(w.akde, level.UD=50)
$DOF
     area bandwidth 
 269.2061  331.3189 

$CI
                     low      ML     high
area (hectares) 21.55809 24.3842 27.38184
(which is 5x larger than the summary without level whereas I thought 50% was supposed to be smaller than the 95%)


Thank you for your time,

Benoît

Christen Fleming

unread,
May 2, 2017, 5:54:10 PM5/2/17
to ctmm R user group
Hi Benoît,

control=list(method="pNewton") should give the same results as the default optimization method if both are working correctly. When I was working on your data, trying various models, I found the new non-default method to be a bit more accurate and much faster.

The important question is whether ctmm.select worked correctly for you after updating the ctmm package from GitHub?

OUF with error is just the full model you put into ctmm.select the first time, but with error>0. There should be an error slider at the bottom of the manipulate panel when you run ctmm.guess or variogram.fit. I would try to adjust that to match the initial discontinuity of the variogram (which is more apparent when you increase the "res" option of variogram to account for the sampling variability).

If you can get the initial part of the variogram to better match the fitted model with error, then I would feel more comfortable about having accounted for the telemetry errors. Unfortunately, this individual does not move very far relative to the size of GPS telemetry error, which makes the errors a large part of these data.

If the homoscedastic assumption is good (which I have no idea for your case), you might also try taking some calibration data feeding it through the uere() function. We haven't published a paper on that yet, but it is documented and I can show you how to use it.

The level.UD option needs to be level.UD=0.50 for the 50% core range. See help("summary.UD").

Best,
Chris

Benoît CHTIOUI

unread,
May 3, 2017, 4:55:10 AM5/3/17
to ctmm R user group
Hello,

I updated the ctmm to the new version manually from the ZIP in the R page.

When I am doing the variogram.fit, I always go the the lowest res to get the line higher or lower according to the data then I slide the tau bar at a higher resolution to fit the curve to the data I have.
There is indeed an error bar but sliding it doesnt seem to change anything in the graph.

I went to see the uere() function which needs a HDOP value in the raw data which we don't have. We are missing errors (numbers of satellites and a column error) that we can not get back now because we did not know when we extracted the data that we could get this variables so we only have the location, date, altitude and speed.

Thank you, I did not know how to see the help as it is a summary and a plot and the help there did not help me on UD.


Regards,

Benoît

Christen Fleming

unread,
May 4, 2017, 2:32:14 PM5/4/17
to ctmm R user group

Hi Benoît,

These fixes are only yet in the Github repository, which you can install from with the command

devtools::install_github("ctmm-initiative/ctmm")

I have fixed the error slidder bug in the repository. It was just a rendering bug.

I get the attached image for fitting the OU model with homoscedastic error. The variance looks generally high, but the initial error part (initial discontinuity) looks to fit well.
Even with the high variance, the resulting home-range UDs still looked tighter than the data (which should be the case because of the telemetry error inflates this).
I didn't get any difference with the OUF model. Even with an error model, the velocity autocorrelation timescale was still estimated to be zero.

With calibration data, you could make a fake HDOP column of 1s, but I don't think that would help much here, because the error terms seems to be fitting well now that I have sorted out these bugs. (This is the danger of using unpublished features! You get to be the first to test them.)

Best,
Chris

Benoît CHTIOUI

unread,
May 5, 2017, 3:44:00 AM5/5/17
to ctmm R user group
Hello,

Well, all this is good. Thank you very much for all your answers and advices.
Even if there is still some remain of telemetry error, this model will still be more accurate in my opinion that the MCP I am comparing them to. 

Thank you very much for this is a good opportunity, to use a recent model that takes into account all the features of my data, for a master first year internship.

Best regards,

Benoît
Reply all
Reply to author
Forward
Message has been deleted
0 new messages