Gamma.like  R Documentation 
Computes the gamma likelihood, scaled appropriately, for use as a likelihood in estimating a distance function.
Gamma.like(
a,
dist,
covars = NULL,
w.lo = units::set_units(0, "m"),
w.hi = max(dist),
series = "cosine",
expansions = 0,
scale = TRUE,
pointSurvey = FALSE
)
a 
A vector of likelihood parameter values. Length and meaning depend on 
dist 
A numeric vector containing the observed distances. 
covars 
Data frame containing values of covariates at each observation in 
w.lo 
Scalar value of the lowest observable distance. This is the left truncation of sighting distances in 
w.hi 
Scalar value of the largest observable distance.
This is the right truncation of sighting distances in

series 
A string specifying the type of expansion to use. Currently, valid values are 'simple', 'hermite', and 'cosine'; but, see

expansions 
A scalar specifying the number of terms in 
scale 
Logical scalar indicating whether or not to scale the likelihood so it integrates to 1. This parameter is used to stop recursion in other functions.
If 
pointSurvey 
Boolean. TRUE if 
This function utilizes the builtin R function dgamma
to evaluate the gamma density function. Using the parameterization of dgamma
,
the gamma shape parameter is a[1]
while the gamma scale parameter is (a[2]/gamma(r)) * (((r  1)/exp(1))^(r  1))
. Currently, this function
implements a noncovariate version of the gamma detection function used by Becker and Quang (2009). In future, linear equations will relate covariate values
to values of the gamma parameters. This future implementation will fully replicate the distance functions of Becker and Quang (2009).
A numeric vector the same length and order as dist
containing the likelihood contribution for distances in dist
. Assuming
L=gamma.like(c(r,lam),dist)
, the full log likelihood of all the data is sum(log(L), na.rm=T)
. Note that the returned likelihood value for
distances less than w.lo
or greater than w.hi
is NA
, and thus it is prudent to use na.rm=TRUE
in the sum. If scale
= TRUE,
the integral of the likelihood from w.lo
to w.hi
is 1.0. If scale
= FALSE, the integral of the likelihood is an arbitrary constant.
Becker, E. F., and P. X. Quang, 2009. A GammaShaped Detection Function for LineTransect Surveys with MarkRecapture and Covariate Data. Journal of Agricultural, Biological, and Environmental Statistics 14(2):207223.
dfuncEstim
, halfnorm.like
, hazrate.like
, uniform.like
, negexp.like
## Not run:
set.seed(238642)
x < seq(0, 100, length=100)
# Plots showing effects of changes in shape
plot(x, Gamma.like(c(20,20), x), type="l", col="red")
plot(x, Gamma.like(c(40,20), x), type="l", col="blue")
# Plots showing effects of changes in scale
plot(x, Gamma.like(c(20,20), x), type="l", col="red")
plot(x, Gamma.like(c(20,40), x), type="l", col="blue")
# Estimate 'Gamma' distance function
r < 5
lam < 10
b < (1/gamma(r)) * (((r  1)/exp(1))^(r  1))
x < rgamma(1000, shape=r, scale=b*lam)
dfunc < dfuncEstim(x~1, likelihood="Gamma", x.scl="max")
plot(dfunc)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.