Download doc

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Prognostics wikipedia , lookup

Intelligent maintenance system wikipedia , lookup

Transcript
Using Adehabitat in R to Analyze Animal Space Use
Joey Hinton ([email protected])
12/04/09
This self-tutorial goes step-by-step to help you develop an animal’s homerange and movement
path using the adehabitat package in R.
Adehabitat is a package developed by Clement Calenge for the analysis of animal space use that
creates an interface with geographic information systems. The package has four primary parts.
First, it allows for the management of raster maps. It provides functions that allows for the
import and export of raster maps to/from geographic information systems and subsequent
analyses. Second, adehabitat provides numerous functions for several home range estimators.
Third, there are basic statistics to analyze animal movements such as speed, distance, and turning
angles. Finally, users are provided a platform to common analyses of habitat selection.
There are many functions that I am not covering in this document. Here, I just provide some
elementary use of the adehabitat package as a teaser. I would recommend downloading the
package and explore the potential use of the package via built-in tutorials (i.e., demos).
References used:
Calenge, Clement. 2006. The package “adehabitat” for the R software: a tool for the analysis of
space and habitat use by animals. Ecological Modelling 197: 516-519.
Calenge, Clement. 2007. Exploring habitat selection by wildlife with adehabitat. Journal of
Statistical Software 22: 1-19.
Install and load the package “adehabitat”
In order to analyze animal space use in R, you will need a few of R libraries. These libraries are:
gpclib, ade4, adehabitat, and shapefiles. Luckily, you can do a batch install for these. To install
them, just enter the following:
>install.packages(c("gpclib","ade4","adehabitat","shapefiles")) ##select a CRAN mirror
To initialize the adehabitat package, use the command:
>library(adehabitat)
>######Loading the data##########
>data=read.table("c:/20488F.txt", header=T)
> xy=data[,c("X","Y")] #### Relocation coordinates in UTMs
> id=data[,c("ID")]
-1-
>######Create the Minimum Convex Polygon########
> cp=mcp(xy, id)
> #####Plot the MCP#########
> opar=par(mar=c(0,0,0,0))
> area.plot(cp)
>######Plot the relocations#######
> points(xy, pch=16, col=id)
> par(opar)
>######Computation of the home-range size######
> area=mcp.area(xy, id)
> plot(area)
> area
20488F
20 408.0593
25 455.6455
30 462.9556
35 477.0643
40 559.5436
45 617.2927
50 667.5865
55 735.6050
60 736.6449
65 778.2089
70 783.6998
75 889.5542
80 1000.0232
85 1072.8038
90 1325.9270
95 1443.3882
100 1541.7186
-2-
>#####Create the Kernel Home Range ad hoc########
>ud=kernelUD(xy, id)
>image(ud) ####Creates contours
>udvol=getvolumeUD(ud)
>image(udvol) ####Creates contours with estimated ranges of probability
>ver=getverticeshr(ud, 95) ####Calculates the 95 percent home range
>ver50= getverticeshr(ud, 50) ####Calculates the 50 percent home range
>plot(ver)
>plot(ver50)
>udarea=kernel.area(xy, id)
20488F
20 167.3835
25 225.0074
30 293.6072
35 375.9269
40 480.1986
45 600.9343
50 732.6459
55 880.8215
60 1042.7171
65 1215.5886
70 1404.9240
75 1610.7235
80 1841.2188
85 2101.8981
90 2428.4331
95 2938.8157
>plot(udarea)
########Nearest Neighbor Convex Hulls Home Range#########
> nn=NNCH(xy, k=c(50:55))
> summary(nn) ##### Prints home range analysis summary
-3-
>plot(nn, k=53) ##### A graphical exploration
########################Plotting Animal Movements###############################
>data=read.table("c:/20508F.txt", header=T)
> xy=data[,c("X","Y")] #### Relocation coordinates in UTMs
> id=data[,c("ID")]
> path=as.ltraj(xy, date, id, typeII=FALSE)
> path
>plot(path)
-4-