Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Difference Model


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Difference Model
Date   Wed, 2 Nov 2011 00:09:30 +0000

Except that I guess this only makes sense within -firmid-. 

So, you could do this: 

... if d.h1 

or 

bysort firmid (year) : gen isdifferent = h1 != h1[_n-1]

... if isdifferent 

Whether the first observation in each panel is regarded as different from the previous is also a small issue. 

Nick 
n.j.cox@durham.ac.uk 


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 01 November 2011 23:48
To: 'statalist@hsphsun2.harvard.edu'
Subject: st: RE: Difference Model

I don't see how you think we can help. There is no context here and no explanation of why any model might make sense for whatever is your research problem. 

If you are saying that you want to select times at which -h1- differs from its previous value then 

... if h1 != h1[_n-1] 

selects such observations. 

Nick 
n.j.cox@durham.ac.uk 

vikramfinavker

I have a data like this...

year  firmid h1 x1 x2    x3 x4  x5
1998     1      0  1    10 
1999     1      0  1    11
2000     1      0  1    12
2001     1      0  1    12
2002     1      1  1    13
2003     1      1  1    18
2004     1      1  1    17
2005     1      1  1    16
2006     1      1  1    15
2007     1      1  1    14
1998     2      0  1    10 
1999     2      0  1    11
2000     2      0  1    12
2001     2      0  1    12
2002     2      0  1    13
2003     2      0  1    18
2004     2      1  1    17
2005     2      1  1    16
2006     2      1  1    15
2007     2      1  1    14

Now i want to run regression using following way;
reg x3 h1 x2

but i want to use only those observations where variables "h1" changes to
either "1" or "0". can i use first difference model.? Does it help me in
this case? can i run regression like:

reg x3 d.h1 x2 

or do i have to run it like this

reg d.x3 d.h1 d.x2

Please let me know if you can help.


*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index