1

I use the maxnet function (maxnet package) as one of the model algorithms in an ensemble model. Sometimes, the code executes without an error. Other times, it gives me the error message you see below. I am working on a windows 10 Pro (R version 3.6.1, Rstudio version 1.2.5042).

Code:

dm.Maxent <- maxnet(p = train$species, data = train[-train$species],
                    maxnet.formula(p = train$species,
                         data = train[-train$species],
                         classes = "default"))

Error:

Error in intI(j, n = x@Dim[2], dn[[2]], give.dn = FALSE) : 
index larger than maximal 185

train is a dataframe with 621 rows (one row for every occurrence/absence point), and 29 columns (28 columns containing variables and 1 column "species" that indicates presence or absence of the species (0/1)).

Dharman
  • 30,962
  • 25
  • 85
  • 135
Anne Enco
  • 55
  • 7

1 Answers1

0

I am having the same issue. It is unpredictable, since for several species it ran fine, then out of a sudden it stopped.

I found a response on this link: https://github.com/jamiemkass/ENMeval/issues/62

In the new version of maxnet (check the Github repo, as it looks like the CRAN version gas not been updated yet), there is a new argument "addsamplestobackground". When set to TRUE, it solves some of these errors. Currently, you will have to use install_github to reinstall maxnet to use this argument. Once you do, install_github to get the dev branch version of ENMeval (v2), which will implement this by default. Hopefully that fixes these problems.

I reinstalled maxnet from github :

install.packages("remotes")
remotes::install_github("mrmaxent/maxnet")

and set addsamplestobackground = T Maybe this would help you.

Machavity
  • 30,841
  • 27
  • 92
  • 100