dcomperr_mv {dsfa} | R Documentation |
Probablitiy density function, distribution and random number generation for the composed error multivariate distribution.
dcomperr_mv(
x1 = 0,
mu1 = 0,
sigma_v1 = 1,
par_u1 = 1,
s1 = -1,
x2 = 0,
mu2 = 0,
sigma_v2 = 1,
par_u2 = 1,
s2 = -1,
delta = 0,
family_mv = c("normhnorm", "normhnorm", "normal"),
deriv = 0,
tri = NULL,
log.p = FALSE,
check = TRUE
)
pcomperr_mv(
q1 = 0,
mu1 = 0,
sigma_v1 = 1,
par_u1 = 1,
s1 = -1,
q2 = 0,
mu2 = 0,
sigma_v2 = 1,
par_u2 = 1,
s2 = -1,
delta = 0,
family_mv = c("normhnorm", "normhnorm", "normal"),
log.p = FALSE,
check = TRUE
)
rcomperr_mv(
n,
mu1 = 0,
sigma_v1 = 1,
par_u1 = 1,
s1 = -1,
mu2 = 0,
sigma_v2 = 1,
par_u2 = 1,
s2 = -1,
delta = 0,
family_mv = c("normhnorm", "normhnorm", "normal"),
check = TRUE
)
x1 |
vector of quantiles for margin |
mu1 |
vector of |
sigma_v1 |
vector of |
par_u1 |
vector of |
s1 |
|
x2 |
vector of quantiles for margin |
mu2 |
vector of |
sigma_v2 |
vector of |
par_u2 |
vector of |
s2 |
|
delta |
matrix of copula parameter. Must have at least one column. |
family_mv |
string vector, specifying the the margin one and two, as well as the copula.
For the margins the distributions |
deriv |
derivative of order |
tri |
optional, index arrays for upper triangular matrices, generated by |
log.p |
logical; if |
check |
logical; if TRUE, check inputs. |
q1 |
vector of quantiles for margin 1. |
q2 |
vector of quantiles for margin 2. |
n |
number of observations. |
A bivariate random vector (Y_1,Y_2)
follows a composed error multivariate distribution f_{Y_1,Y_2}(y_1,y_2)
, which can be rewritten using Sklars' theorem via a copula
f_{Y_1,Y_2}(y_1,y_2)=c(F_{Y_1}(y_1),F_{Y_2}(y_2),\delta) \cdot f_{Y_1}(y_1) f_{Y_2}(y_2) \qquad,
where c(\cdot)
is a copula function and F_{Y_m}(y_m)
,f_{Y_m}(y_m)
are the marginal cdf and pdf respectively. delta
is the copula parameter.
dcomperr_mv
gives the density, pcomperr_mv
the distribution and rcomperr_mv
generates random numbers, with given parameters. If the derivatives are calculated these are provided as the attributes gradient
, hessian
, l3
and l4
of the output of the density.
pcomperr_mv()
: distribution function for the composed error multivariate distribution.
rcomperr_mv()
: random number generation for the composed error multivariate distribution.
Aigner D, Lovell CK, Schmidt P (1977). “Formulation and estimation of stochastic frontier production function models.” Journal of econometrics, 6(1), 21–37.
set.seed(1337)
x2<-10;x1<-5
mu2<-7;mu1<-2
sigma_v2<-6;sigma_v1<-3
par_u2<-3;par_u1<-2
s2<-s1<--1
delta<-matrix(0.5,ncol=1, nrow=100)
family_mv=c("normhnorm","normhnorm","normal")
pdf<-dcomperr_mv(x1, mu1, sigma_v1, par_u1, s1,
x2, mu2, sigma_v2, par_u2, s2,
delta[1, , drop=FALSE], family_mv, deriv = 2, tri=NULL, log.p=FALSE)
cdf<-pcomperr_mv(q1=x1, mu1, sigma_v1, par_u1, s1,
q2=x2, mu2, sigma_v2, par_u2, s2,
delta[1, , drop=FALSE], family_mv, log.p=FALSE)
r<-rcomperr_mv(n=100, mu1, sigma_v1, par_u1, s1,
mu2, sigma_v2, par_u2, s2,
delta, family_mv)