dfuncSmu | R Documentation |
Estimates a smooth detection function for line-transect perpendicular distances or point-transect radial distances.
dfuncSmu(
formula,
detectionData,
siteData,
bw = "SJ-dpi",
adjust = 1,
kernel = "gaussian",
pointSurvey = FALSE,
w.lo = units::set_units(0, "m"),
w.hi = NULL,
x.scl = "max",
g.x.scl = 1,
observer = "both",
warn = TRUE,
transectID = NULL,
pointID = "point",
outputUnits = NULL,
length = "length",
control = RdistanceControls()
)
formula |
A formula object (e.g., dist ~ 1).
The left-hand side (before ~)
is the name of the vector containing distances (perpendicular or
radial). The right-hand side (after ~)
must be the intercept-only model as |
detectionData |
A data frame containing detection distances (either perpendicular for line-transect or radial for point-transect designs), with one row per detected object or group. This data frame must contain at least the following information:
Optionally, this data frame can contain the following variables:
See example data set |
siteData |
A data.frame containing site (transect or point)
IDs and any
site level covariates to include in the detection function.
Every unique surveyed site (transect or point) is represented on
one row of this data set, whether or not targets were sighted
at the site. See arguments If sites are transects,
this data frame must also contain transect length. By
default, transect length is assumed to be in column 'length'
but can be specified using argument The total number of sites surveyed is See Input data frames
for when |
bw |
Bandwidth of the smooth, which controls
smoothness. Smoothing is done by
|
adjust |
Bandwidth adjustment for the amount of smooth.
Smoothing is done by |
kernel |
Character string specifying the smoothing kernel function.
This parameters is passed unmodified to
Values of |
pointSurvey |
A logical scalar specifying whether input data come from point-transect surveys (TRUE), or line-transect surveys (FALSE). Point surveys (TRUE) have not been implemented yet. |
w.lo |
Lower or left-truncation limit of the distances in distance data. This is the minimum possible off-transect distance. Default is 0. |
w.hi |
Upper or right-truncation limit of the distances
in |
x.scl |
This parameter is passed to |
g.x.scl |
This parameter is passed to |
observer |
This parameter is passed to |
warn |
A logical scalar specifying whether to issue
an R warning if the estimation did not converge or if one
or more parameter estimates are at their boundaries.
For estimation, |
transectID |
A character vector naming the transect ID column(s) in
|
pointID |
When point-transects are used, this is the
ID of points on a transect. When If single points are surveyed,
meaning surveyed points were not grouped into transects, each 'transect' consists
of one point. In this case, set |
outputUnits |
A string giving the symbolic measurment
units that results should be reported in. Any
distance measurement unit in |
length |
Character string specifying the (single) column in
|
control |
A list containing optimization control parameters such
as the maximum number of iterations, tolerance, the optimizer to use,
etc. See the
|
Distances are reflected about w.lo
before being passed
to density
. Distances exactly equal to w.lo
are not
reflected. Reflection around w.lo
greatly improves
performance of the kernel methods near the w.lo
boundary
where substantial non-zero probability of sighting typically exists.
An object of class 'dfunc'. Objects of class 'dfunc' are lists containing the following components:
parameters |
A data frame containing the $x and $y
components of the smooth. $x is a vector of length
512 (default for |
loglik |
The value of the log likelihood. Specifically, the sum of the negative log heights of the smooth at observed distances, after the smoothed function has been scaled to integrate to one. |
w.lo |
Left-truncation value used during the fit. |
w.hi |
Right-truncation value used during the fit. |
dist |
The input vector of observed distances. |
covars |
NULL. Covariates are not allowed in the smoothed distance function (yet). |
call |
The original call of this function. |
call.x.scl |
The distance at which the distance function
is scaled. This is the x at which g(x) = |
call.g.x.scl |
The value of the distance function at distance
|
call.observer |
The value of input parameter |
fit |
The smoothed object returned by |
pointSurvey |
The input value of |
formula |
The formula specified for the detection function. |
To save space and to easily specify
sites without detections,
all site ID's, regardless whether a detection occurred there,
and site level covariates are stored in
the siteData
data frame. Detection distances and group
sizes are measured at the detection level and
are stored in the
detectionData
data frame.
The following explains conditions under which various combinations of the input data frames are required.
Detection data and site data both required:
Both detectionData
and siteData
are required if site level covariates are
specified on the right-hand side of formula
.
Detection level covariates are not currently allowed.
Detection data only required:
The detectionData
data frame alone can be
specified if no covariates
are included in the distance function (i.e., right-hand side of
formula
is "~1"). Note that this routine (dfuncEstim
)
does not need to know about sites where zero targets were detected, hence
siteData
can be missing when no covariates are involved.
Neither detection data nor site data required
Neither detectionData
nor siteData
are required if all variables specified in formula
are within the scope of this routine (e.g., in the global working
environment). Scoping rules here work the same as for other modeling
routines in R such as lm
and glm
. Like other modeling
routines, it is possible to mix and match the location of variables in
the model. Some variables can be in the .GlobalEnv
while others
are in either detectionData
or siteData
.
The input data frames, detectionData
and siteData
,
must be merge-able on unique sites. For line-transects,
site ID's (i.e., transect ID's) are unique values of
the transectID
column in siteData
. In this case,
the following merge must work:
merge(detectionData,siteData,by=transectID)
.
For point-transects,
site ID's (i.e., point ID's) are unique values
of the combination paste(transectID,pointID)
.
In this case, the following merge must work:
merge(detectionData,siteData,by=c(transectID, pointID)
.
By default,transectID
and pointID
are NULL and
the merge is done on all common columns.
That is, when transectID
is NULL, this routine assumes unique
transects are specified by unique combinations of the
common variables (i.e., unique values of
intersect(names(detectionData), names(siteData))
).
An error occurs if there are no common column names between
detectionData
and siteData
.
Duplicate site IDs are not allowed in siteData
.
If the same site is surveyed in
multiple years, specify another transect ID column (e.g., transectID =
c("year","transectID")
). Duplicate site ID's are allowed in
detectionData
.
To help explain the relationship between data frames, bear in
mind that during bootstrap estimation of variance
in abundEstim
,
unique transects (i.e., unique values of
the transect ID column(s)), not detections or
points, are resampled with replacement.
Buckland, S.T., D.R. Anderson, K.P. Burnham, J.L. Laake, D.L. Borchers, and L. Thomas. (2001) Introduction to distance sampling: estimating abundance of biological populations. Oxford University Press, Oxford, UK.
Scott, D. W. (1992) Multivariate Density Estimation: Theory, Practice, and Visualization. Wiley.
Sheather, S. J. and Jones, M. C. (1991) A reliable data-based bandwidth selection method for kernel density estimation. Journal of the Royal Statistical Society series B, 53, 683-690.
Silverman, B. W. (1986) Density Estimation. London: Chapman and Hall.
abundEstim
, autoDistSamp
,
dfuncEstim
for the parametric version.
# Load example sparrow data (line transect survey type)
data(sparrowDetectionData)
data(sparrowSiteData)
# Compare smoothed and half-normal detection function
dfuncSmu <- dfuncSmu(dist~1, sparrowDetectionData, w.hi=units::set_units(150, "m"))
dfuncHn <- dfuncEstim(formula=dist~1,sparrowDetectionData,w.hi=units::set_units(150, "m"))
# Print and plot results
dfuncSmu
dfuncHn
plot(dfuncSmu,main="",nbins=50)
x <- seq(0,150,length=200)
y <- dnorm(x, 0, predict(dfuncHn)[1])
y <- y/y[1]
lines(x,y, col="orange", lwd=2)
legend("topright", legend=c("Smooth","Halfnorm"),
col=c("red","orange"), lwd=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.