TheoreticalEcology / s-jSDM

Scalable joint species distribution modeling
https://cran.r-project.org/web/packages/sjSDM/index.html
GNU General Public License v3.0
68 stars 14 forks source link

gaussian fit #152

Open billurbektas opened 1 week ago

billurbektas commented 1 week ago

Hi, I was exploring the option to fit a gaussian distribution to my abundance data (324 sites x 600 species). The model runs, however later anova and Rsquared functions are giving an error. I was wondering if this an error from my part or it is just that the gaussian fit is not fully implemented yet as stated in the error. Thank you very much in advance for your support!

mod.cal = sjSDM(Y = as.matrix(veg.abund), env = linear(data = veg.env, formula = ~MAT + AP), spatial = linear(data = veg.env, formula = ~0+x*y), family = gaussian("identity"), se = TRUE, verbose = TRUE, iter = 20)

Rsquared(mod.cal, verbose = FALSE) #0.01 Error in py_call_impl(callable, call_args$unnamed, call_args$named) : TypeError: add() received an invalid combination of arguments - got unrecognized keyword arguments: dtype, device Run reticulate::py_last_error() for details. In addition: Warning message: In get_null_ll(model, verbose = verbose) : family = gaussian() is not fully supported yet.

an = anova(mod.cal, verbose = FALSE, samples = 10) Error in anova.sjSDM(mod.cal, verbose = FALSE, samples = 10) : gaussian not yet supported

MaximilianPi commented 5 days ago

Hi @billurbektas,

Thanks for your interest in sjSDM.

Yes, there was no support for family = gaussian() until now. However, I just pushed an update to the development version (basically the github version). You will need to reinstall sjSDM by running

devtools::install_github("https://github.com/TheoreticalEcology/s-jSDM", subdir = "sjSDM", ref = "master")

It has not been thoroughly tested yet, but some initial checks indicate reliable results. Feel free to report here if you see anything suspicious.

PS: You do not have to re-install the python setup, only the R package must be updated to the github/development version

billurbektas commented 5 days ago

@MaximilianPi Thank you so much for this quick update on the package! I will test and let you know asap!