parseModel {Rdistance} | R Documentation |
parseModel - Parse Rdistance model
Description
Parse an 'Rdistance' formula and produce a list containing all model
parameters.
Usage
parseModel(
data,
formula = NULL,
likelihood = "halfnorm",
w.lo = 0,
w.hi = NULL,
expansions = 0,
series = "cosine",
x.scl = 0,
g.x.scl = 1,
outputUnits = NULL
)
Arguments
data |
An RdistDf data frame. RdistDf data frames
contain one line per transect and a list-based column. The list-based
column contains a data frame with detection information.
The detection information data frame on each row contains (at least) distances
and group sizes of all targets detected on the transect.
Function RdistDf creates RdistDf data frames
from separate transect and detection data frames.
is.RdistDf checks whether data frames
are RdistDf 's.
|
formula |
A standard formula object. For example, dist ~ 1 ,
dist ~ covar1 + covar2 ). The left-hand side (before ~ )
is the name of the vector containing off-transect or radial detection distances.
The right-hand side contains the names of covariate
vectors to fit in the detection
function, and potentially group sizes.
Covariates can be either detection level
or transect level and can appear in data or exist in the
global working environment. Regular R scoping
rules apply.
|
likelihood |
String specifying the likelihood to fit. Built-in
likelihoods at present are "halfnorm", "hazrate", and "negexp".
|
w.lo |
Lower or left-truncation limit of the distances in distance data.
This is the minimum possible off-transect distance. Default is 0. If
w.lo is greater than 0, it must be assigned measurement units
using units(w.lo) <- "<units>" or
w.lo <- units::set_units(w.lo, "<units>") .
See examples in the help for set_units .
|
w.hi |
Upper or right-truncation limit of the distances
in dist . This is the maximum off-transect distance that
could be observed. If unspecified (i.e., NULL),
right-truncation is set to the maximum of the observed
distances. If w.hi is specified, it must have associated
measurement units. Assign measurement units
using units(w.hi) <- "<units>" or
w.hi <- units::set_units(w.hi, "<units>") .
See examples in the help for set_units .
|
expansions |
A scalar specifying the number of terms
in series to compute. Depending on the series,
this could be 0 through 5. The default of 0 equates
to no expansion terms of any type. No expansion terms
are allowed (i.e., expansions is forced to 0) if
covariates are present in the detection function
(i.e., right-hand side of formula includes
something other than 1 ).
|
series |
If expansions > 0, this string
specifies the type of expansion to use. Valid values at
present are 'simple', 'hermite', and 'cosine'.
|
x.scl |
The x coordinate (a distance) at which the
detection function will be scaled. g.x.scl can be a distance
or the string "max".
When x.scl is specified (i.e., not 0 or "max"), it must have measurement
units assigned using either library(units);units(x.scl) <- '<units>'
or x.scl <- units::set_units(x.scl, <units>) . See
units::valid_udunits() for valid symbolic units.
|
g.x.scl |
Height of the distance function at coordinate x .
The distance function
will be scaled so that g(x.scl ) = g.x.scl .
If g.x.scl is not
a data frame, it must be a numeric value (vector of length 1)
between 0 and 1.
|
outputUnits |
A string specifying the symbolic measurement
units for results. Valid units are listed in units::valid_udunits() .
The strings for common distance symbolic units are:
"m" - meters, "ft" - feet, "cm" - centimeters, "mm" -
millimeters, "mi" - miles, "nmile" -
nautical miles ("nm" is nano meters), "in" - inches,
"yd" - yards, "km" - kilometers, "fathom" - fathoms,
"chains" - chains, and "furlong" - furlongs.
If outputUnits is unspecified (NULL),
output units will be the same as those on
distances in data .
|
Details
This routine is not intended to be called by the user. It is called
from the model estimation routines in Rdistance
.
Value
An Rdistance model frame, which is an object of class
"dfunc".
Rdistance model frames are lists containing distance
model components but not estimates. Model frames contain
everything necessary to fit an Rdistance mode, such as covariates,
minimum and maximum distances, the form of the likelihood,
number of expansions, etc. Rdistance model frames contain a
subset of fitted Rdistance model components.
See Also
[RdistDf()], which returns an Rdistance data frame;
[dfuncEstim()], which returns an Rdistance fitted model.
Examples
data(sparrowSiteData)
data(sparrowDetectionData)
sparrowDf <- Rdistance::RdistDf(sparrowSiteData
, sparrowDetectionData
, by = NULL
, pointSurvey = FALSE
, observer = "single"
, .detectionCol = "detections")
ml <- Rdistance::parseModel(sparrowDf
, formula = dist ~ 1 + observer + groupsize(groupsize)
, likelihood = "halfnorm"
, w.lo = 0
, w.hi = NULL
, series = "cosine"
, x.scl = 0
, g.x.scl = 1
, outputUnits = "m"
)
class(ml) # 'dfunc', but no estimated coefficients
print(ml)
print.default(ml)
[Package
Rdistance version 4.0.5
Index]