normhnorm {dsfa} R Documentation

## normhnorm family

### Description

The normhnorm family implements the normal-halfnormal distribution in which the \mu, \sigma_V and \sigma_U can depend on additive predictors. Useable only with mgcv::gam, the additive predictors are specified via a list of formulae.

### Usage

normhnorm(link = list("identity", "log", "log"), s = -1)


### Arguments

 link three item list specifying the link for the \mu, \sigma_V and \sigma_U parameters. See details. s s=-1 for production and s=1 for cost function.

### Details

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

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

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

3. The third formula is one sided, specifying the additive predictor for the \sigma_U on the right hand side. Link function is "log".

The fitted values and linear predictors for this family will be three column matrices. The first column is the \mu, the second column is the \sigma_V, the third column is \sigma_U. For more details of the distribution see dnormhnorm().

### Value

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

### References

• Schmidt R, Kneib T (2022). “Multivariate Distributional Stochastic Frontier Models.” arXiv preprint arXiv:2208.10294.

• Wood SN, Fasiolo M (2017). “A generalized Fellner-Schall method for smoothing parameter optimization with application to Tweedie location, scale and shape models.” Biometrics, 73(4), 1071–1081.

• Aigner D, Lovell CK, Schmidt P (1977). “Formulation and estimation of stochastic frontier production function models.” Journal of econometrics, 6(1), 21–37.

• Kumbhakar SC, Wang H, Horncastle AP (2015). A practitioner's guide to stochastic frontier analysis using Stata. Cambridge University Press.

• Azzalini A (2013). The skew-normal and related families, volume 3. Cambridge University Press.

• Schmidt R, Kneib T (2020). “Analytic expressions for the Cumulative Distribution Function of the Composed Error Term in Stochastic Frontier Analysis with Truncated Normal and Exponential Inefficiencies.” arXiv preprint arXiv:2006.03459.

### Examples

#Set seed, sample size and type of function
set.seed(1337)
N=500 #Sample size
s=-1 #Set to production function

#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)

#Set parameters of the distribution
mu=2+0.75*x1+0.4*x2+0.6*x2^2+6*log(x3+2)^(1/4) #production function parameter
sigma_v=exp(-1.5+0.75*x4) #noise parameter
sigma_u=exp(-1+sin(2*pi*x5)) #inefficiency parameter

#Simulate responses and create dataset
y<-rnormhnorm(n=N, mu=mu, sigma_v=sigma_v, sigma_u=sigma_u, s=s)
dat<-data.frame(y, x1, x2, x3, x4, x5)

#Write formulae for parameters
mu_formula<-y~x1+x2+I(x2^2)+s(x3, bs="ps")
sigma_v_formula<-~1+x4
sigma_u_formula<-~1+s(x5, bs="ps")

#Fit model
model<-mgcv::gam(formula=list(mu_formula, sigma_v_formula, sigma_u_formula),
data=dat, family=normhnorm(s=s), optimizer = c("efs"))

#Model summary
summary(model)

#Smooth effects
#Effect of x3 on the predictor of the production function
plot(model, select=1) #Estimated function
lines(x3[order(x3)], 6*log(x3[order(x3)]+2)^(1/4)-
mean(6*log(x3[order(x3)]+2)^(1/4)), col=2) #True effect

#Effect of x5 on the predictor of the inefficiency
plot(model, select=2) #Estimated function
lines(x5[order(x5)], -1+sin(2*pi*x5)[order(x5)]-
mean(-1+sin(2*pi*x5)),col=2) #True effect



[Package dsfa version 1.0.1 Index]