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

st: Re: Stata Time Series testparm question

From   Michael Hanson <>
Subject   st: Re: Stata Time Series testparm question
Date   Wed, 18 Jul 2007 10:01:10 -0400

On Jul 17, 2007, at 5:22 PM, Laura Clavijo Muñoz wrote:

Dear Mike, I was reading your thread which I post below:

“Perhaps you have a "Granger causality" test in mind? This can be accomplished in Stata after estimating a -var-, but it really is just a test of joint significance of the lags of x. That is, for example,

var y x, lags(1/3) small dfk


reg y L(1/3).y L(1/3).x
testparm L(1/3).x

should give you exactly the same answer.”
In trying to do the same, Stata doesn´t let me use time-series operators with testparm. Because I´m using a loop to choose the optimal lags, I need to be able to use this format L(1/x). Any idea what is happening?

Thank you very much.
The convention on Statalist is to respond to messages posted there rather than to individuals. That way, many people potentially can help you, and any help you receive becomes a public good. Hence, I have responded to Statalist in my reply. If you have not yet joined Statalist (i.e., you quoted my message from a web-based search), I encourage you to do so. See < statalist.html> for information about subscribing.

With regard to your question, please consider the following set of commands that generalize my quoted sample code. You should confirm that these commands work for you as well (i.e., cut and paste them into a new .do file, and run that in your copy of Stata).

// Begin example code

webuse lutkepohl
gen y = lincome
gen x = lconsumption

set more off
forval q = 1/4 {

var y x, lags(1/`q') small dfk

reg y L(1/`q').y L(1/`q').x
testparm L(1/`q').x


// End example code

One possibility is that your reference to the looping variable (which you refer to as "x" above) is not understood by Stata. Sometimes a right tick (') inadvertently is substituted for a left tick (`) -- a good text editor with syntax highlighting is helpful in such cases. Otherwise, the admonition on the Statalist FAQ would seem to apply here: "Messages to the effect that some command did not work for you are often impossible to answer without seeing precisely what you typed and what Stata returned in response."

Another possibility is that you are using a different (possibly older) version of Stata. These commands work with version 9.2 (which I just confirmed); the latest version of Stata is 10. You may want to see if you get similar versions and dates from the following three commands as I do; if one or more is different, that might point towards the source of your difficulties. (And note also from the Statalist FAQ: "Please specify if you are using an earlier version; otherwise, the answer to your question is likely to refer to commands or features unavailable to you.")

. which testparm
*! version 3.1.3 27jul2004

. version
version 9.2

. update query

Stata executable
folder: /Applications/Stata/
name of file: StataSE
currently installed: 12 Jan 2007
latest available: 12 Jan 2007

Ado-file updates
folder: /Applications/Stata/ado/updates/
names of files: (various)
currently installed: 22 May 2007
latest available: 22 May 2007

Do nothing; all files up to date.

Hope that helps.

-- Mike

* For searches and help try:

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