Learn R Programming

DSpat (version 0.1.6)

sample.points: Sample points within each transect and filter with specified detection function

Description

Create a dataframe of observations by simulating distance sampling of a point process with a systematic set of lines over a rectangular grid. The transects, lines and point process(points.ppp) are input arguments. Detection of observations is specified with a user-defined detection function which takes a distance vector and set of parameters det.par as its arguments.

Usage

sample.points(transects,lines,points.ppp,detfct=NULL,det.par=NULL, det.formula=~1,covariates=NULL) hndetfct(x,scale)

Arguments

transects
list of transect polygons
lines
dataframe of lines
points.ppp
simulated point process
detfct
detection function name
det.par
parameters for the detection function
det.formula
formula of covariates to use for scale of distance if det.formula=~-1, uses a strip transect
covariates
a matrix with columns x,y and any number of covariates x and y are the mid points of the grid cells; the order of the rows must match the formulation for function im
x
perpendicular distance for detection function
scale
scale for detection function

Value

of the observation location and its perpendicular distance from the line

Details

Definition for half-normal detection function (hndetfct) is exp(-(x^2/(2*exp(scale)^2)))

See Also

simCovariates,simPts,create.lines

Examples

Run this code
study.area=owin(xrange=c(0,100),yrange=c(0,100))
hab.range=30
probs=c(1/3,2/3)
covariates = simCovariates(hab.range, probs)
xlines=create.lines(study.area,nlines=10,width=5,angle=45)
ls=lines_to_strips(xlines,study.area)
plot(ls$lines,lty=2)
plot(owin(poly=ls$transects),add=TRUE)
xpp=simPts(covariates=covariates,int.formula=~factor(habitat),int.par=c(0,1,2),EN=1000)
obs=sample.points(transects=ls$transects,lines=xlines,points.ppp=xpp,
                    hndetfct,c(1),covariates=covariates)
plot(ppp(x=obs$x,y=obs$y,window=study.area),add=TRUE,pch=20)

Run the code above in your browser using DataLab