Gretl Manual: Gnu Regression, Econometrics and Time-series Library
Prev | Chapter 9. Nonlinear least squares | Next

# Initializing the parameters

The parameters of the regression function must be given initial values prior to the `nls` command. This can be done using the `genr` command (or, in the GUI program, via the menu item "Define new variable"). In some cases, where the nonlinear function is a generalization of (or a restricted form of) a linear model, it may be convenient to run an `ols` and initialize the parameters from the OLS coefficient estimates. In relation to the first example above, one might do:

          ols C 0 Y
          genr alpha = coeff(0)
          genr beta = coeff(Y)
          genr gamma = 1

And in relation to the second example one might do:

          ols y 0 x1 x2
          genr alpha = coeff(0)
          genr beta = coeff(x1)

Prev | Home | Next
Nonlinear least squares | Up | NLS dialog window