dismo: Species Distribution Modeling

種の分布モデリング

> library(dismo)
> data("acaule")

バージョン: 1.1.1


関数名 概略
Anguilla_train Anguilla australis distribution data
DistModel-class Class "DistModel"
ModelEvaluation-class Class "ModelEvaluation"
acaule Solanum acaule data
bioclim Bioclim
biovars bioclimatic variables
boxplot,ModelEvaluation-method Box plot of model evaluation data
calc.deviance Calculate deviance
circles Circles range
convHull Convex hull model
dcEvaluate Evaluate by distance class
density density
dismo-package Species distribution modeling
domain Domain
ecocrop Ecocrop model
ecolim Ecolim model
evaluate Model evaluation
evaluateROCR Model testing with the ROCR package
gbif Data from GBIF
gbm.fixed gbm fixed
gbm.holdout gbm holdout
gbm.interactions gbm interactions
gbm.perspec gbm perspective plot
gbm.plot gbm plot
gbm.plot.fits gbm plot fitted values
gbm.simplify gbm simplify
gbm.step gbm step
geoDist Geographic distance model
geoIDW Inverse-distance weighted model
geocode Georeferencing with Google
gmap Get a Google map
gridSample Stratified regular sample on a grid
kfold k-fold partitioning
mahal Mahalanobis model
maxent Maxent
mess Multivariate environmental similarity surfaces (MESS)
nicheEquivalency Niche equivalency
nicheOverlap Niche overlap
nullRandom Random null model
pairs Pair plots
plot,Bioclim,missing-method Plot predictor values
plot,ModelEvaluation,character-method Plot model evaluation data
pointValues point values
predict Distribution model predictions
prepareData Prepare data for model fitting
pwdSample Pair-wise distance sampling
randomPoints Random points
response response plots
ssb Spatial sorting bias
threshold Find a threshold
voronoi Voronoi polygons
voronoiHull Voronoi hull model

acaule

Solanum acauleの分布データ

> data("acaule")
> acaule %>% dplyr::glimpse()
Observations: 1,366
Variables: 25
$ species               <chr> "Solanum acaule Bitter", "Solanum acaule...
$ continent             <chr> "South America", "South America", NA, NA...
$ country               <chr> "Argentina", "Peru", "Argentina", "Boliv...
$ adm1                  <chr> "Jujuy", "Cusco", NA, NA, NA, NA, NA, NA...
$ adm2                  <chr> "Santa Catalina", "Canchis", NA, NA, NA,...
$ locality              <chr> "Santa Catalina: camino de salida del pu...
$ lat                   <dbl> -21.9000, -13.5000, -22.2666, -18.6333, ...
$ lon                   <dbl> -66.1000, -71.0000, -65.1333, -66.9500, ...
$ coordUncertaintyM     <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ alt                   <dbl> NaN, 4500, 3800, 3700, 4080, 3780, 4300,...
$ institution           <chr> "NY", "NY", "NLD037", "NLD037", "NLD037"...
$ collection            <chr> "Herbarium", "Herbarium", "CGN-PGR", "CG...
$ catalogNumber         <chr> "00745416", "00962455", "CGN17852", "CGN...
$ basisOfRecord         <chr> "specimen", "specimen", "unknown", "unkn...
$ collector             <chr> "G. C. Giberti", "A. Tupayachi H.", NA, ...
$ earliestDateCollected <chr> "1979-01-29", "2005-03-17", NA, NA, NA, ...
$ latestDateCollected   <chr> "1979-01-29", "2005-03-17", NA, NA, NA, ...
$ gbifNotes             <chr> "Data from GBIF data index - original va...
$ downloadDate          <date> 2013-01-16, 2013-01-16, 2013-01-16, 201...
$ maxElevationM         <chr> NA, "4500", NA, NA, NA, NA, NA, NA, NA, ...
$ minElevationM         <chr> NA, "4500", "3800", "3700", "4080", "378...
$ maxDepthM             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ minDepthM             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ ISO2                  <chr> "AR", "PE", "AR", "BO", "BO", "BO", "AR"...
$ cloc                  <chr> "Santa Catalina: camino de salida del pu...

circles

Arguments

  • p... 座標位置を示す行列あるいはデータフレーム、SpatialPoints * object
  • d
  • lonlat
  • n
  • r
  • dissolve
  • ...
