LLeiSong / itsdm

Purely presence-only species distribution modeling with isolation forest and its variations such as Extended isolation forest and SCiForest.
https://lleisong.github.io/itsdm/
Other
4 stars 2 forks source link

How can I model a species distribution for a future climate scenario #10

Open ManuelSpinola opened 1 year ago

ManuelSpinola commented 1 year ago

I am using itsdm for species distribution modeling.

I have an isotree_po object with historic bioclimatic variables. I want to model the spcies dsitribution for a future climate scenario. I have future bioclimatic variable.

I try using the function probability but the stars object has 3 dimensions (x, y, and the 19 bands).

How can I have a stars object of stacked rasters with only 2 dimensions?

LLeiSong commented 1 year ago

Hi @ManuelSpinola You can use the probability function to perform predictions using another set of bioclimatic variables. However, it requires the users to convert the stars object to include only the x and y dimensions. This restriction is in place to minimize the chances of misusing categorical variables.

To use the probability function, you should first split the bands into attributes and then proceed with the prediction. Assuming you have already obtained the isotree_po object named mod, you can use the following code to perform predictions using the probability function:

future_climate <- stars::split(future_climate)
suit_future <- itsdm::probability(mod$model, future_climate)

Hope this helps.

ManuelSpinola commented 1 year ago

Thank you very much.

Very nice package.

El sáb, 10 jun 2023 a las 19:59, Lei Song, PhD @.***>) escribió:

Hi @ManuelSpinola https://github.com/ManuelSpinola You can use the probability function to perform predictions using another set of bioclimatic variables. However, it requires the users to convert the stars object to include only the x and y dimensions. This restriction is in place to minimize the chances of misusing categorical variables.

To use the probability function, you should first split the bands into attributes and then proceed with the prediction. Assuming you have already obtained the isotree_po object named mod, you can use the following code to perform predictions using the probability function:

future_climate <- stars::split(future_climate) suit_future <- itsdm::probability(mod$model, future_climate)

Hope this helps.

— Reply to this email directly, view it on GitHub https://github.com/LLeiSong/itsdm/issues/10#issuecomment-1585970600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFI3FB4KDNJZS756HOIVKW3XKUQ7BANCNFSM6AAAAAAYMHMFHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Manuel Spínola, Ph.D. Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA @. @.> @.*** Teléfono: (506) 8706 - 4662 Sitio web institucional: ICOMVIS http://www.icomvis.una.ac.cr/index.php/manuel Sitio web personal: Sitio personal https://mspinola-sitioweb.netlify.app Blog sobre Ciencia de Datos: Blog de Ciencia de Datos https://mspinola-ciencia-de-datos.netlify.app