elasticity {dsfa} R Documentation

## elasticity

### Description

Calculates and plots the elasticity of a smooth function.

### Usage

elasticity(object, select = NULL, plot = TRUE, se = TRUE)


### Arguments

 object fitted mgcv object with family comper() or comper_mv(). select specifying the smooth function for which the elasticity is calculated. If term=NULL the elasticities for all smooths of \mu are returned (excluding random and spatial effects). plot logical; if TRUE, plots the elasticities. If FALSE, returns the average elasticity. se logical; if TRUE, adds standard errors to the plot of elasticities.

### Details

Calculates the marginal product for parametric terms. For smooth terms the average of the derivative is calculated.

### Value

If plot is TRUE, plots the elasticities specified in select of the provided object. If plot is FALSE returns a named vector of the elasticity of the provided inputs.

### References

• Schmidt R, Kneib T (2023). “Multivariate distributional stochastic frontier models.” Computational Statistics & Data Analysis, 107796.

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

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

• Meeusen W, van Den Broeck J (1977). “Efficiency estimation from Cobb-Douglas production functions with composed error.” International economic review, 435–444.

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

y<-rcomper(n=N, mu=mu, sigma_v=sigma_v, sigma_u=sigma_u, s=s, distr="normhnorm")
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<-dsfa(formula=list(mu_formula, sigma_v_formula, sigma_u_formula),
data=dat, family=comper(s=s, distr="normhnorm"), optimizer = c("efs"))

#Get elasticities
elasticity(model, plot=TRUE)



[Package dsfa version 2.0.2 Index]