dirifit

Authors: Maarten L. Buis, Nicholas J. Cox, and Stephen P. Jenkins

dirifit fits by maximum likelihood a Dirichlet distribution to a set of variables. Usually these variables are proportions, e.g. proportions of the budget of municipalities spent on categories school, police, and other. These proportions can be made dependent on covariates, e.g. political orientation of ruling parties, and whether or not the municipality is urban. This can be done using either the conventional parametrization for the Dirichlet distribution, or in a more regression like parametrization analogous to a parametrization which was independently proposed by Philip Paolino (2001), Silvia Ferrari and Francisco Cribari-Neto (2004), and Michael Smithson and Jay Verkuilen (2006) for the beta distribution.

This package can be installed by typing in Stata: ssc install dirifit

Supporting materials

References

Ferrari, S.L.P. and Cribari-Neto, F. (2004). Beta regression for modelling rates and proportions. Journal of Applied Statistics 31(7): 799-815.

Paolino, P. (2001). Maximum likelihood estimation of models with beta-distributed dependent variables. Political Analysis 9(4): 325-346. link

Smithson, M. and Verkuilen, J. (2006) A better lemon squeezer? Maximum likelihood regression with beta-distributed dependent variables. Psychological Methods 11(1): 54-71.

Example

. use http://fmwww.bc.edu/repec/bocode/c/citybudget.dta, clear (Spending on different categories by Dutch cities in 2005)

. dirifit governing safety education recreation social urbanplanning, /// > mu(minorityleft noleft houseval popdens)

initial: log likelihood = -240.19125 alternative: log likelihood = 452.66345 rescale: log likelihood = 1689.6737 rescale eq: log likelihood = 1802.7632 Iteration 0: log likelihood = 1802.7632 (not concave) Iteration 1: log likelihood = 2110.9472 Iteration 2: log likelihood = 2699.3416 Iteration 3: log likelihood = 2989.2442 Iteration 4: log likelihood = 3125.8682 Iteration 5: log likelihood = 3127.4817 Iteration 6: log likelihood = 3127.4845 Iteration 7: log likelihood = 3127.4845

ML fit of Dirichlet (mu, phi) Number of obs = 392 Wald chi2(20) = 256.36 Log likelihood = 3127.4845 Prob > chi2 = 0.0000

------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- mu2 | minorityleft | .1227553 .0871296 1.41 0.159 -.0480156 .2935262 noleft | .0420214 .0895844 0.47 0.639 -.1335608 .2176036 houseval | -.1072955 .0712057 -1.51 0.132 -.2468562 .0322652 popdens | .0033622 .037627 0.09 0.929 -.0703853 .0771098 _cons | .7277289 .1258424 5.78 0.000 .4810823 .9743755 -------------+---------------------------------------------------------------- mu3 | minorityleft | -.0233997 .0916509 -0.26 0.798 -.2030321 .1562327 noleft | -.3304486 .0960681 -3.44 0.001 -.5187387 -.1421585 houseval | -.5970805 .0925149 -6.45 0.000 -.7784064 -.4157547 popdens | .0957056 .0392149 2.44 0.015 .0188457 .1725654 _cons | 1.082907 .1521303 7.12 0.000 .7847375 1.381077 -------------+---------------------------------------------------------------- mu4 | minorityleft | .1442345 .0930536 1.55 0.121 -.0381472 .3266161 noleft | -.029721 .0961912 -0.31 0.757 -.2182522 .1588102 houseval | -.1971356 .0798158 -2.47 0.014 -.3535717 -.0406995 popdens | .064591 .038892 1.66 0.097 -.0116359 .1408178 _cons | .4344822 .1388875 3.13 0.002 .1622678 .7066967 -------------+---------------------------------------------------------------- mu5 | minorityleft | .0667525 .0819769 0.81 0.415 -.0939192 .2274242 noleft | -.1842361 .0851565 -2.16 0.031 -.3511398 -.0173325 houseval | -.5519945 .0760799 -7.26 0.000 -.7011083 -.4028807 popdens | .1828056 .0338375 5.40 0.000 .1164853 .249126 _cons | 1.598407 .1274683 12.54 0.000 1.348574 1.84824 -------------+---------------------------------------------------------------- mu6 | minorityleft | .1548184 .0835142 1.85 0.064 -.0088665 .3185033 noleft | -.0213259 .0862757 -0.25 0.805 -.1904231 .1477713 houseval | -.160034 .068803 -2.33 0.020 -.2948854 -.0251825 popdens | .1301393 .0345991 3.76 0.000 .0623263 .1979523 _cons | .94753 .1211821 7.82 0.000 .7100176 1.185043 -------------+---------------------------------------------------------------- /ln_phi | 3.680083 .0311479 118.15 0.000 3.619035 3.741132 -------------+---------------------------------------------------------------- phi | 39.6497 1.235006 37.30154 42.14568 ------------------------------------------------------------------------------ mu2 = safety mu3 = education mu4 = recreation mu5 = social mu6 = urbanplanning