> r <- system.file("external/rlogo.grd", package = "raster") %>% raster::raster()
> # ポイントの座標データを作る(行列)
> pts <- matrix(c(17, 42, 85, 70, 19, 53, 26, 84, 84, 46, 48, 
+                 85, 4, 95, 48, 54, 66, 74, 50, 48, 28, 73, 
+                 38, 56, 43, 29, 63, 22, 46, 45, 7, 60, 46, 
+                 34, 14, 51, 70, 31, 39, 26), 
+               ncol = 2)
> train <- pts[1:12, ]
> test <- pts[13:20, ]
> 
> (cc <- circles(p = train, lonlat = FALSE))
class    : CirclesRange 

variables: X1 X2 


presence points: 12 
   X1 X2
1  17 28
2  42 73
3  85 38
4  70 56
5  19 43
6  53 29
7  26 63
8  84 22
9  84 46
10 46 45
  (... ...  ...)
> # plot(r)
> # plot(geometry(cc), border = 'red', lwd= 2 , add = TRUE)
> # points(train, col = 'red', pch = 20, cex = 2)
> # points(test, col = 'black', pch = 20, cex = 2)

evaluate

モデル評価

ref) threshold()

Arguments

  • p
  • a
  • model
  • x
  • tr
  • ...
> # Predict value
> p <- rnorm(50, mean = 0.7, sd = 0.3)
> a <- rnorm(50, mean = 0.4, sd = 0.4)
> (e <- evaluate(p = p, a = a))
class          : ModelEvaluation 
n presences    : 50 
n absences     : 50 
AUC            : 0.7612 
cor            : 0.4592102 
max TPR+TNR at : 0.5159163

geocode

Googleによるジオコーディング

> geocode(c("San Jose", "San Jose, Mexico"))
     originalPlace                                      interpretedPlace
1         San Jose                                     San Jose, CA, USA
2         San Jose                               San Jose, NM 87565, USA
3         San Jose                               San Jose, IL 62682, USA
4 San Jose, Mexico      San José, 13020 Ciudad de México, D.F., Mexico
5 San Jose, Mexico                San Jose, 94560 Córdoba, Ver., Mexico
6 San Jose, Mexico              San José, 64270 Monterrey, N.L., Mexico
7 San Jose, Mexico San Jose, 56377 Chicoloapan de Juárez, Méx., Mexico
8 San Jose, Mexico          Barrio de San José, Campeche, Camp., Mexico
9 San Jose, Mexico                San José, 97189 Mérida, Yuc., Mexico
   longitude latitude       xmin       xmax     ymin     ymax uncertainty
1 -121.88633 37.33821 -122.04567 -121.58915 37.12449 37.46954       27614
2 -105.47501 35.39727 -105.47636 -105.47366 35.39592 35.39861         193
3  -89.60288 40.30560  -89.61190  -89.59636 40.29810 40.31289         981
4  -98.99770 19.27665  -99.00210  -98.99163 19.26935 19.28091         793
5  -96.94178 18.89627  -96.94939  -96.93765 18.89262 18.90129         705
6 -100.33225 25.72423 -100.33742 -100.33059 25.72119 25.72639         291
7  -98.91764 19.41027  -98.92396  -98.91190 19.40616 19.41493         794
8  -90.54032 19.83579  -90.54896  -90.53474 19.83007 19.84056         788
9  -89.61045 20.94650  -89.61447  -89.60515 20.94231 20.95285         624
> c("Chiyoda, Tokyo", "Yokohama, Japan") %>% geocode()
    originalPlace                     interpretedPlace longitude latitude
1  Chiyoda, Tokyo                Chiyoda, Tokyo, Japan  139.7536 35.69400
2 Yokohama, Japan Yokohama, Kanagawa Prefecture, Japan  139.6380 35.44371
      xmin     xmax     ymin     ymax uncertainty
1 139.7299 139.7828 35.66855 35.70522        2924
2 139.4648 139.7254 35.31262 35.59286       18347

gbif

> gbif("solanum", download = FALSE)
[1] 847413

nicheOverlap

種の分布からのニッチ重複を求める

Arguments

  • x
  • y
  • stat
  • mask
  • checkNegatives
> r1 <- raster::raster(nr = 18, nc = 36)
> r2 <- raster::raster(nr = 18, nc = 36)
> set.seed(0)
> r1[] <- runif(ncell(r1))
> r2[] <- runif(ncell(r1))
> nicheOverlap(r1, r2)
[1] 0.8891728