Re: st: AW: AW: conditional logit problem

 From Annalisa Marini To statalist@hsphsun2.harvard.edu Subject Re: st: AW: AW: conditional logit problem Date Fri, 27 Mar 2009 10:35:05 +0000

```Dear Isabelle,

```
If I am not wrong you have a mixed logit. I am also working on a mixed logit by using stata and I think one solution (I am also starting to use) is that of programming yourself the ML rather than using stata commands.
```
```
If anyone has other (better and wuicker) suggestions are more than welcome since I have been spending a lot of time on these nested logit commands!
```
Many thanks.

Annalisa

--On 27 March 2009 11:28 +0100 Isabelle.Roux@ehess.fr wrote:

```
```Thank you very much Martin, for your very useful help.

-First of all I just had a look at "va" and you were right: there is a pb
with it because sometimes I have different va for a same firm. So I have
to check how I obtained it and to improve that.

-Secondly I sought in the STATA8 manual, which explains that individual
variables (like va, or sex if the observations were human), have to be
multiplied by dummy variables for the choices:

it is the beginning of the example's dataset in the manual:
id     car        choice     dealer      sex     income
1      American     0           18       male     46
1      Japan        0            8       male     46
1      Europe       1           5        male      46

2      American     0           17       male     26
2      Japan        1           6        male     26
2      Europe       0           2        male      26

"car": nationality of the car's manufacturer
"dealer": number of dealerships of each nationality in the consumer's city

***
gen japan=(car==2)
gen europe=(car==3)
gen sexeur=sex*japan
gen sexjap=sex*jap
gen incjap=income*japan
gen inceur=income*europe
***

and to run :

***
clogit choice japan europe sexjap sexeur incjap inceur delaer, grou(id)
***

But I am a bit afraid of doing that, because in all I have 66 countries,
and  7 firm's variables, so, even if I keep only 2 or 3 firm's variables,
there will be a lot of dummies in my results.

```
```
<>

One thing for Isabelle to consider: When I replace just one value of va
with
"0" during the -input-, the message does not appear for "va", but for
"ln(va)". So Isabelle might want to check her data set and maybe report
-inspect va- to the list...

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Martin Weiss
Gesendet: Freitag, 27. März 2009 10:10
An: statalist@hsphsun2.harvard.edu
Betreff: st: AW: conditional logit problem

<>

-clogit-: "
note: ... omitted because of no within-group variance." It would be weird
for the log transform to change the effect of va as the transform itself
cannot generate any variance within the groups.

The problem is mentioned in [R]clogit, p. 284.

*************
clear*
inp double siren   va  str10 country   tax    double  GDP   choice
17251067     94997     Spain        .35     777000000000       1
17251067     94997     Brazil       .34     486000000000      0
17251067     94997     Italy        .38    1330000000000     0
17251068   28142     Brazil       .34     486000000000       1
17251068   28142    Spain       .35     777000000000       0
17251068   28142    Italy        .38    133000000000       0
17251069     75758    Italy        .38    13300000000       1
17251069     75758    Spain        .35    777000000000      0
17251069     75758     Brazil        .34    486000000000      0
end
l, noo sepby(va)
g lntax=log(tax)
g lnGDP=log(GDP)
encode country, gen(newcountry)
drop country
rename newcountry country
* w/o va
clogit choice country lntax lnGDP , group(siren) iter(10) nolog
*with va
clogit choice country lntax lnGDP va, group(siren) iter(10) nolog
g lnva=log(va)
*with ln(va)
clogit choice country lntax lnGDP lnva, group(siren) iter(10) nolog
*************

Might -asclogit- be a way out for Isabelle?

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von
Isabelle.Roux@ehess.fr
Gesendet: Freitag, 27. März 2009 09:42
An: statalist@hsphsun2.harvard.edu
Betreff: st: conditional logit problem

Dear statalisters,

I have  a dataset with firms, to which is attributed a number called
"siren", and characteristics of thses firms (exportations, size, value
added...). I have too the country in which they decide to invest, and
characteristics of this country (GDP, population, tax rate, labor
costs...)

So my database looks like this (it is an example with 3 firms which
choose one unique country):
siren	   va	   country     tax	    GDP          choice
17251067	   94997	   Spain	      .35	    7.77e+11
1
17251067	   94997	   Brazil	      .34	    4.86e+11
0
17251067	   94997	   Italy        .38    1.33e+12      0

3.025e+08   28142	   Brazil	      .34	    4.86e+11       1
3.025e+08   28142    Spain	      .35	    7.77e+11       0
3.025e+08   28142    Italy        .38    1.33e+12       0

3.026e+08	   75758    Italy        .38    1.33e+12       1
3.026e+08	   75758    Spain	       .35    7.77e+11       0
3.026e+08	   75758 	   Brazil	       .34    4.86e+11
0

When I run a conditional logit with only countries'characteristics as
regressors (***clogit choice country lntax lnGDP, group(siren)**, where
lntax and lnGDP are the log of tax and GDP), it is OK.
But what I don't understand is this point:

-When I add value added as a control variable (***clogit choice country
lntax lnGDP va, group(siren)***), it works, even if the coefficient for
va is strange.
-When I add the log of value added as a control variable ((***clogit
choice country lntax lnGDP lnva, group(siren)***), STATA refuses to
provide results and write:"outcome does not varies in any group".

So I wonder why it is ok in a case and not in the other else which is
very similar, and I don't know what kind of logit to run which allows me
to mix the two types of variables.

Thank you very much for help,

Isabelle

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```
```

----------------------
Annalisa Marini
Department of Economics
University of Bristol
Bristol BS8 1TN
United Kingdom

e-mail: annalisa.marini@bristol.ac.uk

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```