base outcome = governing

. ddirifit, at(minorityleft 0 noleft 0 ) ------------------------------------------------------------------------------- discrete | Min --> Max +-SD/2 +-1/2 change | coef. se coef. se coef. se --------------+---------------------------------------------------------------- governing | minorityleft |-.0085 .0064 noleft | .0086 .0069 houseval | .0903 .0227 .0116 .0023 .0292 .0059 popdens | -.048 .0112 -.0089 .0027 -.0095 .0029 --------------+---------------------------------------------------------------- safety | minorityleft | .006 .0084 noleft | .0234 .0089 houseval | .0867 .0246 .013 .003 .0328 .0075 popdens |-.0828 .0146 -.0151 .0034 -.0162 .0036 --------------+---------------------------------------------------------------- education | minorityleft |-.0139 .0071 noleft |-.0286 .0073 houseval |-.1006 .0169 -.0156 .0033 -.0394 .0084 popdens |-.0068 .0166 2.1e-06 .0028 2.3e-06 .003 --------------+---------------------------------------------------------------- recreation | minorityleft | .0068 .0071 noleft | .0066 .0074 houseval | .0236 .0197 .0046 .0026 .0117 .0065 popdens |-.0254 .0137 -.0035 .0026 -.0037 .0028 --------------+---------------------------------------------------------------- social | minorityleft |-.0056 .0094 noleft |-.0241 .0098 houseval |-.1703 .0217 -.0255 .004 -.0642 .0101 popdens | .1297 .0237 .0203 .0033 .0218 .0035 --------------+---------------------------------------------------------------- urbanplann~g | minorityleft | .0152 .0092 noleft | .0142 .0097 houseval | .0702 .0254 .0119 .0033 .0299 .0082 popdens | .0332 .0209 .0072 .0032 .0077 .0034 -------------------------------------------------------------------------------

-------------------------------- Marginal | MFX at x Effects | coef. se --------------+----------------- governing | houseval | .0292 .0059 popdens |-.0095 .0029 --------------+----------------- safety | houseval | .0329 .0075 popdens |-.0162 .0036 --------------+----------------- education | houseval |-.0395 .0084 popdens | 2.0e-06 .003 --------------+----------------- recreation | houseval | .0117 .0065 popdens |-.0037 .0028 --------------+----------------- social | houseval |-.0644 .0101 popdens | .0218 .0035 --------------+----------------- urbanplann~g | houseval | .0301 .0083 popdens | .0077 .0034 --------------------------------

E(governing|x) = .0994 E(safety|x) = .1759 E(education|x) = .1304 E(recreation|x) = .1205 E(social|x) = .25 E(urbanplann~g|x) = .2238

x mean sd min max minorityleft 0 .4337 .4962 0 1 noleft 0 .3878 .4879 0 1 houseval 1.483 1.483 .3902 .72 3.63 popdens .7839 .7839 .9408 .025 5.711

[do-file]