Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: RE: RE: Foreach Command in Panel Data
From
"Degas Wright" <[email protected]>
To
<[email protected]>
Subject
st: RE: RE: RE: Foreach Command in Panel Data
Date
Tue, 28 Sep 2010 15:26:37 -0400
Nick,
So I am attempting to isolate each stock to determine the impact of
various fundamental variables on excess returns by using the var time
series command. When I have one stock in the dataset and use the tsset
date command, then use the var command, it works fine. I am attempting
to write a program that select one ticker at a time to run the time
series from my panel data.
Your point on isolating a single stock is exactly our objective since
cross sectional approach contains a significant amount of noise in the
forecast.
Thanks,
Degas A. Wright, CFA
Chief Investment Officer
Decatur Capital Management, Inc.
250 East Ponce De Leon Avenue, Suite 325
Decatur, Georgia 30030
Voice: 404.270.9838
Fax:404.270.9840
Website: www.decaturcapital.com
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Tuesday, September 28, 2010 1:35 PM
To: '[email protected]'
Subject: st: RE: RE: Foreach Command in Panel Data
Actually, it's interesting that this gets past
foreach xticker in dcm.dfa1.dat {
but the reason is that you never refer to `xticker' within the loop.
Thus another problem with this loop is that it would never repeat
anything.
Nick
[email protected]
Nick Cox
If it's panel data, the appropriate -tsset- specifies both identifier
and time variable. Without a panel identifier, the report you get is, if
you think more about it, what you should expect.
The deeper issue of whether it makes scientific sense to forecast stocks
in isolation is not one I can usefully comment on.
Degas Wright
I have panel data of 2000 tickers, excess returns (r) and various
fundamental variables such as earnings yield (ep), momentum(mom),
earnings revision (rev), over a 120 month period. I am trying to use
the var command to develop a time series forecast for each individual
stock's excess return. I realize that I have to analyze one ticker
(stock) at a time with the time series approach and assumed that using
the foreach command would work.
tsset
panel variable: xticker (unbalanced)
time variable: date, 2000m2 to 2009m6, but with gaps
delta: 1 month
foreach xticker in dcm.dfa1.dat{
2. tsset date
3. var r ep mom rev
4. }
repeated time values in sample
r(451);
However, I get the repeated time values in sample r(451).
*
* 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/