Get importance variables in dismo package

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Get importance variables in dismo package

Fabrice Vinatier
Dear list members (and especially Robert J. Hijmans),

I am actually using the excellent "dismo" package for flora species
distribution modelling, and I am wondering if there is a way to get
importance of variables used in maxent, domain, mahal and bioclim
functions, to handle these importances in a table.

I tested all possible models included in
https://cran.r-project.org/web/packages/dismo/vignettes/sdm.pdf and I
get easily the importance of variables issued from Random Forest, GLM
and RPART models using "$importance", "$coefficients[-1], and
"$variable.importance", respectively, but it is more difficult to get
the others, although there is a possible indirect access to the
importance variable of Maxent model using plot(me) (if me is the fitted
model).

Best regards,

Fabrice Vinatier

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Get importance variables in dismo package

dicko ahmadou
Hi Fabrice,

If you want to access variable contribution from a MaxEnt model, you can
use still use the plot method.

var_imp <- plot(me)
var_imp

Or build you own function based on the code of the plot method

var_contrib <- function(m, df = TRUE, ...) {
  stopifnot(inherits(m,  "MaxEnt"))
  res <- m@results[grep("contribution", rownames(m@results)), ]
  names(res) <- gsub(".contribution", "", names(res))
  if (df)
    res <- data.frame(var = names(res), contrib = unname(res))
  res
}

var_contrib(me)

Hope it helps





On Mon, Oct 10, 2016 at 10:15 AM, Fabrice Vinatier <
[hidden email]> wrote:

> Dear list members (and especially Robert J. Hijmans),
>
> I am actually using the excellent "dismo" package for flora species
> distribution modelling, and I am wondering if there is a way to get
> importance of variables used in maxent, domain, mahal and bioclim
> functions, to handle these importances in a table.
>
> I tested all possible models included in https://cran.r-project.org/web
> /packages/dismo/vignettes/sdm.pdf and I get easily the importance of
> variables issued from Random Forest, GLM and RPART models using
> "$importance", "$coefficients[-1], and "$variable.importance",
> respectively, but it is more difficult to get the others, although there is
> a possible indirect access to the importance variable of Maxent model using
> plot(me) (if me is the fitted model).
>
> Best regards,
>
> Fabrice Vinatier
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



--
Ahmadou H. DICKO, PhD
Data hacker and climate change economist
Post-doctoral researcher
CIRAD - UMR15 CIRAD/INRA Control of exotic and emerging diseases
email : [hidden email] <[hidden email]>
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
portable: +33 7 68 16 11 58

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Get importance variables in dismo package

Ben Tupper
Hi,

Along a similar vein, I have been assembling into a package some basic helper tools for working with dismo and in particular MaxEnt.  

https://github.com/BigelowLab/dismotools

> library(devtools)
> install_github("BigelowLab/dismotools")
> library(dismotools)
> maxent_get_results(me, "importance")
> maxent_get_results(me, "contribution")

Ben



> On Oct 10, 2016, at 4:48 AM, Ahmadou Dicko <[hidden email]> wrote:
>
> Hi Fabrice,
>
> If you want to access variable contribution from a MaxEnt model, you can
> use still use the plot method.
>
> var_imp <- plot(me)
> var_imp
>
> Or build you own function based on the code of the plot method
>
> var_contrib <- function(m, df = TRUE, ...) {
>  stopifnot(inherits(m,  "MaxEnt"))
>  res <- m@results[grep("contribution", rownames(m@results)), ]
>  names(res) <- gsub(".contribution", "", names(res))
>  if (df)
>    res <- data.frame(var = names(res), contrib = unname(res))
>  res
> }
>
> var_contrib(me)
>
> Hope it helps
>
>
>
>
>
> On Mon, Oct 10, 2016 at 10:15 AM, Fabrice Vinatier <
> [hidden email]> wrote:
>
>> Dear list members (and especially Robert J. Hijmans),
>>
>> I am actually using the excellent "dismo" package for flora species
>> distribution modelling, and I am wondering if there is a way to get
>> importance of variables used in maxent, domain, mahal and bioclim
>> functions, to handle these importances in a table.
>>
>> I tested all possible models included in https://cran.r-project.org/web
>> /packages/dismo/vignettes/sdm.pdf and I get easily the importance of
>> variables issued from Random Forest, GLM and RPART models using
>> "$importance", "$coefficients[-1], and "$variable.importance",
>> respectively, but it is more difficult to get the others, although there is
>> a possible indirect access to the importance variable of Maxent model using
>> plot(me) (if me is the fitted model).
>>
>> Best regards,
>>
>> Fabrice Vinatier
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
>
> --
> Ahmadou H. DICKO, PhD
> Data hacker and climate change economist
> Post-doctoral researcher
> CIRAD - UMR15 CIRAD/INRA Control of exotic and emerging diseases
> email : [hidden email] <[hidden email]>
> twitter : @dickoah
> github : github/dickoa <https://github.com/dickoa>
> portable: +33 7 68 16 11 58
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Get importance variables in dismo package

