Statalist


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

Re: st: rolling regression / xtgls


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: rolling regression / xtgls
Date   Fri, 10 Aug 2007 00:30:45 +0100

Sergio wrote:

> I am estimating a standard linear model for a panel of the type:
> y(i,t) = b0 + b1x(i,t) + b2z(i,t) +...+ u(i,t)
> I want to see how does the coefficient b1 change over the whole range of another
> variable k not included in the model.
>
> Can I use something similar to a rolling regression even if my variable k is not
> time?

Yes, but you need to know how to access the coefficients from your
last model. Here's an example of how to do what you want, which
includes Baum/Schaffer/Stillman's -ivreg2- routine, downloadable from
SSC:

. webuse grunfeld

. tsset company year

. qui ivreg2 invest mvalue kstock time, bw(2) robust small

. g asif = _b[_cons]+_b[kstock]*kstock

. tab year, sum(asif)

            |           Summary of asif
       year |        Mean   Std. Dev.       Freq.
------------+------------------------------------
       1935 |   -35.35167   15.416683          10
       1936 |  -32.719774   16.340199          10
       1937 |  -26.372769   17.793016          10
       1938 |  -18.287618   23.054527          10
       1939 |  -14.717041   25.525124          10
       1940 |  -13.990398   25.112402          10
       1941 |  -10.003932   26.990851          10
       1942 |  -4.0298757   30.221506          10
       1943 |  -1.8618989   30.831515          10
       1944 |  -2.2220107   32.547093          10
       1945 |  -.61733065   34.569687          10
       1946 |   2.5791901   38.816106          10
       1947 |   19.008229   52.989957          10
       1948 |   28.102447   61.844248          10
       1949 |   35.926864   67.380231          10
       1950 |   40.387872   72.122879          10
       1951 |   45.280042    78.06703          10
       1952 |   58.360062   89.718207          10
       1953 |   75.884266   110.04284          10
       1954 |    93.62981   136.78561          10
------------+------------------------------------
      Total |   11.949223   66.644863         200

-tab-, and other programs using it as its basis, can be used in other
ways to get what you want, but that's left for you to explore.

> I have another question as well,
> I am also estimating a simple linear model for a panel of countries using GLS to
> take into account autoregression; but as I need to use country dummies I
> proceed as follows
> xi: xtgls y x1... xn i.country, [options]
>
> can anybody tell me if this way of proceeding is correct? Because I am basically
> trying to use fixed effects (my country dummies) with a procedure that
> estimates random effecta models only (the xtgls command)

I'd start with the FE model using -xtreg, fe- and assessing the
correlation between the RHS variables and the 'idiosyncratic' error
term u_i. If corr(u_i, Xb) = 0, you can proceed to an RE model via
-xtreg, re- or -xtgls-. If it's not 0, estimates and standard errors
obtained from models assuming REs will not be reliable.

-- 
Clive Nicholas

[Please DO NOT mail me personally here, but at
<[email protected]>. Thanks!]

"Courage is going from failure to failure without losing enthusiasm."
-- Winston Churchill
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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