Functions
SFrontiers.sfmodel_CI
— Methodsfmodel_CI(<keyword arguments>)
A general purpose (not specific to stochastic frontier models) function for obtaining bias-correctred (BC) confidence intervals from bootstrapped data. Return a $K x 1$ matrix of confidence intervals in the form of tuples, where $K$ is the number of bootstrap statistics.
See also the help file on sfmodel_boot_marginal()
.
Arguments
- bootdata::Array=<data>: The bootstrapped data of size $R x K$, where $R$ is the number of bootstrap samples (replications) and $K$ is the number of statistics. An example is the bootstrapped data from
sfmodel_boot_marginal(, ... getBootData=true)
. - observed::Union{Vector, Real, Tuple, NamedTuple}=<a vector of numbers>: The observed values of the statistics to which the confidence intervals are to be calculated. The length of
observed
should be equal to $K$. It could take the form of a single value (if $K=1$), a vector, a tuple, or a NamedTuple. - level::Real=<number>: The significance level (default=0.05) of the bias-corrected confidence intervals. If
level
>0.5, it is automatically transformed to1-level
, such thatlevel=0.05
andlevel=0.95
both return 95% confidene intervals at the 5% significance level. - verbose::Bool=true: Print the result.
Examples
julia> myans = sfmodel_fit(useData(df));
(output omitted)
julia> std_ci, bsdata = sfmodel_boot_marginal(result=myans, data=df, R=250, seed=123, getBootData=true);
(output omitted)
julia> sfmodel_CI(bootdata=bsdata, observed=myans.marginal_mean, level=0.10)
Bias-Corrected 90.0% Confidence Interval:
3×1 Matrix{Any}:
(-0.00655, 0.0009)
(-0.04064, 0.0086)
(-0.04663, -0.00872)
julia> # manually input observed values
julia> sfmodel_CI(bootdata=bsdata, observed=(-0.00264, -0.01197, -0.0265), level=0.10)
Bias-Corrected 90.0% Confidence Interval:
3×1 Matrix{Any}:
(-0.00655, 0.0009)
(-0.04064, 0.0086)
(-0.04663, -0.00872)
SFrontiers.sfmodel_boot_marginal
— Methodsfmodel_boot_marginal(<keyword arguments>)
Bootstrap standard errors and obtain bias-corrected (BC) confidence intervals for the mean marginal effects of inefficiency determinants. In default, return a $K x 2$matrix of standard errors (1st column) and confidence intervals (tuples, 2nd column), where
K
is the number of exogenous inefficiency determinants. With
getBootData=true, return two matrices: the first is the same as in the default return, and the second is the
R x K
` bootstrapped data.
See also the help file on sfmodel_CI()
.
Arguments
- result=<returned result>: The returned result from
sfmodel_fit()
. - data=<dataset>: The DataFrame dataset containing the model's data. Same as the one used in
sfmodel_fit()
. If the data was supplied by matrix (instead of DataFrame; i.e., the Method 2 ofsfmodel_spec()
), this option should be skipped. - R::Integer=<number>: The number of bootstrapped samples. The default is 500.
- level::Real=<number>: The significance level (default=0.05) of the bias-corrected confidence intervals. If
level
>0.5, it is automatically transformed to1-level
, such thatlevel=0.05
andlevel=0.95
both return 95% confidene intervals at the 5% significance level. - seed::Integer=<number>: A postive integer used to seed the random number generator (rng) for resampling, which ensures reproducibility. This rng is not global and is only effective in this function. If not specified, the global random number generator is used, and the bootstrap result may change (slightly) between different runs.
- iter::Integer=<number>: The maximum number of iterations for each bootstrapped sample. If the number is larger than 0, it overwrites the
main_maxIT
specified insfmodel_opt()
which is the default. - getBootData::Bool=false: Whether to return the bootstrapped data which is $R x K$ where K is the number of exogenous determinants of inefficiency.
- every::Integer=10: Print bootstrapping progress for every
every
samples.
Remarks
- Bootstrap samples are with replacement. For panel data, it samples cross-sectional units with replacement.
- In the MLE estimation, estimated coefficients from the main result is used as initial values. There is no
warmstart
. Themain_solver
,main_maxIT
, andtolerance
specified insfmodel_opt()
are used as default, but the value ofmain_maxIT
may be replaced by theiter
option.
Examples
julia> std_ci = sfmodel_boot_marginal(result=res, data=df, R=250, seed=123)
bootstrap in progress..10..20..30..40..50..60..70..80..90..100..110..120..130..140..150..160..170..180..190..200..210..220..230..240..250..Done!
┌────────┬──────────────────────┬─────────────────┬──────────────────────┐
│ │ mean of the marginal │ std.err. of the │ bias-corrected │
│ │ effect on E(u) │ mean effect │ 95.0% conf. int. │
├────────┼──────────────────────┼─────────────────┼──────────────────────┤
│ age │ -0.00264 │ 0.00225 │ (-0.00734, 0.0016) │
│ school │ -0.01197 │ 0.01765 │ (-0.048, 0.01224) │
│ yr │ -0.02650 │ 0.01221 │ (-0.05257, -0.00447) │
└────────┴──────────────────────┴─────────────────┴──────────────────────┘
3×2 Matrix{Any}:
0.00224786 (-0.00734, 0.0016)
0.0176472 (-0.048, 0.01224)
0.012213 (-0.05257, -0.00447)
julia> std_ci, bsdata = sfmodel_boot_marginal(result=res, data=df, R=250, seed=123, getBootData=true);
(output omitted)
julia> bsdata
250×3 adjoint(::Matrix{Real}) with eltype Real:
-0.000493033 -0.00840051 -0.0339088
-0.00510175 -0.0128184 -0.0147759
-0.0024987 -0.00971428 -0.00989262
-0.00157346 -0.0265515 -0.0140001
-0.00352179 -0.00670365 -0.0246122
-0.00375162 -0.0070496 -0.0306034
-0.00153094 -0.0154201 -0.0367731
0.000149329 0.00672036 -0.0461389
⋮
-0.00373306 -0.0108364 -0.00871898
-0.00170254 -0.0393002 -0.0500638
0.000686169 0.00241594 -0.018542
0.000258745 0.000183392 -0.039621
-0.00408104 -0.014574 -0.024126
-0.00417206 -0.0192443 -0.0406959
0.00266017 -0.0396552 -0.0359759
SFrontiers.sfmodel_fit
— Methodsfmodel_fit(<keyword arguments>)
Maximum likelihood estimation of the stochastic frontier model specified in sfmodel_spec(...)
. Estimate the model parameters, calculate Jondrow et al. (1982) inefficiency index and Battese and Coelli (1988) efficiency index, compute marginal effects of inefficiency determinants (if any). Return a dictionary with results.
Arguments
useData(::DataFrame)
: The DataFrame used with the Method 1 ofsfmodel_spec(...)
. If use Method 2 ofsfmodel_spec(...)
(viz., data is supplied by individual matrices), do not need this keyword argument.
Remarks
- Use
Optim.jl
to carry out the estimation. - Users do not need to provide gradient or Hessian functions even if gradient-based optimization algorithms are used. The package uses automatic differentiation (https://en.wikipedia.org/wiki/Automatic_differentiation) to compute the derivatives. AD is not numerical finite differentiation. AD is fast and as accurate as the symbolic differentiation.
Examples
sfmodel_fit(useData(df)) # Method 1
sfmodel_fit() # Method 2
SFrontiers.sfmodel_init
— Methodsfmodel_init(<keyword arguments>)
Provide initial values for the stochastic frontier model estimation. The values could be a vector or scalars. It creates a global dictionary _dicINI
. Optional.
Arguments
all_init(::Union{Vector, Real})
: initial values of all the parameters in the modelfrontier(::Union{Vector, Real})
: initial values of parameters in thefrontier()
functionμ(::Union{Vector, Real})
ormu(::Union{Vector, Real})
: initial values of parameters in theμ
functionhscale(::Union{Vector, Real})
: initial values of parameters in thehscale()
functiongamma(::Union{Vector, Real})
: initial values of parameters in thegamma()
functionσᵤ²(::Union{Vector, Real})
orsigma_u_2(::Union{Vector, Real})
: initial values of parameters in theσᵤ²
functionσᵥ²(::Union{Vector, Real})
orsigma_v_2(::Union{Vector, Real})
: initial values of parameters in theσᵥ²
functionσₐ²(::Union{Vector, Real})
orsigma_a_2(::Union{Vector, Real})
: initial values of parameters in theσₐ²
function- message::Bool: Whether printing (=true) or not (=false, the default) the confirmation message "A dictionary from sfmodelinit() is generated." on the screen after `sfmodelinit()` is successfully executed.
Remarks
- Equations do not have to follow specific orders.
sfmodel_init(...)
is optional but is highly recommended. If it is not specified or is specified as an empty set, default values are used.- It is not necessary to specify a complete set of equations. A partial list or even empty lists are acceptable. Default values will be substituted for the missing equations.
- The generated
_dicINI
is inheritable in the sense that an exiting_dicINI
(from the previous run of the same or a different model, for example) will be used if the current model does not have its ownsfmodel_init(...)
. This design has advantages in a simulations study wheresfmodel_init(...)
needs to be specified only once.
Examples
b_ini = ones(2)*0.2
sfmodel_init( # frontier(bb), # may skip and use default
μ(b_ini), # may use a vector
σᵤ²(-0.1, -0.1),
σᵥ²(-0.1) )
sfmodel_init(all_init(0.1, 0.2, 0.5, 0.0, -0.1, -0.1, -0.1),
message = false)
SFrontiers.sfmodel_opt
— Methodsfmodel_opt(<keyword arguments>)
Provide options to the optimization algorithms for the maiximum likelihood estimation. It creates a global dictionary _dicOPT
. Optional. The Optim
package is used for the optimization, and a subset of Optim
's keywords are directly accessible from this API.
Arguments
warmstart_solver(algorithm)
: The algorithm used in the first-stage ("warmstart") optimization process, which serves the purpose of improving upon the initial values for the second-stage ("main") estimation. The default isNelderMead()
. Others includeSimulatedAnnealing()
,SAMIN()
,ParticleSwarm()
,ConjugateGradient()
,GradientDescent()
,BFGS()
,LBFGS()
,Newton()
,NewtonTrustRegion()
, andIPNewton()
. See http://julianlsolvers.github.io/Optim.jl/stable/ for details. Non-gradient based algorithms are recommended for the warmstart solver.warmstart_maxIT(::Int64)
: The iteration limit for the warmstart. Default is 100.main_solver(algorithm)
: The algorithm used in the main opimization process. The default isNewton()
. Others includeSimulatedAnnealing()
,SAMIN()
,ParticleSwarm()
,ConjugateGradient()
,GradientDescent()
,BFGS()
,LBFGS()
,NewtonTrustRegion()
, andIPNewton()
. See http://julianlsolvers.github.io/Optim.jl/stable/ for details.main_maxIT(::Int64)
: The iteration limit for the main estimation. Default is 2000.tolerance(::Float64)
: The convergence criterion ("tolerance") based on the absolute value of gradients. Default is 1.0e-8. For non-gradient algorithms, it controls the main convergence tolerance, which is solver specific. SeeOptim
'sg_tol
option for more information.verbose(::Bool)
: Print on screen (true
, the default) the information of the model and the optimization results.banner(::Bool)
: Print on screen (true
, the default) a banner to serve as a visual indicator of the start of the estimation.ineff_index(::Bool)
: Whether to compute the Jondrow et al. (1982) inefficiency index and the Battese and Coelli (1988) efficiency index. The defauistrue
.marginal(::Bool)
: Whether to compute the marginal effects of the exogenous determinants of inefficiency (if any).table_format()
: The format to print the coefficient tables on the screen:text
(default),html
, orlatex
. A wrapper ofPrettyTables.jl
'sbackend
option.- message::Bool: Whether printing (=true) or not (=false, the default) the confirmation message "A dictionary from sfmodelopt() is generated." on the screen after `sfmodelopt()` is successfully executed.
Remarks
sfmodel_opt(...)
is optional. It can be omitted entirely, or specifying only a partial list of the keywords.- If any of the keywords are missing, default values are used.
- If warmstart is not needed, you need to give empty keyword values to warmstart related keys. E.g., either
warmstart_solver()
orwarmstart_maxIT()
, or both. Omitting the keyword entirely (i.e., not writing downwarmstart_solver
orwarmstart_maxIT
) will not skip the warmstart, but will reinstate the default. - Users do not need to provide gradient or Hessian functions even if gradient-based optimization algorithms are used. The package uses automatic differentiation (https://en.wikipedia.org/wiki/Automatic_differentiation) to compute the derivatives. It is not numerical finite differentiation. It is fast and as accurate as the symbolic differentiation.
- The
_dicOPT
is inheritable in the sense that an exiting_dicOPT
(from the previous run of the same or a different model, for example) will be used if the current model does not have its ownsfmodel_opt(...)
. This design has advantages in simulation studies wheresfmodel_opt(...)
needs to be specified only once.
Examples
sfmodel_opt(warmstart_solver(NelderMead()),
warmstart_maxIT(200),
main_solver(Newton()),
main_maxIT(2000),
tolerance(1e-8),
message = false)
SFrontiers.sfmodel_spec
— Methodsfmodel_spec(<keyword arguments>)
Provide specifications of the stochastic frontier model, including the type of model and names of variables or matrix used in estimating the model. Two ways to specify: Method 1: Use DataFrame as input, and Method 2: use matrix as input.
Method 1 (DataFrame input)
Variables come from a DataFrame, and column names of the Dataframe are used in the variable input. With this method, equations are identified by macros but not functions (e.g., @depvar()
but not depvar()
).
Arguments of Method 1
sfdist(::Vararg)
: the distribution assumption of the one-sided stochastic variable (aka inefficiency term) of the model; possible choices includetruncated
(ortrun
,t
),half
(orh
),exponential
(orexpo
,e
), andtrun_scale
(ortrun_scaling
,ts
).sftype(::Vararg)
: whether the model is aproduction
(orprod
) frontier or acost
frontier.sfpanel(::Vararg)
: the type of panel model. Choices includeTFE_WH2010
(true fixed effect model of Wang and Ho 2010 JE),TFE_CSW2014
(true fixed model of Chen, Schmidt, and Wang 2014 JE),TRE
(true random effect model of Greene 2004),TimeDecay
(time decay model of Battese and Coelli 1992).@depvar(::Vararg)
: the dependent variable from a DataFrame.@frontier(::Vararg)
: a list of variables, separated by commas, in the frontier function.@μ(::Vararg)
or@mu(::Vararg)
: a list of variable, separated by comma, in the linear function of μ. (sftype(trun)
only).@σᵥ²(::Vararg)
or@sigma_v_2(::Vararg)
: a list of variable, separated by comma, in the σᵥ² equation.@σᵤ²(::Vararg)
or@sigma_u_2(::Vararg)
: a list of variable, separated by comma, in the σᵤ² equation.@σₐ²(::Vararg)
or@sigma_a_2(::Vararg)
: a list of variable, separated by comma, in the σₐ² equation.sfpanel(TRE)
only.@gamma(::Vararg)
: a list of variables, separated by commas, in the gamma equation.sfpanel(TimeDecay)
only.@timevar(::Vararg)
: the variable containing the time period information. Panel data model only.@idvar(::Vararg)
: the variable identifying each individual. Panel data model only.- message::Bool: Whether printing (=true) or not (=false, the default) the confirmation message "A dictionary from sfmodelspec() is generated." on the screen after `sfmodelspec()` is successfully executed.
Method 2 (matrix/vector input)
Data of the variables are provided by individual matrices or vectors, and names of the mat/vec are used in the equations. With this method, equations are identified by functions but not macros (e.g., depvar()
but not @depvar()
). Note that if, for instance, the name of depvar
or σᵤ²
has been used elsewhere in the program, using these names to read in mat/vec will cause name conflict (MethodError: objects of type ... are not callable
). The workaround is to fully qualify the function names, e.g., SFrontiers.depvar
, SFrontiers.σᵤ²
, etc. Or, use the alias (if available), e.g., sigma_u_2
instead of σᵤ²
.
Arguments of Method 2
sfdist(::Vararg)
: the distribution assumption on the inefficiency term; possible choices includetruncated
(ortrun
,t
),half
(orh
),exponential
(orexpo
,e
), andtrun_scale
(ortrun_scaling
,ts
).sftype(::Vararg)
: whether the model is aproduction
(orprod
) frontier or acost
frontier.sfpanel(::Vararg)
: the type of panel model. Choices includeTFE_WH2010
(true fixed effect model of Wang and Ho 2010 JE),TFE_CSW2014
(true fixed model of Chen, Schmidt, and Wang 2014 JE),TRE
(true random effect model of Greene 2004),TimeDecay
(time decay model of Battese and Coelli 1992).depvar(::Matrix)
: Matrix or vector of the dependent variable.frontier(::Matrix)
: matrix or vector for frontier function.μ(::Matrix)
ormu(::Matrix)
: matrix or vector for the (linear) μ equation (trun
type only).σᵤ²(::Matrix)
orsigma_u_2(::Matrix)
: matrix or vector for the σᵤ² equation.σₐ²(::Matrix)
orsigma_a_2(::Matrix)
: matrix or vector for the σₐ² equation.- message::Bool: Whether printing (=true) or not (=false, the default) the confirmation message "A dictionary from sfmodelspec() is generated." on the screen after `sfmodelspec()` is successfully executed.
Examples
sfmodel_spec(sftype(prod), sfdist(trun),
@depvar(output),
@frontier(land, , labor, bull, year, _cons),
@μ(age, school, year, _cons),
@σᵤ²(age, school, year, _cons),
@σᵥ²(_cons));
sfmodel_spec(sfpanel(TRE), sftype(prod), sfdist(half),
@timevar(yr), @idvar(id),
@depvar(y),
@frontier(x1, x2, _cons),
@σₐ²(_cons),
@σᵤ²(_cons),
@σᵥ²(_cons),
message = false);
SFrontiers.sfmodel_MoMTest
— Methodsfmodel_MoMTest(<keyword arguments>)
Provide method-of-moments (MoM) tests on the distribution assumptions of the composed error (v-u or v+u) of stochastic frontier models. Also provide MoM estimates of the model parameters as well as the inefficiency (JLMS) and efficiency (BC) index. Return various results in a distionary.
Arguments
sfdist(::Vararg)
: the distribution assumption of the one-sided stochastic variable (aka inefficiency term) of the model. Currently the choices includehalf
(orh
) andexponential
(orexpo
,e
)sftype(::Vararg)
: whether the model is aproduction
(orprod
) frontier or acost
frontier.@depvar(::Vararg)
: the dependent variable from thedata
.@frontier(::Vararg)
: a list of variables, separated by commas, in the frontier function.data::DataFrames
: the data in the DataFrames format.omega (or ω)::Union{Real, Vector, Tuple}=<a vector of numbers>
: Theω
parameter used in the test. It could take the form of a single value (e.g.,ω=1
) or a vector or tuple (e.g.,ω=(0.5, 1, 2)
). Default isω=1.0
.level::Real=<number>
: The significance level (default=0.05) of the bias-corrected confidence intervals. Iflevel
>0.5, it is automatically transformed to1-level
, such thatlevel=0.05
andlevel=0.95
both return 95% confidene intervals at the 5% significance level.verbose::Bool
: whether print results on screen. Default is=true
.testonly::Bool
: whether to print only the test results. Default isfalse
, which print both the test and the estimation results on the screen.
Remarks
- Currently, the two-sided error (aka
v
) of the model is assumed to follow a normal distribuion in the test. - Reference: Chen, Y.T., & Wang, H.J. (2012). Centered-Residuals-Based Moment Estimator and Test for Stochastic Frontier Models. Econometric Reviews, 31(6), 625-653.
Examples
julia> df = DataFrame(CSV.File("demodata.csv"))
julia> df[!, :_cons] .=1.0;
julia> res = sfmodel_MoMTest(sftype(prod), sfdist(expo),
@depvar(y), @frontier(_cons, x1, x2, x3),
data=df, ω=(0.5,1,2))
julia> res.list # a list of the saved results
julia> res.jlms # the JLMS inefficiency index
SFrontiers.all_init
— Methodall_init(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for all the parameters in the model.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( all_init(0.1, 0.2, 0.5, -0.1, -0.1, -0.2), ...)
b0 = ones(6)*0.1
sfmodel_init( all_init(b0), ...)
SFrontiers.banner
— Functionbanner(arg::Bool)
An argument in sfmodel_opt()
. Specify whether to print on screen (true
, the default) a banner to serve as a visual indicator of the start of the estimation.
See the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( banner(false), ...)
SFrontiers.depvar
— Methoddepvar(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the maxrix name where the matrix is used as the data of the dependent variable.
See the help on sfmodel_spec()
for more information.
Examples
julia> ymat
100×1 Matrix{Float64}:
0.0005852467656204083
-0.9128698116696892
-1.1087862468093093
-1.0714018769972091
-0.606943663382492
0.37648407866805467
-0.1281971631844683
⋮
0.8541895741866585
1.5109216952026845
-0.3519833126683764
-1.0378799750720447
-0.9990384371507885
0.18858962788775305
sfmodel_spec(depvar(ymat), ...)
SFrontiers.frontier
— Methodfrontier(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the frontier
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> xmat
100×3 Matrix{Float64}:
-0.682942 0.440045 1.0
-0.680902 -1.68124 1.0
1.29108 -1.5516 1.0
0.683652 -0.0319451 1.0
-0.973079 1.11636 1.0
-0.343229 0.314457 1.0
0.107583 0.688177 1.0
⋮
0.0943377 -0.781928 1.0
-0.599142 -1.01591 1.0
-0.56726 -1.03394 1.0
1.33522 0.135763 1.0
1.13235 0.0177493 1.0
-0.310638 -0.314166 1.0
sfmodel_spec(frontier(xmat), ...)
SFrontiers.frontier
— Methodfrontier(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the frontier
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init(frontier(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( frontier(b0), ...)
SFrontiers.gamma
— Methodgamma(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the gamma
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> gmat
100×2 Matrix{Float64}:
-0.943133 1.0
-0.897392 1.0
0.585447 1.0
-0.46106 1.0
-0.54563 1.0
-0.619428 1.0
0.0575559 1.0
⋮
0.0844192 1.0
-1.3339 1.0
1.29332 1.0
0.691466 1.0
0.422962 1.0
0.374425 1.0
sfmodel_spec(gamma(gmat), ...)
SFrontiers.gamma
— Methodgamma(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the gamma
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( gamma(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( gamma(b0), ...)
SFrontiers.hscale
— Methodhscale(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the hscale
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> hmat
100×2 Matrix{Float64}:
-0.943133 1.0
-0.897392 1.0
0.585447 1.0
-0.46106 1.0
-0.54563 1.0
-0.619428 1.0
0.0575559 1.0
⋮
0.0844192 1.0
-1.3339 1.0
1.29332 1.0
0.691466 1.0
0.422962 1.0
0.374425 1.0
sfmodel_spec(hscale(hmat), ...)
SFrontiers.hscale
— Methodhscale(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the hscale
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( hscale(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( hscale(b0), ...)
SFrontiers.idvar
— Methodidvar(arg::Vararg)
An argument in sfmodel_sepc()
for panel data models. Specify the name of the matrix containing the individual's id information of the panel data.
See the help on sfmodel_spec()
for more information.
Examples
julia> idmat
100-element Vector{Int64}:
1
1
1
1
2
2
2
⋮
24
24
25
25
25
25
sfmodel_spec( idvar(idmat), ...)
SFrontiers.ineff_index
— Functionineff_index(arg::Bool)
An argument in sfmodel_opt()
. Specify whether (true
, the default) to compute the Jondrow et al. (1982) inefficiency index and the Battese and Coelli (1988) efficiency index.
See the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( ineff_index(false), ...)
SFrontiers.main_maxIT
— Functionmain_maxIT(arg)
An argument in sfmodel_opt()
. Specify the iteration limit for the main solver. Default is 2000.
See the help on sfmodel_opt()
for more information.
Examples
julia sfmodel_opt( main_maxIT(2500), ...)
SFrontiers.main_solver
— Functionmain_solver(arg)
An argument in sfmodel_opt()
. Specify the algorithm used in the 2nd-stage ("main") optimization process.
The default is Newton()
. Others include SimulatedAnnealing()
, SAMIN()
, ParticleSwarm()
, ConjugateGradient()
, GradientDescent()
, BFGS()
, LBFGS()
, NewtonTrustRegion()
, and IPNewton()
. See http://julianlsolvers.github.io/Optim.jl/stable/ for details.
See the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( main_solver(Newton()), ...)
SFrontiers.marginal
— Functionmarginal(arg::Bool)
An argument in sfmodel_opt()
. Specify whether (true
, the default) to compute the marginal effects of the exogenous determinants of inefficiency (if any).
See the help on sfmodel_opt()
for more information.
Examples
julia sfmodel_opt( marginal(false), ...)
SFrontiers.mu
— Methodmu(arg::Vararg)
alias of μ. See help on μ.
SFrontiers.mu
— Methodmu(arg::Vector)
alias of μ. See help on μ.
SFrontiers.sfdist
— Methodsfdist(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the distribution assumption of the one-sided stochastic variable (aka inefficiency term) of the model. Possible choices include truncated
(or trun
, t
), half
(or h
), exponential
(or expo
, e
), and trun_scale
(or trun_scaling
, ts
).
See the help on sfmodel_spec()
for more information.
Examples
sfmodel_spec(sfdist(t), ...)
sfmodel_spec(sfdist(h), ...)
SFrontiers.sftype
— Methodsftype(arg::Vararg)
An argument in sfmodel_sepc()
. Specify whether the model is a production
(or prod
) frontier or a cost
frontier.
See the help on sfmodel_spec()
for more information.
Examples
sftype(production)
sftype(cost)
SFrontiers.sigma_a_2
— Methodsigmaa2(arg::Vararg)
alias of σₐ². See help on σₐ².
SFrontiers.sigma_a_2
— Methodsigmaa2(arg::Vector)
alias of σₐ². See help on σₐ².
SFrontiers.sigma_u_2
— Methodsigmau2(arg::Vararg)
alias of σᵤ². See help on σᵤ².
SFrontiers.sigma_u_2
— Methodsigmau2(arg::Vector)
alias of σᵤ². See help on σᵤ².
SFrontiers.sigma_v_2
— Methodsigmav2(arg::Vararg)
alias of σᵥ². See help on σᵥ².
SFrontiers.sigma_v_2
— Methodsigmav2(arg::Vector)
alias of σᵥ². See help on σᵥ².
SFrontiers.table_format
— Functiontable_format(arg)
An argument in sfmodel_opt()
. Specify the format to print the coefficient tables on the screen: text
(default), html
, or latex
. A wrapper of PrettyTables.jl
's backend
option.
See the help on sfmodel_opt()
for more information.
Examples
julia sfmodel_opt( table_format(html), ...)
SFrontiers.timevar
— Methodtimevar(arg::Vararg)
An argument in sfmodel_sepc()
for panel data models. Specify the name of the matrix containing the time information of the panel data.
See the help on sfmodel_spec()
for more information.
Examples
julia> timemat
100-element Vector{Int64}:
2019
2020
2021
2022
2019
2020
2021
⋮
2021
2022
2019
2020
2021
2022
sfmodel_spec( timvar(timemat), ...)
SFrontiers.tolerance
— Functiontolerance(arg::Float64)
An argument in sfmodel_opt()
. Specify the convergence criterion ("tolerance") based on the absolute value of gradients. Default is 1.0e-8. For non-gradient algorithms, it controls the main convergence tolerance, which is solver specific. See Optim
's g_tol
option for more information.
Also see the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( tolerance(1.0e-6), ...)
SFrontiers.useData
— MethoduseData(D::DataFrame)
An argument in sfmodel_fit()
. Specify the name of the DataFrame that contains the estimation data.
See the help on sfmodel_fit()
for more information.
Examples
julia> mydf
100×4 DataFrame
│ Row │ year │ firm │ yvar │ xvar1 │
│ │ Int64 │ Int64 │ Int64 │ Float64 │
├─────┼───────┼───────┼───────┼───────────┤
│ 1 │ 2019 │ 1 │ 1 │ 0.77645 │
│ 2 │ 2020 │ 1 │ 2 │ 0.0782388 │
│ 3 │ 2021 │ 1 │ 3 │ 0.222884 │
│ 4 │ 2022 │ 1 │ 4 │ 0.762864 │
⋮
│ 96 │ 2022 │ 24 │ 96 │ 0.590184 │
│ 97 │ 2019 │ 25 │ 97 │ 0.364425 │
│ 98 │ 2020 │ 25 │ 98 │ 0.639463 │
│ 99 │ 2021 │ 25 │ 99 │ 0.500526 │
│ 100 │ 2022 │ 25 │ 100 │ 0.239137 │
sfmodel_fit(useData(mydf), ...)
SFrontiers.verbose
— Functionverbose(arg::Bool)
An argument in sfmodel_opt()
. Specify whether to print on screen (true
, the default) the information of the model and the optimization results.
See the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( verbose(false), ...)
SFrontiers.warmstart_maxIT
— Functionwarmstart_maxIT(arg)
An argument in sfmodel_opt()
. Specify the iteration limit for the warmstart. Default is 100.
See the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( warmstart_maxIT(400), ...)
SFrontiers.warmstart_solver
— Functionwarmstart_solver(arg)
An argument in sfmodel_opt()
. Specify the algorithm used in the first-stage ("warmstart") optimization process.
The default is NelderMead()
. Others include SimulatedAnnealing()
, SAMIN()
, ParticleSwarm()
, ConjugateGradient()
, GradientDescent()
, BFGS()
, LBFGS()
, Newton()
, NewtonTrustRegion()
, and IPNewton()
. See http://julianlsolvers.github.io/Optim.jl/stable/ for details. Non-gradient based algorithms are recommended for the warmstart solver.
See the help on sfmodel_opt()
for more information.
Examples
sfmodel_opt( warmstart_solver(NelderMead()), ...)
SFrontiers.μ
— Methodμ(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the μ
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> mumat
100×2 Matrix{Float64}:
-0.943133 1.0
-0.897392 1.0
0.585447 1.0
-0.46106 1.0
-0.54563 1.0
-0.619428 1.0
0.0575559 1.0
⋮
0.0844192 1.0
-1.3339 1.0
1.29332 1.0
0.691466 1.0
0.422962 1.0
0.374425 1.0
sfmodel_spec(μ(mumat), ...)
SFrontiers.μ
— Methodμ(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the μ
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( μ(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( μ(b0), ...)
SFrontiers.σᵤ²
— Methodσᵤ²(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the σᵤ²
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> zmat
100×2 Matrix{Float64}:
-0.943133 1.0
-0.897392 1.0
0.585447 1.0
-0.46106 1.0
-0.54563 1.0
-0.619428 1.0
0.0575559 1.0
⋮
0.0844192 1.0
-1.3339 1.0
1.29332 1.0
0.691466 1.0
0.422962 1.0
0.374425 1.0
sfmodel_spec(σᵤ²(zmat), ...)
SFrontiers.σᵤ²
— Methodσᵤ²(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the σᵤ²
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( σᵤ²(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( σᵤ²(b0), ...)
SFrontiers.σᵥ²
— Methodσᵥ²(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the σᵥ²
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> sigv2mat
100×2 Matrix{Float64}:
-0.943133 1.0
-0.897392 1.0
0.585447 1.0
-0.46106 1.0
-0.54563 1.0
-0.619428 1.0
0.0575559 1.0
⋮
0.0844192 1.0
-1.3339 1.0
1.29332 1.0
0.691466 1.0
0.422962 1.0
0.374425 1.0
sfmodel_spec(σᵥ²(sigv2mat), ...)
SFrontiers.σᵥ²
— Methodσᵥ²(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the σᵥ²
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( σᵥ²(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( σᵥ²(b0), ...)
SFrontiers.σₐ²
— Methodσₐ²(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the name of the maxrix used as the data of the σₐ²
function.
See the help on sfmodel_spec()
for more information.
Examples
julia> amat
100×2 Matrix{Float64}:
-0.943133 1.0
-0.897392 1.0
0.585447 1.0
-0.46106 1.0
-0.54563 1.0
-0.619428 1.0
0.0575559 1.0
⋮
0.0844192 1.0
-1.3339 1.0
1.29332 1.0
0.691466 1.0
0.422962 1.0
0.374425 1.0
sfmodel_spec(σₐ²(amat), ...)
SFrontiers.σₐ²
— Methodσₐ²(arg::Vector)
An argument in sfmodel_init()
. Specify the initial values for coefficients in the σₐ²
function.
See the help on sfmodel_init()
for more information.
Examples
sfmodel_init( σₐ²(0.1, 0.2, 0.5), ...)
b0 = ones(3)*0.1
sfmodel_init( σₐ²(b0), ...)
SFrontiers.@depvar
— Macro@depvar(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the dependent variable using a column name from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec(@depvar(yvar), ...)
SFrontiers.@eq
— Macro@eq(arg)
An argument in sfmodel_predict()
. Specify the name of the function to be predicted.
See the help on sfmodel_predict()
for more information.
Examples
sfmodel_predict( @eq(frontier), ...)
SFrontiers.@frontier
— Macro@frontier(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the frontier
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec(@frontier(xvar1, xvar2, _cons), ...)
SFrontiers.@gamma
— Macro@gamma(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the gamma
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec( @gamma(zvar, _cons), ...)
SFrontiers.@hscale
— Macro@hscale(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the hscale
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec( @hscale(zvar, _cons), ...)
SFrontiers.@idvar
— Macro@idvar(arg::Vararg)
An argument in sfmodel_sepc()
for panel data models. Specify the column name of a DataFrame that contain the individual's id information of the panel data.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×4 DataFrame
│ Row │ year │ firm │ yvar │ xvar1 │
│ │ Int64 │ Int64 │ Int64 │ Float64 │
├─────┼───────┼───────┼───────┼───────────┤
│ 1 │ 2019 │ 1 │ 1 │ 0.77645 │
│ 2 │ 2020 │ 1 │ 2 │ 0.0782388 │
│ 3 │ 2021 │ 1 │ 3 │ 0.222884 │
│ 4 │ 2022 │ 1 │ 4 │ 0.762864 │
⋮
│ 96 │ 2022 │ 24 │ 96 │ 0.590184 │
│ 97 │ 2019 │ 25 │ 97 │ 0.364425 │
│ 98 │ 2020 │ 25 │ 98 │ 0.639463 │
│ 99 │ 2021 │ 25 │ 99 │ 0.500526 │
│ 100 │ 2022 │ 25 │ 100 │ 0.239137 │
sfmodel_spec( @idvar(firm), ...)
SFrontiers.@mu
— Macro@mu(arg::Vararg)
alias of @μ. See help on @μ.
SFrontiers.@sigma_a_2
— Macro@sigmaa2(arg::Vararg)
alias of @σₐ². See help on @σₐ².
SFrontiers.@sigma_u_2
— Macro@sigmau2(arg::Vararg)
alias of @σᵤ². See help on @σᵤ².
SFrontiers.@sigma_v_2
— Macro@sigmav2(arg::Vararg)
alias of @σᵥ². See help on @σᵥ².
SFrontiers.@timevar
— Macro@timevar(arg::Vararg)
An argument in sfmodel_sepc()
for panel data models. Specify the column name of a DataFrame that contain the time information of the panel data.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×4 DataFrame
│ Row │ year │ firm │ yvar │ xvar1 │
│ │ Int64 │ Int64 │ Int64 │ Float64 │
├─────┼───────┼───────┼───────┼───────────┤
│ 1 │ 2019 │ 1 │ 1 │ 0.77645 │
│ 2 │ 2020 │ 1 │ 2 │ 0.0782388 │
│ 3 │ 2021 │ 1 │ 3 │ 0.222884 │
│ 4 │ 2022 │ 1 │ 4 │ 0.762864 │
⋮
│ 96 │ 2022 │ 24 │ 96 │ 0.590184 │
│ 97 │ 2019 │ 25 │ 97 │ 0.364425 │
│ 98 │ 2020 │ 25 │ 98 │ 0.639463 │
│ 99 │ 2021 │ 25 │ 99 │ 0.500526 │
│ 100 │ 2022 │ 25 │ 100 │ 0.239137 │
sfmodel_spec( @timvar(year), ...)
SFrontiers.@μ
— Macro@μ(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the μ
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec( @μ(zvar, _cons), ...)
SFrontiers.@σᵤ²
— Macro@σᵤ²(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the σᵤ²
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec( @σᵤ²(zvar, _cons), ...)
SFrontiers.@σᵥ²
— Macro@σᵥ²(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the σᵥ²
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec( @σᵥ²(zvar, _cons), ...)
SFrontiers.@σₐ²
— Macro@σₐ²(arg::Vararg)
An argument in sfmodel_sepc()
. Specify the variables in the σₐ²
function using column names from a DataFrame.
See the help on sfmodel_spec()
for more information.
Examples
julia> df
100×5 DataFrame
│ Row │ yvar │ xvar1 │ xvar2 │ zvar │ _cons │
│ │ Int64 │ Float64 │ Float64 │ Float64 │ Float64 │
├─────┼───────┼───────────┼───────────┼───────────┼─────────┤
│ 1 │ 1 │ 0.0306449 │ 0.452148 │ 0.808817 │ 1.0 │
│ 2 │ 2 │ 0.460691 │ 0.296092 │ 0.454545 │ 1.0 │
│ 3 │ 3 │ 0.897503 │ 0.376972 │ 0.907454 │ 1.0 │
│ 4 │ 4 │ 0.682894 │ 0.776861 │ 0.161721 │ 1.0 │
⋮
│ 96 │ 96 │ 0.329647 │ 0.0914057 │ 0.825032 │ 1.0 │
│ 97 │ 97 │ 0.0781165 │ 0.338999 │ 0.761652 │ 1.0 │
│ 98 │ 98 │ 0.41394 │ 0.0063118 │ 0.295372 │ 1.0 │
│ 99 │ 99 │ 0.516381 │ 0.285415 │ 1.91995 │ 1.0 │
│ 100 │ 100 │ 0.944 │ 0.702226 │ -0.539848 │ 1.0 │
sfmodel_spec( @σₐ²(_cons), ...)
SFrontiers.sfmodel_MixTable
— Functionsfmodel_MixTable(<keyword arguments>)
Display and return critical values of the mixed χ²
(ch-square) distribution. The values are taken from Table 1, Kodde and Palm (1986, Econometrica).
Argument
dof::Integer
: the degree of freedom. Currently supportdof
between 1 and 40.
Examples
julia> sfmodel_MixTable(3)
* Significance levels and critical values of the mixed χ² distribution
┌─────┬───────┬───────┬───────┬────────┐
│ dof │ 0.10 │ 0.05 │ 0.025 │ 0.01 │
├─────┼───────┼───────┼───────┼────────┤
│ 3.0 │ 5.528 │ 7.045 │ 8.542 │ 10.501 │
└─────┴───────┴───────┴───────┴────────┘
source: Table 1, Kodde and Palm (1986, Econometrica).
SFrontiers.sfmodel_predict
— Methodsfmodel_predict(@eq(eq_name), data::DataFrame)
Return predicted values of an equation (eq_name
) of a stochastic frontier model specified and estimated by sfmodel_spec()
and sfmodel_fit()
.
Arguments:
@eq(eq_name)
: whereeq_name
is the name of the equation to which the value is to be predicted. A SF model has various equations, and different SF models have different sets of equations. Eligibleeq_name
s follow those specified insfmodel_spec()
. Theeq_name
may be specified using unicodes or their alias names; viz.,@eq(σᵤ²)
is the same as@eq(sigma_u_2)
. Also,log_σᵤ²
=log_sigma_u_2
,σᵥ²
=sigma_v_2
,log_σᵥ²
=log_sigma_v_2
,σₐ²
=sigma_a_2
,log_σₐ²
=log_sigma_a_2
, andμ
=mu
.data::DataFrame
: the DataFrame used insfmodel_fit()
. The DataFrame is required only when Method 1 is used in specifyingsfmodel_spec()
. If Method 2 is used instead, do not need this argument. See the help ofsfmodel_spec()
for the information on Method 1 and Method 2.
Remarks:
The predicted value is computed based on the equation's variable list and the estimated coefficient vector. For instance, if the frontier
function is a linear function of variables X
and coefficient vector β
, sfmodel_predict(@eq(frontier), df)
returns X*β̂
. If the variance function σᵤ²
is parameterized by an exponential function of Z
and δ
(i.e., σᵤ² = exp(Zδ)
), sfmodel_predict(@eq(log_σᵤ²))
returns Z*δ̂
and sfmodel_predict(@eq(σᵤ²))
returns exp(Z*δ̂)
.
Examples
frontier_hat = sfmodel_predict(@eq(frontier), df);
sigma_u_2_hat = sfmodel_predict(@eq(σᵤ²), df);
Index
SFrontiers.all_init
SFrontiers.banner
SFrontiers.depvar
SFrontiers.frontier
SFrontiers.frontier
SFrontiers.gamma
SFrontiers.gamma
SFrontiers.hscale
SFrontiers.hscale
SFrontiers.idvar
SFrontiers.ineff_index
SFrontiers.main_maxIT
SFrontiers.main_solver
SFrontiers.marginal
SFrontiers.mu
SFrontiers.mu
SFrontiers.sfdist
SFrontiers.sfmodel_CI
SFrontiers.sfmodel_MixTable
SFrontiers.sfmodel_MoMTest
SFrontiers.sfmodel_boot_marginal
SFrontiers.sfmodel_fit
SFrontiers.sfmodel_init
SFrontiers.sfmodel_opt
SFrontiers.sfmodel_predict
SFrontiers.sfmodel_spec
SFrontiers.sftype
SFrontiers.sigma_a_2
SFrontiers.sigma_a_2
SFrontiers.sigma_u_2
SFrontiers.sigma_u_2
SFrontiers.sigma_v_2
SFrontiers.sigma_v_2
SFrontiers.table_format
SFrontiers.timevar
SFrontiers.tolerance
SFrontiers.useData
SFrontiers.verbose
SFrontiers.warmstart_maxIT
SFrontiers.warmstart_solver
SFrontiers.μ
SFrontiers.μ
SFrontiers.σᵤ²
SFrontiers.σᵤ²
SFrontiers.σᵥ²
SFrontiers.σᵥ²
SFrontiers.σₐ²
SFrontiers.σₐ²
SFrontiers.@depvar
SFrontiers.@eq
SFrontiers.@frontier
SFrontiers.@gamma
SFrontiers.@hscale
SFrontiers.@idvar
SFrontiers.@mu
SFrontiers.@sigma_a_2
SFrontiers.@sigma_u_2
SFrontiers.@sigma_v_2
SFrontiers.@timevar
SFrontiers.@μ
SFrontiers.@σᵤ²
SFrontiers.@σᵥ²
SFrontiers.@σₐ²