# Replicate illustrative NLS model from Russell Davidson
# This example is associated with his econometrics program 
# ECTS; see http://russell.vcharite.univ-mrs.fr/ects4/

open ects_nls.gdt
ols y 0 x1 x2 --vcv
genr alpha = $coeff(0)
genr beta = $coeff(x1)
genr a0 = alpha
genr b0 = beta

# with analytical derivatives
nls y = alpha + beta*x1 + (1/beta)*x2
 deriv alpha = 1
 deriv beta = x1 - x2/(beta*beta)
end nls --vcv

# with numerical derivatives
genr alpha = a0
genr beta = b0
nls y = alpha + beta*x1 + (1/beta)*x2
 params alpha beta
end nls --vcv

