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

Re: AW: st: question

From (Vince Wiggins, StataCorp)
Subject   Re: AW: st: question
Date   Tue, 03 Nov 2009 11:28:31 -0600

Tunga Kantarci <> asks why, after estimation with
-regress-, -nlcom- will not work when he references values such as e(rss) and
r(df_r) in his expression.

> I wish to calculate a figure where I call coefficient estimates and
> residuals sum of squares and degrees of freedom. All these
> quantities are from the stata estimation output. When I run the
> relevant command
>     . nlcom exp(_b[_cons]+_b[income]*15.3)*exp(e(rss)/e(df_r)/2)
> I get the error "could not calculate numerical derivative". This is
> perhaps because e(rss) and e(df_r) are not estimates. (As Maarten
> pointed out yesterday actually)

The error message could be improved (and we will look into that), but the
problem is that Tunga's expression contains the estimated results e(rss) and
r(df_r), but -regress- does not estimate the standard error of those estimates
nor their covariance with _b[_cons] and _b[income].  Without those standard
errors and covariances, -nlcom- cannot estimate a standard error for Tunga's
expression.  We could argue whether e(df_r) is an estimate, but not e(rss).
-nlcom- treats all e-class results as estimates.

If Tunga does not need an estimate of the standard error then he can heed 
Martin Weiss' <> advice and type,

>     . di exp(_b[_cons]+_b[income]*15.3)*exp(e(rss)/e(df_r)/2)

If Tunga wants standard errors and wants to treat e(df_r) as fixed (OK by me)
and also treat e(rss) as fixed (that gives me pause), then he can macro-expand
their values so that they become constants in his expression.

      . nlcom exp(_b[_cons]+_b[income]*15.3)*exp(`e(rss)'/`e(df_r)'/2)

-nlcom- now sees these two values as constants and not as something from e().

-- Vince

*   For searches and help try:

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