sylvainschmitt / SSDM

Stacked Species Distribution Modelling R package
Other
41 stars 17 forks source link

GUI: Maximum likelihood method #26

Closed lawrence44 closed 4 years ago

lawrence44 commented 6 years ago

Hello Sylvain,

I am a PhD student with a basic understanding of R. I am trying to run stacked SDM using the GUI in your SSDM package. I have 5 continuous environmental layers and 18 species. I am using presence only data. Despite selecting the parameters correctly and selecting a diversity mapping method I keep receiving this error message:

Warning: Error in .checkargs: method parameter should be pSSDM, Bernoulli, bSSDM, MaximumLikelyhood, PRR.MEM, or PRR.pSSDM (see help). Stack trace (innermost first): 71: .checkargs 70: stack_modelling 69: eval 68: eval 67: withProgress 66: observeEventHandler [C:/R Installation/R-3.4.4/library/SSDM/shiny/gui/server.R#636] 2: shiny::runApp 1: gui

Do you have any suggestions?

Many thanks for your time, Lawrence

lawrence44 commented 6 years ago

Right, so some issues I have been having were due to duplicated presence records in the csv. I think the error above however, is due to two different spellings of MaximumLikelyhood (and MaximumLikelihood, in the function and the GUI.

All the best, Lawrence

lawrence44 commented 6 years ago

Hi Sylvain,

Could you shed any light on this error which is returned instantly after pressing the model button on GUI?

Warning in eval(e, x, parent.frame()) : Incompatible methods ("Ops.data.frame", "Ops.factor") for "==" Warning: Error in ==: comparison of these types is not implemented Stack trace (innermost first): 76: eval 75: eval 74: subset.data.frame 73: subset 72: FUN 71: lapply 70: stack_modelling 69: eval 68: eval 67: withProgress 66: observeEventHandler [C:/R Installation/R-3.4.4/library/SSDM/shiny/gui/server.R#636] 2: shiny::runApp 1: gui

Thanks, Lawrence

sylvainschmitt commented 6 years ago

Hello, what type of model are you building. Are you specifically using PPR.MEM ? Because another user spotted a bug that I corrected on GitHhub but which is still not on CRAN. Try to install the package from CRAN with following command and see if the bug persist:

devtools::install_github("sylvainschmitt/SSDM")

Let me know how it goes.

lawrence44 commented 6 years ago

Hi, I was trying to use maximum likelihood but R throws an error when this is selected: see first post. Other methods seem to work now I have remedied the ops.dataframe error. This was fixed either by using CAPS for variable names, removing underscores from the occurrence filename, or by loading up package 'parallel' prior to running models.

All the best, Lawrence

sylvainschmitt commented 6 years ago

Hello, effectively there is a typo in the argument name but except that the minimal example is working on my local machine:

data(Env)
data(Occurrences)
SSDM <- stack_modelling(c('CTA', 'SVM'), Occurrences, Env, rep = 1,
                        Xcol = 'LONGITUDE', Ycol = 'LATITUDE',
                        Spcol = 'SPECIES', method = "MaximumLikelyhood")

Could you be clearer on your bug ?

lawrence44 commented 6 years ago

Hi Sylvain,

Yes the code written manually works fine but when using the GUI it is not possible to run a maximum likelihood method stacked SDM -

Warning: Error in .checkargs: method parameter should be pSSDM, Bernoulli, bSSDM, MaximumLikelyhood, PRR.MEM, or PRR.pSSDM (see help). Stack trace (innermost first): 71: .checkargs 70: stack_modelling 69: eval 68: eval 67: withProgress 66: observeEventHandler [C:/R Installation/R-3.4.4/library/SSDM/shiny/gui/server.R#636] 2: shiny::runApp 1: gui ERROR: [on_request_read] connection reset by peer

Sorry I cannot be more helpful, I am a beginner.

sylvainschmitt commented 6 years ago

Don't worry you already seem to have spot a bug in the GUI and it's great because I couldn't truly completely test all the GUI. I will let you know as soon as I fix the bug, if it's really that.

lukasbaumbach commented 4 years ago

this was due to a typo in the code. fixed since v0.2.6.9001