Learn R Programming

sfa (version 1.2.0)

pcomposed_model: Composed-error distribution function for any cross-sectional model

Description

\(P(\varepsilon \le q)\) for the composed error of any cross-sectional model, where pcomposed covers only the half-normal case.

Usage

pcomposed_model(q, model_name, par, inefdec = TRUE, lower.tail = TRUE,
                log.p = FALSE, n_nodes = 128)

composed_cdf(object, q = NULL, data = NULL, ...)

Value

A numeric vector of probabilities (or their logs).

Arguments

q

Numeric vector of quantiles. For composed_cdf, defaults to the fit's own composed-error residuals.

model_name

One of "NHN", "NTN", "NE", "NR", "NU", "NGE", "NLN", "NW", "NG", "NNAK", "TSL", "THT", "tHN".

par

A named parameter vector, as in fit$out[, "par"].

inefdec

TRUE for a production frontier, FALSE for cost.

lower.tail, log.p

As elsewhere in R.

n_nodes

Quadrature nodes over the inefficiency term.

object

An "sfareg" fit from sfm.

data

The data the model was fitted to. sfm() does not retain it, so it is needed whenever q is not supplied.

...

Passed to pcomposed_model.

Details

The probability is computed as an expectation over the inefficiency term, $$F(q) = E_u\left[F_v\left((q + su)/\sigma_v\right)\right],$$ with \(s = +1\) for production and \(-1\) for cost. Conditioning on \(u\) leaves the noise CDF in closed form, so the noise is never integrated and the tails inherit pnorm()'s (or pt()'s) own accuracy.

Three parameterizations do not read the way their names suggest, and are taken from each likelihood in sfm() rather than from the label: "THT" lists sigu before sigv, the only model that does; "NG"'s sigu is the gamma scale and its mu the shape; "NNAK"'s sigu is the Nakagami spread, so \(\Omega = \code{sigu}^2\); and "NLN"'s mu is a meanlog.

"THT" is not an independent convolution. Tancredi's (2002) composed error is skew-\(t\), a scale mixture in which \(v\) and \(u\) are divided by the same \(\sqrt{V/a}\). Treating it as \(t\) noise plus an independent half-normal -- which is what "tHN" actually is -- gets the log density wrong by up to 1.74, so the two models take different paths here despite looking alike.

Verified two ways: against pcomposed for the half-normal case, agreeing to \(3.5\times10^{-15}\) relative including a lower tail at \(\log F = -209\); and for all thirteen models against a four-million-draw simulation, with a maximum absolute error of \(4\times10^{-4}\) against a Monte Carlo standard error of \(7.5\times10^{-4}\). Numerically differentiating this CDF reproduces each model's own stored log-density to about \(10^{-8}\), except for the simulated-ML models "NLN" and "NW", where the difference is the simulation error of their likelihood rather than a disagreement about the model.

See Also

pcomposed, dcomposed, sfm

Examples

Run this code
p <- c(sigv = 0.5, sigu = 1.1)
pcomposed_model(c(-2, -1, 0, 1), "NE", p)

d <- as.data.frame(data_gen_cs(N = 200, rand = 5, sig_u = 1, sig_v = 0.5,
                               cons = 0.5, beta1 = 0.5, beta2 = 0.5,
                               a = 5, mu = 0.1))
f <- sfm(y_pcs ~ x1 + x2, model_name = "NHN", data = d)
head(composed_cdf(f, data = d))

Run the code above in your browser using DataLab