# Re: st: missing standard error with nonlinear least squares

 From n j cox To statalist@hsphsun2.harvard.edu Subject Re: st: missing standard error with nonlinear least squares Date Thu, 30 Mar 2006 16:22:37 +0100

The principle is easy to illustrate at a much lower level, e.g.

. set obs 1
obs was 0, now 1

. gen y = 42

. su y

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
y | 1 42 . 42 42

Here, Stata following statistical logic believes that it can
calculate a mean but not a standard deviation. Stata won't
provide a regression for one just one observation, but with
a small tweak it's the same story:

. expand 2
(1 observation created)

. reg y

Source | SS df MS Number of obs = 2
-------------+------------------------------ F( 0, 1) = 0.00
Model | 0 0 . Prob > F = .
Residual | 0 1 0 R-squared = .
Total | 0 1 0 Root MSE = 0

------------------------------------------------------------------------------
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 42 . . . . .
------------------------------------------------------------------------------

This is not estimating a slope, except on unity, but again a minimal example is a small step away:

. gen x = _n

. regress y x

Source | SS df MS Number of obs = 2
-------------+------------------------------ F( 1, 0) = .
Model | 0 1 0 Prob > F = .
Residual | 0 0 . R-squared = .
Total | 0 1 0 Root MSE = 0

------------------------------------------------------------------------------
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 0 . . . . .
_cons | 42 . . . . .
------------------------------------------------------------------------------

Your example is a much more complicated model, but the principle is
a beast of the same kind. The error message is best thought of as a warning, that the data don't provide enough information to assess the model in that respect.

On a different note, I note that the nonlinearity here is entirely
a matter of complicated relationships between the parameters:

Y = b0/(1-b3) + b1*X1 + b2*X2 + [(b3*b1+b4)/(1-b3)]*X3 + [b3*b2/(1-b3)]*X4 + [b5/(1-b3)]*X5 + e

Very crudely, modulo my inability to count,

b0 appears once,
b1 twice,
b2 twice,
b3 six times,
b4 once,
b5 once.

It doesn't seem especially surprising that b3 turns out to be hardest
to determine, as it is so tangled up with most everything else. I can't say more about the topology or geometry of this parameter space, but hands up those who guess it's a mess.

That suggests to me a comparison with a simple regression
on X1 ... X5. No doubt that ignores your substantive or theoretical
grounds for using this parameterisation, but _in practice_ does
it give similar or different predictions for the response?

Giulio Zanella

I estimated a nonlinear model using command nl. Stata produced estimates for
all of the coefficients. However, the standard error of one such coefficient
(and this only) was not computed: a dot replaced the standard error and
related statistics cells. Defining dep var Y coefficients b0 to b5 and
regressors X1 to X5 (plus constant), the model is:

Y = b0/(1-b3) + b1*X1 + b2*X2 + [(b3*b1+b4)/(1-b3)]*X3 + [b3*b2/(1-b3)]*X4 +
[b5/(1-b3)]*X5 + e

I don't understand why Stata can compute the mean of b3 but not its standard
error, while - for instance - standard errors associated with b1 and b2 are produced. Any clue?

*
* 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/