[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: question about rolling regression and nlcom

From   Kit Baum <>
To   "Nadine Kalwey" <>
Subject   Re: st: question about rolling regression and nlcom
Date   Sat, 11 Oct 2008 11:00:10 -0400

< >
You can't return a matrix as a local.

                  r(b) :  1 x 1
                  r(V) :  1 x 1

. local junk `r(b)'

. di "`junk'"

You also must move r(b), r(V) to new matrices before you can refer to their elements (as with e(b), E(V)). You could extract the [1,1] element of r(b) and the [1,1] element of r(V) and save them as locals and return them.

. mat b = r(b)

. local elt = b[1,1]

. di "`elt'"


Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

On Oct 11, 2008, at 09:51 , Nadine Kalwey wrote:

Dear Kit,

I have some problems obtaining standard errors from nonlinear combinations
of estimators after running a rolling regression. In July 2007, in the
context of "rolling" and "lincom" you suggested to someone to write a
'wrapper' program. I tried to do the same for 'nlcom':

program roll, rclass
version 9.2
syntax varlist(ts) if
regress `varlist' `if'
nlcom -(_b[l.mmr]/_b[])
return local b =`r(b)'
return local v =`r(V)'

and then try to execute the program with:
use emerging, clear

rolling b=r(b) v=r(V), window(60) saving(nadine, replace): roll lrd
l(1/2).lrd l(0/3).mmrd l.mmr  if country ==4

Unfortunately, I receive the error message "matrix not found, an error
occurred when rolling executed roll, r(111)".

It would be great if you could help me with that!

Thanks for your time,

Best regards

Nadine Kalwey
University of Cologne
Department of Economic Policy

Wiso-Hochhaus, Room 731a
Albertus-Magnus Platz
D-50923 Köln

PHONE: +49 (0)221 470-2378
FAX: +49 (0)221 470-5188

*   For searches and help try:

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