# Fake offtransect distances (x), transect id's (tran.id), and group sizes (grp.size)
set.seed(234092)
x <- rnorm(1000) * 100
tran.id <- rep(1:100, each=10)
grp.size <- rpois(1000, 2.5)
tran.id <- tran.id[ 0 < x & x < 100 ]
grp.size <- grp.size[ 0 < x & x < 100 ]
x <- x[ 0 < x & x < 100 ]
# Fit a distance function
hn.dfunc <- F.dfunc.estim( x, likelihood="halfnorm", w.hi = 100)
# Assume surveyed 10000 m in study area of size 1000 hectares.
# Original offtransect distances must be in meters, and area must be square meters.
# Without group sizes, this estimates number of groups in the area.
F.abund.estim( hn.dfunc, tot.trans.len=10000, area=1000*10000, ci=NULL)
# Include group sizes to estimate number of individuals.
F.abund.estim( hn.dfunc, group.sizes = grp.size, tot.trans.len=10000, area=1000*10000, ci=NULL)
# Or,
F.abund.estim( hn.dfunc, avg.group.size=2.5, tot.trans.len=10000, area=1000*10000, ci=NULL)
# Bootstrap resample the transects to compute CI for N (A person should do more than R=100 iterations)
F.abund.estim( hn.dfunc, group.sizes=grp.size, tot.trans.len=10000, area=1000*10000, ci=.95, transects=tran.id, R=100, plot.bs=TRUE)Run the code above in your browser using DataLab