---Giovanni Vecchi wrote:
> The dependent variables are relative frequencies: pi_1, pi_2, ..., pi_7,
> which sum up to one.
>
> I need to estimate the *same* model for each pi_i (i = 1,...7). The model is
> linear and simple enough:
>
> pi_i = alpha_i + beta1_i * X1 + ... + betak_i * Xk (i=1,...,7)
>
> The difficulty is that I want to obtain predicted values that add up to one.
Giovanni:
This looks like the kind of problem for which -dirifit- was made.
Unfortunately the version on ssc contains a bug and ssc will not be
updated till june 9th (presumably Kit is enjoying a well deserved
vacation), so I have put a corrected version on my website. To get it,
type: - net from http://home.fsw.vu.nl/m.buis/stata - and than - net
install dirifit -.
-dirifit- doesn't have a predict command, but it is quite easy to get
the predicted proportions you want, see the example.
*-------------------- begin example --------------------------
use http://home.fsw.vu.nl/m.buis/stata/municipality.dta, clear
dirifit safety social infrastructure, muvar(density poverty)
tempvar xb2 xb3
gen `xb2' = [mu2]_cons + [mu2]density*density + [mu2]poverty*poverty
gen `xb3' = [mu3]_cons + [mu3]density*density + [mu3]poverty*poverty
gen p1 = 1/(1 + exp(`xb2') + exp(`xb3'))
gen p2 = exp(`xb2')/(1 + exp(`xb2') + exp(`xb3'))
gen p3 = exp(`xb3')/(1 + exp(`xb2') + exp(`xb3'))
*-------------------- end example ---------------------------
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/