prp: Perpendicularity

View source: R/prp.r

prpR Documentation

Perpendicularity

Description

Calculates a perpendicularity index, \eta, for animal spatial movements. The index has a [0, 1] range with 0 indicating a perfectly parallel movement with respect to boundary or edge and 1 indicating perfectly perpendicular movement. Other summaries are also provided.

Usage


prp(Time, S.X, S.Y, N.X, N.Y, habitat = NULL, near.angle = NULL, 
F.0.NA = TRUE)

Arguments

Time

A numeric vector containing the times when spatial coordinates were recorded.

S.X

X-coordinates of animal.

S.Y

Y-coordinates of animal.

N.X

X-coordinate of nearest point on boundary. These data can be obtained from function near.bound or from ARCGIS Near output.

N.Y

Y-coordinate of nearest point on boundary. These data can be obtained from function near.bound or from ARCGIS Near output.

habitat

A character vector of habitat categories.

near.angle

A numeric vector containing the angle of azimuth to the nearest point on the boundary with respect to a four quadrant system. NE = 0^{\circ} to 90^{\circ}, NW is > 90^{\circ} and \le 180^{\circ}, SE is < 0^{\circ} and \le - 90^{\circ} is > -90^{\circ} and \le -180^{\circ}. This output can be obtained from function bound.angle or from ARCGIS Near output.

F.0.NA

A logical argument specifying whether or not a time interval in which F = 0 should be made NA (see Figure from examples)

Details

This index for perpendicularity, \eta is based on the following rules:

if \delta \le 90^o then \eta = \delta/90^o; if 90^o < \delta \le 135^o then \eta = [90^o - (\delta - 90^o)]/90^o; if 135^o < \delta \le 180^o then \eta = (\delta - 90^o)/90^o

For notation create Figures from examples.

Value

Returns a list with four or five items.

lines

A matrix with n - 1 rows containing line lengths for the lines A, B, C, D, and F. See figure in examples below.

angles

A matrix with n - 1 rows containing line lengths for the angles \kappa, \gamma and \delta. See Figure in examples below.

moment.by.moment

This component provides a matrix with n - 1 rows. Included are the columns: End.time, Eta.Index, Delta, Habitat, and Brdr chng. The columns Habitat, and Brdr chng are excluded if habitat = NULL or near.angle = NULL.

P.summary

Contains averages and standard errors for \eta.

crossing.summary

Crossing binomial summaries. Provided if habitat and near.angle are specified.

Author(s)

Ken Aho

References

Kie, J.G., A.A. Ager, and R.T. Bowyer (2005) Landscape-level movements of North American elk (Cervus elaphus): effects of habitat patch structure and topography. Landscape Ecology 20:289-300.

McGarigal K., SA Cushman, M.C. Neel, and E. Ene (2002) FRAGSTATS: Spatial Pattern Analysis Program for Categorical Maps. Computer software program produced by the authors at the University of Massachusetts, Amherst.

See Also

near.bound, bound.angle

Examples

## Not run: 
###Diagram describing prp output.  
y<-rnorm(100,0,5)
plot(seq(1,100),sort(y),type="l",xaxt="n",yaxt="n",lwd=2,xlab="",ylab="")
op <- par(font=3)

segments(52,-12,46,sort(y)[46],lty=1,col=1,lwd=1)##A
segments(90,-8,85,sort(y)[85],lty=1,col=1,lwd=1)##B
segments(46,sort(y)[46],85,sort(y)[85],lty=1)##F
segments(90,-8,46,sort(y)[46],lty=2)##D
arrows(52,-12,90,-8,length=.1,lwd=3)##C
arrows(20,-12,20,8,lty=2,col="gray",length=.1)#North
arrows(20,sort(y)[46],95,sort(y)[46],length=.1,lty=2,col="gray")
arrows(20,-12,95,-12,length=.1,lty=2,col="gray")#East

text(20,9,"N",col="gray");text(97,-12, "E", col= "gray");text(97,sort(y)[46], "E",
col= "gray")
text(49.5,-12.5,"a");text(92.5,-8.5,"b")
text(45.5,-5.5,"A",font=4,col=1);text(70,-9,"C",font=4,col=1);text(91.5,-1.75,"B",
font=4,col=1)
text(44,sort(y)[46]+1,"c");text(67.5,-2.5,"D",font=4,col=1);text(65,3.9,"F",font=4,
col=1)
text(87,sort(y)[87]+1,"d");text(57,-10,expression(kappa),col=1);
text(81,sort(y)[87]-3,expression(gamma),col=1);text(57,1.3,expression(theta),col=1)
text(64,-11.5,expression(beta),col=1)

library(plotrix)
draw.arc(50,-12,6,1.35,col=1);draw.arc(50,-12,6,.3,col=1);draw.arc(50,-12,6,0.02,
col=1)
draw.arc(46,sort(y)[46],7,.01,col=1);draw.arc(46,sort(y)[46],7,.5,col="white")
draw.arc(85,sort(y)[85],6,-2.7,col=1);draw.arc(85,sort(y)[85],6,-1.4,col="white",
lwd=2)
legend("topleft",c(expression(paste(kappa, " = acos[(",C^2," + ",X^2," - ",D^2,")
/2CX]")),
expression(paste(gamma," = acos[(",Y^2," + ",F^2," - ",D^2,")/2YF]")),
expression(paste(theta," = atan[(",y[f]," - ",y[n],")/(",x[f]," - ",x[n],")]")),
expression(paste(beta, " = atan[(",y[epsilon]," - ",y[alpha],")/(",x[epsilon],
" - ",x[alpha],")]"))),
bty="n",cex=.9,inset=-.025)

###Figure for demo dataset.
bX<-seq(0,49)/46

bY<-c(4.89000,4.88200,4.87400,4.87300,4.88000,4.87900,4.87900,4.90100,4.90800,
4.91000,4.93300,4.94000,4.91100,4.90000,4.91700,4.93000,4.93500,4.93700,
4.93300,4.94500,4.95900,4.95400,4.95100,4.95800,4.95810,4.95811,4.95810,
4.96100,4.96200,4.96300,4.96500,4.96500,4.96600,4.96700,4.96540,4.96400,
4.97600,4.97900,4.98000,4.98000,4.98100,4.97900,4.98000,4.97800,4.97600,
4.97700,4.97400,4.97300,4.97100,4.97000)

X<-c(0.004166667,0.108333333,0.316666667,0.525000000,0.483333333,0.608333333,
0.662500000,0.683333333,0.900000000,1.070833333)
Y<-c(4.67,4.25,4.26,4.50,4.90,4.10,4.70,4.40,4.20,4.30)

plot(bX,bY,type="l",lwd=2,xlab="",ylab="",ylim=c(4,5.1))
lines(X,Y)

for(i in 1:9)arrows(X[i],Y[i],X[i+1],Y[i+1],length=.1,lwd=1,angle=20)
mx<-rep(1,9)
my<-rep(1,9)
for(i in 1:9)mx[i]<-mean(c(X[i],X[i+1]))
for(i in 1:9)my[i]<-mean(c(Y[i],Y[i+1]))
for(i in 1:9)text(mx[i],my[i],i,font=2,cex=1.3)

nn<-near.bound(X,Y,bX,bY)
prp(seq(1,10),X,Y,nn[,1],nn[,2])$moment.by.moment
par(op)

## End(Not run)

asbio documentation built on May 29, 2024, 5:57 a.m.