r-a-dobson / dynamicSDM

An R package for species geographical distribution and abundance modelling at high spatiotemporal resolution
https://github.com/r-a-dobson/dynamicSDM
4 stars 2 forks source link

error in the function brt_fit #15

Closed fernandabiologia closed 1 month ago

fernandabiologia commented 2 months ago

Hi,

I'm following the dynamicSDM: Model fitting and autocorrelation tutorial to test the package prior running it with my own dataset which is much larger.

When I get to the step to fit the model using brt_fit() I get this error message:

"Error in gbm.fit(x = x, y = y, offset = offset, distribution = distribution, : Bernoulli requires the response to be numeric in {0,1}"

I'm simply following the tutorial and I haven't made any changes. I double checked whether the reponse variable column was numeric and only contained 0s and 1s. Everything looks fine, so I'm not sure what is happening.

Thanks,

Fernanda.

r-a-dobson commented 2 months ago

Hi Fernanda

This was an expected change as the gbm package has recently updated. The latest upload of dynamicSDM to CRAN should have rectified this bug. Could you please confirm that the latest version of dynamicSDM (1.3.4) is installed?

Best wishes Rachel

EDIT: Just realised the changes uploaded to CRAN had not yet been uploaded to GitHub. Now if you install using either install.packages or install_github, you will get the fixed brt_fit().

fernandabiologia commented 2 months ago

Hi Rachel,

Yes, that was the issue, I was using the github version because that's where you fixed the issue with the spatial thinning. I installed the CRAN version after seeing your message and it did run the model. So, great to know that you added all the changes to the github version :).

Thank you very much,

Fernanda.