Marginal effects after the tobit and censored regression This package serves to calculate marginal effects and associated statistics (standard errors, z-values and p-values) for censored regression models (including simple Tobit). Currently the package calculates only one type of effects: ∂E[y_i|x_i]/∂x_i, where y is the observed variable (see Greene(2003), subs. 22.3.2). The package offers a graphical interface which is designed to appear under the Analysis menu in gretl's model window; this is hard-wired to produce marginal effects at the sample means of all the regressors. The package interface is intended to be maximally similar to that of the lp-mfx package by Allin Cottrell. Four public functions are available. 1) tobit_mfx calculates marginal effects for each possible outcome at the sample means, along with standard errors via the delta method, and they return a bundle containing all the results. function bundle tobit_mfx (series y "dependent variable", list XL "list of regressors", scalar lo[0] "left limit", scalar hi[NA] "rigt limit") See the sample script for the use of default values of the cencoring points. This function is intended to use alongside with tobit_mfx_print (bundle *b) function for nice printing of the results (see the sample script). Note that the output bundle contains the covariance matrix of the marginal effects. Hence, a user could easy calculate marginal effects of functions of the regressors. The function estime the tobit model inside. Thats why it does no require $coeff, $model.full_vcv, and $sigma as inputs. Retained mostly for backward compatibility. 2) function bundle tobit_mfx1 (series y "dependent variable", list XL "list of regressors", matrix at[null] "vector of x-values", matrix coef "model coeffs", matrix vcov "model $model.full_vcv", scalar sigma "model $sigma", scalar lo[0], scalar hi[NA]) The same as tobit_mfx, but computes mfx's at given x-values. In contrast, it requires using tobit command beforehand and inputting the model $coeff, $model.full_vcv, $sigma. Note that it requires the new accessor (starting with 2016d version), $model.full_vcv instead of the usual $vcv. 3) function bundle tobit_mfx2 (series y "dependent variable", list XL "list of regressors", matrix coef "model coeffs", matrix vcov "model $model.full_vcv", scalar sigma "model $sigma", scalar lo[0], scalar hi[NA]) The same as tobit_mfx. In contrast, it requires using tobit command beforehand and inputting the model $coeff, $model.full_vcv, $sigma. Note that it requires the new accessor (starting with 2016d version), $model.full_vcv instead of the usual $vcv. 4) tobit_dp_dx function accept a k-vector, x, containing the values of the regressors at which the marginal effects should be found, and they return the k-vector of effects pertaining to a specific selected outcome. function matrix tobit_dp_dx (matrix b "parameter estimates", list XL "list of regressors", matrix x "vector of x-values", scalar s "sigma parameter of the tobit model", scalar lo[0] "left limit", scalar hi[NA] "right limit") Dummy variables (0/1) are detected and the marginal effect is calculated as the effect of a discrete change from 0 to 1. References ---------- Gretl User's Guide Gretl lp-mfx package Greene William H. (2003). Econometric Analysis, Upper Saddle River, NJ: Prentice-Hall, fifth edn. Maddala, G. (1983). Limited Dependent and Qualitative Variables in Econometrics. New York: Cambridge University Press. Appendix -------- Stata (TM) commands to compare the results of the sample scripts # load the data use "http://www.dartmouth.edu/~econ20pa/affairs.dta" # tobit_mfx_print(&b1) . tobit naffairs male age yrsmarr relig occup ratemarr, ll(0) . mfx compute, predict(ystar(0,.)) # tobit_mfx_print(&b2) . tobit naffairs male age yrsmarr relig occup ratemarr, ll(1) . mfx compute, predict(ystar(1,.)) # tobit_mfx_print(&b3) . tobit naffairs male age yrsmarr relig occup ratemarr, ul(4) . mfx compute, predict(ystar(.,4)) # tobit_mfx_print(&b4) . tobit naffairs male age yrsmarr relig occup ratemarr, ll(0) ul(4) . mfx compute, predict(ystar(0,4)) v.0.3 NEWS: 2 new functions tobit_mfx1 and tobit_mfx2 are added; tobit_mfx now uses the native tobit command, so the computations become much quicker and more exact v.0.4 (by the gretl team): internally replace some deprecated syntax, require gretl 2018a