Hi Chris and all,
I'm back with some questions about iRSF for which I didn't find answer in the group.
I have telemetry data on jackals: some of them living in areas with low anthropization, others in areas with high levels of anthopization.
My aim is to compare the selection coefficents for some covariate between jackals living in 'natural' areas and those in 'anthropic' areas. The idea is to run rsf.select() for each individual, and then to run mean() in order to have average selection coefficients for 'natural' and 'anthropic' areas.
Some details about my data:
- GPS schedules are irregular between day and night (i.e., more locations at night) for most individuals
- some jackals dispersed or were nomadic, therefore I already selected range residency periods for each individuals (i.e., some jackals have more periods)
- raster covariates depict natural and anthropic features: some of them are
continuous, other are
binary (1=presence, 0= absence). For the latter I did the raster::as.factor() job. (for some jackals, some of the binary rasters are complementary, i.e., their sum covers the ~100% home range of the animal, and I read in a discussion it may represent a problem
here)
- I created two boolean (TRUE/FALSE) covariates depicting the day/night time of the day (animal$day and animal$night)
The example code for one animal is:
animal<-annotate(animal)
animal$day<-animal$sunlight>0
animal$night<-animal$sunlight<=0
Rlist<-list(...) #here i create a list of 7 covariates but I plan to have other 3 covariates
rsf_formula <- ~ day:scale(Cov1)+day:scale(Cov2)+day:scale(Cov3)+day:Cov4+day:Cov5+day:Cov6+day:Cov7+night:scale(Cov1)+night:scale(Cov2)+night:scale(Cov3)+night:Cov4+night:Cov5+night:Cov6+night:Cov7 #scaled covariates are those continuous, all the others are binary
RSF<-rsf.select(data=animal,UD=animal_HR,R=Rlist, formula=rsf_formula, trace=T, verbose=T, reference= 0, max.mem="10 Gb")
And now my issues:
1. Basically any time I run the model it returns some warnings about the memory allocation. Therefore, I started with default values form max.mem term, and I increased gradually up to 10 Gb. In this way the warnings decreased, but never ended, but I suppose I cannot furtherly increase due to next issue (I work on a 16Gb ram PC)
2. The computation time is becoming an issue because it takes ~11 hours for some jackals, but for some others it run for more than 3 days and then it crashes (individual with few GPS locations)
I think this happens for two main reasons:
- the formula term is too long as Chris suggested
here- I'm using Montecarlo integrator since I have time-dependent covariates (i.e., day and night)
How can I solve such problems? Should I split in separate day and night RSFs and use Riemann integrator (but if I try to do it it returns an error at some point
Error in vapply(1:dim(envir)[1], function(i) { :
values must be length 165,
but FUN(X[[1]]) result is length 0)
)?
If you need more info please tell me.
Best
Lorenzo