Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Use of statsby in var command


From   "Brian P. Poi" <[email protected]>
To   [email protected]
Subject   Re: st: Use of statsby in var command
Date   Thu, 18 Sep 2008 08:28:37 -0500 (CDT)

On Thu, 18 Sep 2008, J�rn van Halteren wrote:

The STATA manual says that vector autoregression (var) works with the
command "statsby". However, I always get the error r(451) "repeated time
values in sample an error occurred when statsby executed var". If I run the
command with simple by it works, but I need the stats.

Can someone help me?

To use -var- and other time-series commands with panel data, you need to use the basepop() option of -statsby-:

. webuse grunfeld, clear
. statsby _b, by(company) basepop(company == 1): var i m, lags(1/2)


By default, -statsby- first tries to fit the model to the entire dataset to check command syntax. Commands like -var- for time-series data will complain when used with panel data. The basepop(company == 1) option tells -statsby- to check syntax by using only the first panel's observations, which constitute a time series that -var- can handle.

-- Brian Poi
-- [email protected]



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