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

st: save coeff estimators of Arima model with foreach

From   "Hua Pan" <>
Subject   st: save coeff estimators of Arima model with foreach
Date   Wed, 11 Mar 2009 23:42:22 +0100

Hi statalisters,

I’m a beginner for Stata, and I have just a problem with it. I want to do a cross-sectional time series analysis with command “arima” and imput the estimator of “AR L1. Coefficient” of every panel data into the datasheet with the help of “foreach” and “levelsof”. 

My Data looks like this:
gvkey      qtl         eps
1	2003q1        ….
1       2003q2        ….
1       2003q3        ….
...       …….
2       2003q1
2       2003q2
2       2003q3
gvkey:  identify-Nr. of firms (panel variable, long)
qtl:     quarter (time variable, float)
eps:    earnings per share (dependent variable, float)

So I’ve tried:

- generate AR =.
tsset gvkey qtl
levelsof gvkey, local(levels)
foreach l of local levels {
arima eps if gvkey == `l', arima(1,0,0) sarima(0,1,0,4) 
replace AR = _b[] if gvkey == `l'

But it doesn’t seem to work. Time series analysis (Arima) hasn’t been done and all of AR are still missing value. 
I’m sure this is correct:
-	arima eps, arima(1,0,0) sarima(0,1,0,4)
-	replace AR = _b[]
I’ve tried it for data with one Observation (one gvkey)

I guess, there may be something wrong with foreach or levelsof, but I can’t find the error. Can anyone here give me any advice? 
Any help would be greatly appreciated. Thanks in advance for your time. 
I’m using Stata version 10.1 SE (Windows).

Best Regards

Hua Pan
University of Cologne

Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index