SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Cross Validation error in Biomod2 [ Reply ]
By: Maya Guéguen on 2022-03-14 08:19
[forum:49370]
Hi Danyang,

A new version of biomod2 (4.0) is available on github.
You can install it with the following commands :
library(devtools)
install_github("biomodhub/biomod2")

and check the new documentation here :
https://biomodhub.github.io/biomod2/index.html

Help messages should also be reported onto the github in order to gather everything in the same place :)
https://github.com/biomodhub/biomod2/issues

The BIOMOD_CrossValidation has been updated, hopefully you will not get your error message anymore.

Maya

RE: Cross Validation error in Biomod2 [ Reply ]
By: Danyang Shi on 2022-03-14 06:27
[forum:49369]
Hi Jean,

I encountered the exact same issue. I wonder have you found out a solution for this error? Thanks.

Danyang

Cross Validation error in Biomod2 [ Reply ]
By: Jean Purdon on 2017-09-14 06:50
[forum:45328]
HI All

I have been getting this error when trying to cross validate my model
lowered k for by group: NA because the number of observations was 0

Error in if (i < 1) { : missing value where TRUE/FALSE needed
3.
singlefold(length(i), kk)
2.
dismo::kfold(data@data.species, by = data@data.species, k = k)
1.
BIOMOD_cv(myBiomodData, k = 5, rep = 2, do.full.models = F)

I followed this function from another thread https://r-forge.r-project.org/forum/attachment.php?attachid=313&group_id=302&forum_id=995
but it is still not working.

My code is myRespName <- 'BWwinterAllModelsNO maxent'

# the presence/absences data for our species
myResp <- read.csv("/Users/Jean/Desktop/PhD/Ensemble modeling/Whales/BW/winter/myRespBWwinter.csv")

climate <- stack(c(
list.files('/Users/Jean/Desktop/PhD/Whales env/NoDisttoshoreWinter/', full.names=TRUE
)
))

myRespXY <- read.csv("/Users/Jean/Desktop/PhD/Ensemble modeling/Whales/BW/winter/myRespXYBWwinter.csv")

```


```{r}
# 1. Formatting Data
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = climate,
resp.xy = myRespXY,
resp.name = myRespName,
PA.nb.rep = 5,
PA.nb.absences = 100,
PA.strategy = 'random',
PA.dist.min = 0,
PA.dist.max = NULL,
PA.sre.quant = NULL,
PA.table = NULL,
na.rm = TRUE)
And my output is

-=-=-=-=-=-=-=-= BWwinterAllModelsNO maxent Data Formating -=-=-=-=-=-=-=-=

Response variable name was converted into BWwinterAllModelsNO.maxent
! No data has been set aside for modeling evaluation
> Pseudo Absences Selection checkings...
> random pseudo absences selection
! Some NAs have been automaticly removed from your data
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-= 'BIOMOD.formated.data.PA' -=-=-=-=-=-=-=-=-=-=-=-=

sp.name = BWwinterAllModelsNO.maxent

103 presences, 0 true absences and 886557 undifined points in dataset


4 explanatory variables

bathy chaWinter slope sstwinter
Min. :-6935 Min. : 0.0588 Min. : 0.00 Min. :13.00
1st Qu.:-4814 1st Qu.: 0.1029 1st Qu.: 5.00 1st Qu.:17.96
Median :-4212 Median : 0.1748 Median : 10.00 Median :20.24
Mean :-3854 Mean : 0.3103 Mean : 16.34 Mean :20.58
3rd Qu.:-3227 3rd Qu.: 0.2434 3rd Qu.: 20.00 3rd Qu.:23.47
Max. : -1 Max. :19.7048 Max. :489.00 Max. :27.31


5 Pseudo Absences dataset available ( PA1 PA2 PA3 PA4 PA5 ) with 100
absences in each (true abs + pseudo abs)

Any help would be much appreciated.

Kind regards.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge