Dear Stata List Members
I have a panel data on agents' trade record , with the value of trade as
main interested variables, which is denoted as Y.
Y varies with the following dimensions :
1. i: agent id (over 10,000)
2. t : year (10 years)
3. j : product (over 1000 categories)
4. k: means of transport (e.g. by air or by train , 10 categories)
5. l : method of payment ( e.g. cash or check , 4 categories)
6. m: market ( over 100)
Let X denote the characteristics of the markets , such as population ,
income .
I want to estimate a model as following
Yitjklm=Xm+ai+bt+cj+dk+el+Vitjklm
That is to say , how the value of trade depends on the market
characteristics , controlling all the other dummies.
The main problem is the massive number of categories of products i.e.
cj, and ids i.e. ai.
So my first attempt is to
iis agent id , then demean Y and X by product , finally xtreg the
demeaned Y on demeaned X , with fe
But when I try this on a small sample , comparing this method with those
from xtreg,fe with product dummies controlled, I find the results are
very different.
Could help me with this : (a) what is the correct way to implement this
estimation (b) why the demeaned method has a problem ?
Thanks very much for your help in advance
Zhihong
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ashim Kapoor
Sent: 06 January 2009 13:06
To: [email protected]
Subject: Re: st: data management - changing every 1st encountered of a
str data content of a var
This dataset has brought a question to my mind.
I want to do : -
egen j=group(var) BUT I do not want the group to SORT var, I only want
consecutive groups to have the same value for j ( this is what is
needed in the original question )
for example I would want the FIRST paired occurance of diathermy[2] to
be ONE group and the 2nd paired occurance of diathermy[2] to be
another group.
How would I do that ?
Here is a long way to do it!
egen j1=group(var1)
gen j2=_n
gen j3=j2
replace j3=j3[_n-1] if j1==j1[_n-1]
And then I would have the same group number j3 for same consecutive
items in var1. but I guess someone would have a variant of -egen
group- which DOES NOT do sorting?
Any comments ?
Thank you,
Ashim.
On Tue, Jan 6, 2009 at 6:20 PM, Ashim Kapoor <[email protected]>
wrote:
> I would do: -
>
> Suppose your variable is called var
>
>
> gen j=var
> replace j="diathermy[1]" if j[_n+1]=="diathermy[2]" &
j=="diathermy[2]"
>
> Then j would have what you want.
>
> I think this should do it.
>
> Thank you,
> Ashim.
>
> ue, Jan 6, 2009 at 1:22 PM, b. water <[email protected]> wrote:
>> dear all,
>>
>> stata 8.2 xp pro,
>>
>> i have a var like this:
>>
>> monopolar
>> bipolar
>> bipolar
>> bipolar
>> monopolar
>> nodiathrm
>> diathermy[2]
>> diathermy[2]
>> bipolar
>> monopolar
>> diathermy[2]
>> diathermy[2]
>> .
>> . <- denotes missing
>> .
>> monopolar
>> diathermy[2]
>> diathermy[2]
>> .
>> .
>>
>> what i want to achieve is for every first encountered diathermy[2] to
be changed to diathermy[1], while leaving the second occurence as
diathermy[2]. is this possible in stata? if it can be done, would
appreciate advice/help on how to achieve it.
>>
>> thank you,
>> bw
>> _________________________________________________________________
>> It's the same Hotmail(R). If by "same" you mean up to 70% faster.
>>
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broa
d1_122008
>> *
>> * 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/
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
*
* 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/