Tim Salabim
There's also this:

https://cran.r-project.org/web/packages/MaxentVariableSelection/index.html

On 10.10.2016 14:15, Ben Tupper wrote:

> Hi,
>
> Along a similar vein, I have been assembling into a package some basic helper tools for working with dismo and in particular MaxEnt.
>
> https://github.com/BigelowLab/dismotools
>
>> library(devtools)
>> install_github("BigelowLab/dismotools")
>> library(dismotools)
>> maxent_get_results(me, "importance")
>> maxent_get_results(me, "contribution")
> Ben
>
>
>
>> On Oct 10, 2016, at 4:48 AM, Ahmadou Dicko <[hidden email]> wrote:
>>
>> Hi Fabrice,
>>
>> If you want to access variable contribution from a MaxEnt model, you can
>> use still use the plot method.
>>
>> var_imp <- plot(me)
>> var_imp
>>
>> Or build you own function based on the code of the plot method
>>
>> var_contrib <- function(m, df = TRUE, ...) {
>>   stopifnot(inherits(m,  "MaxEnt"))
>>   res <- m@results[grep("contribution", rownames(m@results)), ]
>>   names(res) <- gsub(".contribution", "", names(res))
>>   if (df)
>>     res <- data.frame(var = names(res), contrib = unname(res))
>>   res
>> }
>>
>> var_contrib(me)
>>
>> Hope it helps
>>
>>
>>
>>
>>
>> On Mon, Oct 10, 2016 at 10:15 AM, Fabrice Vinatier <
>> [hidden email]> wrote:
>>
>>> Dear list members (and especially Robert J. Hijmans),
>>>
>>> I am actually using the excellent "dismo" package for flora species
>>> distribution modelling, and I am wondering if there is a way to get
>>> importance of variables used in maxent, domain, mahal and bioclim
>>> functions, to handle these importances in a table.
>>>
>>> I tested all possible models included in https://cran.r-project.org/web
>>> /packages/dismo/vignettes/sdm.pdf and I get easily the importance of
>>> variables issued from Random Forest, GLM and RPART models using
>>> "$importance", "$coefficients[-1], and "$variable.importance",
>>> respectively, but it is more difficult to get the others, although there is
>>> a possible indirect access to the importance variable of Maxent model using
>>> plot(me) (if me is the fitted model).
>>>
>>> Best regards,
>>>
>>> Fabrice Vinatier
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> [hidden email]
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>>
>> --
>> Ahmadou H. DICKO, PhD
>> Data hacker and climate change economist
>> Post-doctoral researcher
>> CIRAD - UMR15 CIRAD/INRA Control of exotic and emerging diseases
>> email : [hidden email] <[hidden email]>
>> twitter : @dickoah
>> github : github/dickoa <https://github.com/dickoa>
>> portable: +33 7 68 16 11 58
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--
#####################################
Tim Appelhans
Department of Geography
Environmental Informatics
Philipps Universit├Ąt Marburg
Deutschhausstra├če 12
Raum 00A08
35032 Marburg (Paketpost: 35037 Marburg)
Germany

Tel +49 (0) 6421 28-25957

http://environmentalinformatics-marburg.de/

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo