* Nonlinear Regression for Mutual Fund Fees
*
* Keywords:
* regression, nonlinear, exponential, r-squared, autocorrelation, dw,
* durbin-watson, test, mutual, fund, advisory, fees
*
* Description:
* We illustrate how to estimate a Nonlinear Exponential Model for Mutual
* Fund Advisory Fees, calculate R-Squared for this model and conduct
* Durbin-Watson Autocorrelation Test
*
* Author(s):
* Skif Pankov
*
* Source:
* Damodar N. Gujarati and Dawn C. Porter, Basic Econometrics - 5th Edition
* McGraw-Hill International Edition, Chapter 14, Example 14.1 (page 531)
*
sample 1 12
* Reading the datafile and naming variables
read (data_14.1.shd) fee ast
* Initiating nonlinear regression procedure, stating that 1 equation with
* 2 coefficients should be estimated and storing the estimated derivatives,
* coefficients, predicted values and residuals
nl 1 / ncoef = 2 zmatrix = z coef = beta predict = feehat resid = reds
* Writing up an equation we would like to estimate - coefficients are named
* A and B
eq fee = A*exp(B*ast)
* Stating the initial values of coefficients - these shall be used as the starting
* points in the process of iterative estimation
coef A 0.5 B -0.5
end
* Generating R^2
gen1 su2 = sum(reds**2)
gen1 sy = sum((fee-sum(fee)/$N)**2)
gen1 r2 = 1 - (su2/sy)
print r2
* Generating a linear pseudomodel and computing the Durbin-Watson p-value
matrix feebar = fee - feehat + z*beta
ols feebar z / noconstant dwpvalue
stop
* Note:
* standard errors of the estimates will differ from those in the
* book because the iteration technique used by the authors and SHAZAM
* are different, which also caused the difference in R^2 and Durbin-Watson
* test statistic