how can I create response curves using biomod2?

383 Views Asked by At

I am using R version 3.6.0. I have made some biomod models. There is one factor among my environmental variables. When I am trying to create response plots this error comes up:

Error in subinfo == "MinMax" : 
  comparison (1) is possible only for atomic and list types

The code I use is:

SumGBMs <- BIOMOD_LoadModels(WgBiomodModelOut, models='GBM')
SumGBM_repcurves <- response.plot2(model= SumGBMs ,
                                  Data = WgBiomodModelOut,
                                  show.variables= get_formal_data(WgBiomodModelOut, dem),
                                  fixed.var.metric = 'median',
                                  col = c("blue", "red"),
                                  legend = TRUE,
                                  plot=T)

although I don't think that's the problem, but I have tried to use github biomod2:

devtools::install_github("biomodhub/biomod2", dependencies = TRUE)

but it did not work and the following erro0r showed up:

Error: Failed to install 'biomod2' from GitHub:
  (converted from warning) installation of package ‘C:/Users/NP/AppData/Local/Temp/RtmpAtIiba/file70c6f00293b/biomod2_3.4-03.tar.gz’ had non-zero exit status

Can you tell me what goes wrong?

Thanks

1

There are 1 best solutions below

0
On

I think you are not giving to response.plot2 function what it expects.

Data should be a data.frame with the same explanatory variables than the one used in model fitting process

show.variables should be the name of the explanatory viarable you want to display in the response plot

Maybe something like that will work:

SumGBMs <- BIOMOD_LoadModels(WgBiomodModelOut, models='GBM')
SumGBM_repcurves <- response.plot2(model= SumGBMs ,
                                  Data = get_formal_data(WgBiomodModelOut, 'expl.var'),
                                  show.variables= get_formal_data(WgBiomodModelOut, 'expl.var.names'),
                                  fixed.var.metric = 'median',
                                  col = c("blue", "red"),
                                  legend = TRUE,
                                  plot=T)