*! Help file Version 1.2 27Mar2018 for version 1.4 of margcost.ado

Title

margcost -- Estimate the marginal cost of an output based on
a previously estimated flexible cost function and test that it is significantly
different from zero.

Syntax

margcost
wrtvar
,
cmdline(string)
[options]

where wrtvar is the name of an existing variable appearing
on the right-hand-side of a previously
estimated total cost function. The command used to estimate the total cost function
is given in the required option cmdline(string). (The notation "wrt"
denotes the phrase "with respect to".)

Options for firstpartial

chain(string) unwind transformation for both dependent and -wrt- variables

chainlhs(string) unwind transformation for dependent variable

chainwrt(string) unwind transformation for output variable specified as
wrtvar

lambda(#) parameter used to unwind boxcox transformations
of wrtvar; only relevant if boxcox is specified in the -chainwrt(string)- option;
default is lambda(0.5)

force force execution even if the prefix on wrtvar does not match the -chain- option

Options for margins

post Enables margcost to post its results in estimates space.

*

Options for this program

replace Allows program to replace pre-existing variables with the same name

postname(string) Name of posted results

addest Uses companion program addest to store joint test results with the estimation results.

verbose Produces additional intermediate results, including the
output of the program firstpartial and the program margins

colnames(string) Provide alternative names for the matrix of margins results.

keephat Keep the predicted values of the dependent variable as variable
depvar_hat, where depvar is the name of the dependent variable
of the estimated total cost function. The default is to drop this variable.

Description

This help file is under construction.

margcost is a wrapper for the programs firstpartial and margins.
It executes the companion program firstpartial to exploit Stata's
margins command for the purpose of estimating the marginal cost of an output
appearing as a right-hand-side variable in a flexible total cost function. See the
help files for firstpartial and flexmake for further information.

First this program uses Stata's testparm command to conduct a test
of the joint hypothesis that all regression coefficients
containing the wrtvar variable are equal to zero.

Next this program uses Stata's generate command to compute the estimated
partial derivative of total cost with respect to the wrtvar variable at every
point in sample space. Applying the summarize, detail command,
this program yields information on the range and centiles of the estimated
partical derivative over the sample.

By feeding margins with the expression obtained from firstpartial
for the partial derivative of total cost with respect to the specified output (or price) variable,
this program feeds the generated expression to Stata's margins
command to estimate the partial derivative and its standard error.
By default, this estimation is at the mean of sample data.
With the appropriate options for the margins command, the user
can specify a point in sample space at which the marginal cost is estimated.

Examples

To be added.

Stored results

margcost stores the following in r():

Results from firstpartial

r(depvar) left-hand-side or dependent variable of the cost function.
In typical use, the variable name of this variable begins with a prefix
denoting a convex transformation. (e.g. ln or sqrt)

r(wrt) the "with-respect-to" variable.
In typical use, the variable name of this variable begins with a prefix
denoting a convex transformation. (e.g. ln or sqrt)

r(chainlhs) transformation applied to the left-hand-side variable.
Allowable transformations match the allowable prefixes for the depvar,
e.g. ln or sqrt.

r(chainwrt) transformation applied to the -with-respect-to- variable.
Allowable transformations match the allowable prefixes for the depvar,
e.g. ln or sqrt.

r(chain) transformation applied to both the left-hand-side variable and to the -with-respect-to- variable

r(tokenswowrt) tokens on the right-hand-side of the cost function, which do not include the with-respect-to variable

r(tokenswithwrt) tokens on the right-hand-side of the cost function, which include the with-respect-to variable

r(margexpression) expression for the first-partial derivative that can be used by Stata's margins commmand

r(genexpression) expression for the first-partial derivative that can be used by Stata's generate commmand

r(expression) general expression for the first-partial derivative

r(eqname) equation name when the cost function was one of several equations estimated
by a multi-equation estimator such as sureg

Test results from margcost

r(mn_MC_unwrt) Estimated MC
with respect to the unwound version of the variable -wrt-,
evaluated at the mean of all right-hand-side variables.

r(p25_MC_unwrt) Estimated MC
with respect to the unwound version of the variable -wrt-,
evaluated at the 25th percentile of all right-hand-side variables.

r(med_MC_unwrt) Estimated MC
with respect to the unwound version of the variable -wrt-,
evaluated at the 50th percentile of all right-hand-side variables.

r(p75_MC_unwrt) Estimated MC
with respect to the unwound version of the variable -wrt-,
evaluated at the 75th percentile of all right-hand-side variables.

r(Chi2_unwrt) Chi-squared statistic for the test
of the hypothesis that MC = 0.

r(F_unwrt) F statistic for the test
of the hypothesis that MC = 0.

r(p_unwrt) p-value of the Chi^2 or F statistic for the test
of the hypothesis that MC = 0.

Marginal cost results

r(b_marg)

r(p_marg)

r(V_marg)

r(margout)

e(eb_marg) Available only with the post option

e(eV_marg) Available only with the post option

References

This help file is under construction.
See help for flexmake for references on flexible cost functions.

Author

Mead Over at:
Email: MOver@CGDev.Org if you observe any problems.