comperr_mv {dsfa}R Documentation

Composed error multivariate distribution object for mgcv

Description

The comperr_mv family implements the composed error multivariate distribution in which the \mu_1, \sigma_{V1}, \sigma_{U1}, (or \lambda_1), \mu_2, \sigma_{V2}, \sigma_{U2}, (or \lambda_2) and \delta can depend on additive predictors. Useable only with gam(), the additive predictors are specified via a list of formulae.

Usage

comperr_mv(
  link = list("identity", "log", "log", "identity", "log", "log", "glogit"),
  s1 = -1,
  s2 = -1,
  family_mv = c("normhnorm", "normhnorm", "normal")
)

Arguments

link

seven item list specifying the link for the \mu_1, \sigma_{V1}, \sigma_{U1}, \lambda_1, \mu_2, \sigma_{V2}, \sigma_{U2}, \lambda_2 and \delta parameters. See details.

s1

s_1=-1 for production and s_1=1 for cost function for margin 1.

s2

s_2=-1 for production and s_2=1 for cost function for margin 2.

family_mv

vector of length three, specifying the bivariate distribution. First element is the name of the first marginal distribution. Second element is the name of the second marginal distribution. Third element specifies the copula. See dcop() for more details.

Details

Used with gam to fit distributional stochastic frontier model. The function gam is from the mgcv package is called with a list containing seven formulae:

  1. The first formula specifies the response of margin 1 on the left hand side and the structure of the additive predictor for \mu_1 parameter on the right hand side. Link function is "identity".

  2. The second formula is one sided, specifying the additive predictor for the \sigma_{V1} on the right hand side. Link function is "log".

  3. The third formula is one sided, specifying the additive predictor for the \sigma_{U1} or \lambda_1 on the right hand side. Link function is "log".

  4. The fourth formula specifies the response of margin 2 on the left hand side and the structure of the additive predictor for \mu_2 parameter on the right hand side. Link function is "identity".

  5. The fifth formula is one sided, specifying the additive predictor for the \sigma_{V2} on the right hand side. Link function is "log".

  6. The sixth formula is one sided, specifying the additive predictor for the \sigma_{U2} or \lambda_2 on the right hand side. Link function is "log".

  7. The seventh formula is one sided, specifying the additive predictor for the \delta on the right hand side. Link function is "glogit".

The fitted values and linear predictors for this family will be seven column matrices. The columns correspond with the order of the formulae for the parameters.

Value

An object inheriting from class general.family of the 'mgcv' package, which can be used in the dsfa package.

References

Examples


#Set seed, sample size and type of function
set.seed(1337)
N=1000 #Sample size
s1<--1 #Set to production function for margin 1
s2<-1 #Set to cost function for margin 2

#Generate covariates
x1<-runif(N,-1,1); x2<-runif(N,-1,1); x3<-runif(N,-1,1)
x4<-runif(N,-1,1); x5<-runif(N,-1,1); x6<-runif(N,-1,1)
x7<-runif(N,-1,1)

mu1=4+x1 #production function parameter 1
sigma_v1=exp(-1.5+0.75*x2) #noise parameter 1
sigma_u1=exp(-1+1.25*x3) #inefficiency parameter 1
mu2=3+2*x4 #cost function parameter 2
sigma_v2=exp(-1.5+0.75*x5) #noise parameter 2
sigma_u2=exp(-1+.75*x6) #inefficiency parameter 2
delta<-(exp(1+2.5*x7)-1)/(exp(1+2.5*x7)+1) #delta

#Simulate responses and create dataset
Y<-rcomperr_mv(n=N,
               mu1=mu1, sigma_v1=sigma_v1, par_u1 = sigma_u1, s1=s1,
               mu2=mu2, sigma_v2=sigma_v2, par_u2 = sigma_u2, s2=s2,
               delta=delta, family=c("normhnorm","normhnorm","normal"))
dat<-data.frame(y1=Y[,1],y2=Y[,2], x1, x2, x3, x4, x5, x6, x7)

#Write formulae for parameters
mu_1_formula<-y1~x1
sigma_v1_formula<-~x2
sigma_u1_formula<-~x3
mu_2_formula<-y2~x4
sigma_v2_formula<-~x5
sigma_u2_formula<-~x6
delta_formula<-~x7

#Fit model
model<-mgcv::gam(formula=list(mu_1_formula,sigma_v1_formula,sigma_u1_formula,
                              mu_2_formula,sigma_v2_formula,sigma_u2_formula,
                              delta_formula),
                 data=dat,
                 family=comperr_mv(s1=s1, s2=s2, family_mv=c("normhnorm","normhnorm","normal")),
                 optimizer="efs")

#Model summary
summary(model)


[Package dsfa version 1.0.1 Index]