RATS 10.1
RATS 10.1

Examples /

CHANKAROLYI.RPF

Home Page

← Previous Next →

CHANKAROLYI.RPF demonstrates GMM on a system of non-linear equations. It is based upon the model for interest rates from Chan, Karolyi, Longstaff and Sanders(1992). The model generates a conditional mean and a conditional variance:

\begin{equation} r_{t + 1} - r_t = \alpha + \beta r_t + \varepsilon _{t + 1} \end{equation}

\begin{equation} E_t \left[ {\varepsilon _{t + 1} } \right] = 0,E_t \left[ {\varepsilon _{t + 1}^2 } \right] = \sigma ^2 r_t^{2\gamma } \end{equation}
 

Note how the VARIANCE formula uses the square of the EPS formula:

 

nonlin alpha beta gamma sigmasq

frml eps      = y1{-1}-(1+beta)*y1-alpha

frml variance = eps(t)^2-sigmasq*y1^(2*gamma)
 

Different information sets (instruments) and different ways of computing the weight matrix will give different estimates. The example does four NLSYSTEMS, two of which show here are the just-identified and overidentified (2 conditions x 3 instruments vs 4 free parameters) estimated with the default NOZUDEP handling:
 

instruments constant y1
nlsystem(instruments) / eps variance
instruments constant y1{0 1}

nlsystem(instruments) / eps variance

 

Full Program
 

calendar(m) 1946:1

open data tbills.xls

data(format=xls,org=columns) 1946:01 2011:01 tb3ms

*

set y1 = tb3ms

nonlin alpha beta gamma sigmasq

frml eps      = y1{-1}-(1+beta)*y1-alpha

frml variance = eps(t)^2-sigmasq*y1^(2*gamma)

*

* Guess values from a linear regression

*

linreg y1

# constant y1{1}

compute alpha=%beta(1),beta=%beta(2)-1

compute sigmasq=%sigmasq,gamma=0.0

*

* Just identified model

*

instruments constant y1

nlsystem(instruments) / eps variance

*

* Overidentified model

*

* With nozudep

*

instruments constant y1{0 1}

nlsystem(instruments) / eps variance

*

* Same thing, but correcting the covariance matrix and J-statistic

*

instruments constant y1{0 1}

nlsystem(instruments,robusterrors) / eps variance

*

* With ZUDEP

*

instruments constant y1{0 1}

nlsystem(instruments,zudep) / eps variance

 

Output

 

Linear Regression - Estimation by Least Squares

Dependent Variable Y1

Monthly Data From 1946:02 To 2011:01

Usable Observations                       780

Degrees of Freedom                        778

Centered R^2                        0.9809291

R-Bar^2                             0.9809046

Uncentered R^2                      0.9940858

Mean of Dependent Variable       4.4570256410

Std Error of Dependent Variable  2.9901748609

Standard Error of Estimate       0.4132011179

Sum of Squared Residuals         132.83195749

Regression F(1,778)                40017.0673

Significance Level of F             0.0000000

Log Likelihood                      -416.3905

Durbin-Watson Statistic                1.3212

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                     0.0418011052 0.0265713863      1.57316  0.11608778

2.  Y1{1}                        0.9905557662 0.0049517225    200.04266  0.00000000

 

 

GMM-Factored Weight Matrix

Convergence in    17 Iterations. Final criterion was  0.0000000 <=  0.0000100

 

Monthly Data From 1946:01 To 2011:01

Usable Observations                          780

Skipped/Missing (from 781)                     1

Function Value                    4.70586311e-15

 

    Variable                          Coeff       Std Error      T-Stat      Signif

***************************************************************************************

1.  ALPHA                            0.041801105  0.026537299      1.57518  0.11521418

2.  BETA                            -0.009444234  0.004945370     -1.90971  0.05617027

3.  GAMMA                            1.595429690  0.378547682      4.21461  0.00002502

4.  SIGMASQ                          0.000477412  0.000879624      0.54275  0.58730500

 

 

GMM-Factored Weight Matrix

Convergence in     9 Iterations. Final criterion was  0.0000048 <=  0.0000100

 

Monthly Data From 1946:01 To 2011:01

Usable Observations                          779

Skipped/Missing (from 781)                     2

Function Value                       96.31177513

J-Specification(2)                       96.3118

Significance Level of J                0.0000000

 

    Variable                          Coeff       Std Error      T-Stat      Signif

***************************************************************************************

1.  ALPHA                            0.042300267  0.026607082      1.58981  0.11187711

2.  BETA                            -0.010951691  0.004909161     -2.23087  0.02568986

3.  GAMMA                            1.358737262  0.275738621      4.92763  0.00000083

4.  SIGMASQ                          0.001482979  0.001946244      0.76197  0.44607807

 

 

GMM-Factored Weight Matrix

Convergence in     7 Iterations. Final criterion was  0.0000079 <=  0.0000100

 

With Heteroscedasticity/Misspecification Adjusted Standard Errors

Monthly Data From 1946:01 To 2011:01

Usable Observations                          779

Skipped/Missing (from 781)                     2

Function Value                       96.31179931

J-Specification(2)                       96.3118

Significance Level of J                0.0000000

 

    Variable                          Coeff       Std Error      T-Stat      Signif

***************************************************************************************

1.  ALPHA                            0.042300211  0.000031814   1329.62802  0.00000000

2.  BETA                            -0.010951687  0.000007532  -1454.06978  0.00000000

3.  GAMMA                            1.358733495  0.001222156   1111.75164  0.00000000

4.  SIGMASQ                          0.001483006  0.000008438    175.74638  0.00000000

 

 

GMM-Continuously Updated Weight Matrix

Convergence in     7 Iterations. Final criterion was  0.0000048 <=  0.0000100

 

Monthly Data From 1946:01 To 2011:01

Usable Observations                          779

Skipped/Missing (from 781)                     2

Function Value                       10.77230305

J-Specification(2)                       10.7723

Significance Level of J                0.0045796

 

    Variable                          Coeff       Std Error      T-Stat      Signif

***************************************************************************************

1.  ALPHA                            0.059769659  0.030763748      1.94286  0.05203306

2.  BETA                            -0.013557828  0.008823849     -1.53650  0.12441624

3.  GAMMA                            1.309121407  0.194980317      6.71412  0.00000000

4.  SIGMASQ                          0.001206328  0.000876889      1.37569  0.16891741

 

 


Copyright © 2025 Thomas A. Doan