# Re: st: question about rolling regression and nlcom

 From Kit Baum <[email protected]> To "Nadine Kalwey" <[email protected]> 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.

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

. local junk `r(b)'

. di "`junk'"
matrix

```
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'"
.0000498711997947

etc.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html

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[l.lr])
return local b =`r(b)'
return local v =`r(V)'
end

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.lr l.mmr  if country ==4

occurred when rolling executed roll, r(111)".

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

Best regards

**********************************
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
email: [email protected]

```
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```