Kate
Kate

Reputation: 1

'sdm' function ensemble model warning messages ('rf', 'gam', 'mars')

I'm running into warning messages when I include several model methods into my 'sdmData' function. Here's the code:

d <- sdmData(formula = sp~.,train=PO, predictors=env_raster, bg=background)

#PO = SpatialPointsDataFrame
#sp = presence-only data
#env_raster = raster stack of 5 layers
#background = dataframe with coordinates and values for each of the 5 environmental layers

m1 <- sdm(sp~.,data=d,methods=c('mars', 'maxlike', 'glm', 'rf', 'gam', 'brt'), replication = c('cv'), cv.folds=5)

Here are the warning messages from each individual package: 'rf' - Warning: The response has five or fewer unique values. Are you sure you want to do regression? 'mars' - Warning: glm.fit: algorithm did not converge Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred Warning: the glm algorithm did not converge for response "sp"

Additionally, my 'gam' model has zero successful model runs.

I've been following the 'sdm' package tutorial. Here is a partial view of the 'sdmdata' file being input into the 'sdm' function:

str(d)
Formal class 'sdmdata' [package "sdm"] with 9 slots
  ..@ species.names: chr "sp"
  ..@ species      :List of 1
  .. ..$ sp:Formal class '.species.data' [package "sdm"] with 8 slots
  .. .. .. ..@ name       : chr "sp"
  .. .. .. ..@ type       : chr "Presence-Background"
  .. .. .. ..@ presence   : num [1:128] 1 2 3 4 5 6 7 8 9 10 ...
  .. .. .. ..@ absence    : NULL
  .. .. .. ..@ background : num [1:9991] 129 130 131 132 133 134 135 136 137 138 ...
  .. .. .. ..@ abundance  : NULL
  .. .. .. ..@ numerical  : NULL
  .. .. .. ..@ Multinomial: NULL 

I have tried to convert the presence values in 'd' to factors, but this creates 128 level.

Here are previews of my inputs:

head(PO)
  sp
1  1
2  1
3  1
4  1
5  1
6  1

head(background)
        x        y  mean_NDVI soil_moisture     fish insulation soil_nutrient
1 1233499 474434.2  0.6909310     1.2899151 1.281423  0.1708845     0.2821959
2 1208509 479954.2  0.2846706     1.5684123 1.210001  0.2893450    -1.0284775
3 1213729 461984.2 -0.4229073     1.2899151 1.262468  0.2301146    -1.0284775
4 1206619 470384.2  0.6999793     1.5684123 1.257669  0.1708845    -1.0284775
5 1223149 468404.2 -1.3116429     1.8469099 1.252390  0.2301146    -1.0284775
6 1244779 450044.2  0.7546983     0.1759251 1.137140  0.3485751     0.9375325

Does anyone have any solutions?

Upvotes: 0

Views: 23

Answers (0)

Related Questions