Learn R Programming

Rdistance (version 4.1.1)

oneStep.like: Mixture of two uniforms likelihood

Description

Compute likelihood function for a mixture of two uniform distributions.

Usage

oneStep.like(a, dist, covars, w.hi = NULL)

Value

A list containing the following two components:

  • L.unscaled: A matrix of size nXkXb containing likelihood values evaluated at distances in dist. Each row is associated with a single distance, and each column is associated with a single case (row of a). This matrix is "unscaled" because the underlying likelihood does not integrate to one. Values in L.unscaled are always greater than or equal to zero.

  • params: A nXkXb array of the likelihood's (canonical) parameters. First page contains parameter values related to covariates (i.e., s = exp(x'a)), while subsequent pages contain other parameters. b = 1 for halfnorm, negexp; b = 2 for hazrate and others. Rows correspond to distances in dist. Columns correspond to rows from argument a.

Arguments

a

A vector or matrix of covariate and expansion term coefficients. If matrix, dimension is k X p, where k = nrow(a)) is the number of coefficient vectors to evaluate (cases) and p = ncol(a)) is the number of covariate and expansion coefficients in the likelihood (i.e., rows are cases and columns are covariates). If a is a dimensionless vector, it is interpreted as a single row with k = 1. Covariate coefficients in a are the first q values (q <= p), and must be on a log scale.

dist

A numeric vector of length n or a single-column matrix (dimension nX1) containing detection distances at which to evaluate the likelihood.

covars

A numeric vector of length q or a matrix of dimension nXq containing covariate values associated with distances in argument dist.

w.hi

A numeric scalar containing maximum distance. The right-hand cutoff or upper limit. Ignored by some likelihoods (such as halfnorm, negexp, and hazrate), but is a fixed parameter in other likelihoods (such as oneStep, heber, and uniform).

Details

Rdistance's oneStep likelihood is a mixture of two non-overlapping uniform distributions. The 'oneStep' density function is $$f(d|p, \theta) = \frac{p}{\theta}I(0 \leq d \leq \theta) + \frac{1 - p}{w - \theta}I(\theta \le d \leq w),$$ where \(I(x)\) is the indicator function for event \(x\), and \(w\) is the nominal strip width (i.e., w.hi - w.lo in Rdistance). The unknown parameters to be estimated are \(\theta\) and \(p\) (\(w\) is fixed - given by the user).

Covariates influence values of \(\theta\) via a log link function, i.e., \(\theta = e^{x'b}\), where \(x\) is the vector of covariate values associated with distance \(d\), and \(b\) is the vector of estimated coefficients.

References

Peter F. Craigmile & D.M. Tirrerington (1997) "Parameter estimation for finite mixtures of uniform distributions", Communications in Statistics - Theory and Methods, 26:8, 1981-1995, DOI: 10.1080/03610929708832026

A. Hussein & J. Liu (2009) "Parametric estimation of mixtures of two uniform distributions", Journal of Statistical Computation and Simulation, 79:4, 395-410, DOI:10.1080/00949650701810406

See Also

dfuncEstim, abundEstim, other <likelihood>.like functions

Examples

Run this code

# Fit oneStep to simulated data
whi <- 250
T <- 100  # true threshold
p <- 0.85
n <- 200 
x <- c( runif(n*p, min=0, max=T), runif(n*(1-p), min=T, max=whi))
x <- setUnits(x, "m")
tranID <- sample(rep(1:10, each=n/10), replace=FALSE)
detectDf <- data.frame(transect = tranID, dist = x)
siteDf <- data.frame(transect = 1:10
               , length = rep(setUnits(10,"m"), 10))
distDf <- RdistDf(siteDf, detectDf)

# Estimation
fit <- dfuncEstim(distDf
                 , formula = dist ~ 1
                 , likelihood = "oneStep"
                 , w.hi = setUnits(whi, "m")
                 )
plot(fit)
thetaHat <- exp(coef(fit)[1]) 
pHat <- coef(fit)[2]
c(thetaHat, pHat) # should be close to c(100,0.85)

summary(abundEstim(fit, ci=NULL)) 

Run the code above in your browser using DataLab