Bookmark and Share

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]

Re: st: granger causality test


From   Anderson Macedo de Jesus <[email protected]>
To   [email protected]
Subject   Re: st: granger causality test
Date   Mon, 24 Mar 2014 14:21:47 +0100

Dear Nick,

Thanks for your help.
You are definitely right when you told me that -ca- was not a suitable panelvar.
I have chosen country that was a string variable, but i run -encode- and this was not a problem anymore. Therefore, I used -country1- as my panelvar and -year- as my timevar. (Thanks for your hint on the number I should use in delta. As I understood, I need to use delta 5 because my timevar varies every 5 years) 
My result was great, since my previous one was telling me that panel variable was “weakly balanced”.


. tsset country1 year, delta(5)
       panel variable:  country1 (strongly balanced)
        time variable:  year, 1990 to 2010
                delta:  5 units


Now that I have set the data, I tried to run the "vector autoregressive models” and the result was “repeated time values in sample”.
a) As dependent variable I chose two (pfi_fh and ca)
b) Time settings: I used the variable “year” and panel id variable ‘country1”
	b.1) The time unit chosen was “use format of time variable”
c) And I included 2 lags

My results were:
a) 2 lags: “repeated time values in sample”
b) 5 lags: “no observations”

Therefore, my question is: Where am I failing?
Thanks a lot
Anderson


On Mar 24, 2014, at 1:03 PM, Nick Cox <[email protected]> wrote:

> Right at the top of the help for -tsset- you get an explanation:
> 
> Declare data to be time series
> 
>        tsset timevar [, options]
> 
>        tsset panelvar timevar [, options]
> 
> There are two valid forms. You have panel or longitudinal data, so
> only the second form is valid for you.
> 
> In your case, setting a timevar alone doesn't work, because you
> haven't specified a panelvar. Conversely, setting a panelvar alone
> would not work because you haven't specified a timevar.
> 
> In your case, -ca- is evidently not even a suitable panelvar.
> 
> You need something like
> 
> tsset country year
> 
> and indeed you need something like
> 
> tsset country year, delta(5)
> 
> where -delta(5)- is documented under options.
> 
> Note that -country- or your equivalent must be a numeric variable: if
> you are holding country names in a string variable, apply -encode-.
> 
> Spelling is "Granger", not "granger" or "Gangrer".
> 
> Nick
> [email protected]
> 
> 
> On 24 March 2014 06:47, Anderson Macedo de Jesus
> 
>> I am trying to use the granger causality test in stata 13.1, but with no
>> success.
>> First of all, before the test I need to set the variables, right? I have a
>> data set with 135 countries, 26 variables within 5 years (1990, 1995, 2000,
>> 2005, 2010).
>> For the Gangrer causality test I am using the Vector autoregression -var-.
>> Before that I know I need to set the data for the causality test but I get
>> the following messages from stata:
>> 
>> -tsset- year (command+variable)
>> r(451)
>> repeated time values in sample
>> 
>> or
>> 
>> -tsset- ca (command+variable)
>> r(451)
>> time variable must contain only integer values.
>> 
>> I don't know what is going on. Someone could give me a clue?
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index