? This file will illustrate the new minimize feature in LIMDEP. ? This is a major new feature which greatly expands the capabilities of ? the program. This new command allows the user to specify any model ? they like, as long as they can write down the log-likelihood. ? ? Our first example is from Goldfeld and Quandt, Nonlinear ? Methods in Econometrics, North Holland, 1972, page 29, ex. 2. ? ? F(c) = (c1+10*c2)^2 + 5*(c3-c4)^2 + (c2-2*c3)^4 + 10*(c1-c4)^4 ? ? The correct values of all four parameters are 0.0. (We assume that you do ? not know this a priori.) The FCN part of the command is exactly as it is ? shown above. The unrestricted optimum is found using Pause Sample ; 1 $ Minimize ; Labels = c1,c2,c3,c4 ; start = .1,-.1,.3,.05 ; FCN = (c1+10*c2)^2 + 5*(c3-c4)^2 + (c2-2*c3)^4 + 10*(c1-c4)^4 $ ? We now repeat the preceding while holding two of the parameters fixed at ? the starting values. Pause Sample ; 1 $ Minimize ; Labels = c1,c2,c3,c4 ; start = .1,-.1,.3,.05 ; Fix = c2,c4 ; FCN = (c1+10*c2)^2 + 5*(c3-c4)^2 + (c2-2*c3)^4 + 10*(c1-c4)^4 $ ? ? For the first set of sum of terms functions, we create some data. ? Pause Sample ; 1-25$ Create ; z1=rnn(0,1) ? correlated regressors ; z2 = .5*(z1+rnn(0,1)) ; z3 = (z1 + z2 + rnn(0,1))/3 ; YS = z1 + z2 + z3 + Rnn(0,2) ; D = YS>0 ? Probit Dependent variable ; T = (D=1) * YS $ ? dep.var. for a tobit model Names ; X = One,z1,z2,z3 $ Pause ? ? We now estimate a Tobit, and a probit model. Starting values are based ? on OLS. We use Olsen's formulation for the Tobit model Pause Crmodel ; LHS = T ; RHS = X $ Calc ; thet = 1/s $ Pause Matrix ; beta = thet * b $ Pause ? ? We fit the probit model using minimize and PROBIT to verify the result. ? We use Newton's method to compute the estimates Pause Probit ; Lhs = D ; rhs = X $ Matrix ; BP = b $ Minimize ; start = beta ; labels = b1,b2,b3,b4 ; alg = BHHH ; fcn = (D-1)*log(phi(-dot[x]))-d*log(phi(dot[x])) $ Matrix ; check = mdif(b,bp) $ Pause ? The tobit model is a little more complicated. ? Tobit ; lhs = T ; rhs = X $ ? ? We scale down the Tobit coefficients ? Pause Matrix ; BT = 1/s * b $ Pause Minimize ; start = beta,thet ; labels = b1,b2,b3,b4,tt ; fcn = (d-1)*log(phi(-dot[X]))-d*log(tt) +d/2*(tt*T-dot[X])^2 $ Matrix ; bmin=part(b,1,4) ; check = mdif(bmin,bt) $ Pause ? ? To illustrate the nonlinear least squares computation, we use a small set ? of data based on the Poisson regression model. Pause READ;NREC=15;NVAR=4 ;NAMES=Y,X1,X2,X3$ 1 -0.545 0.160 0.033 0 0.892 0.125 1.476 2 1.647 0.619 -0.262 2 1.749 -1.446 0.310 2 0.362 -0.589 -1.404 0 0.531 -0.606 0.777 2 0.003 -0.800 -0.897 0 0.260 0.597 -0.640 3 1.502 -0.309 0.112 0 0.613 0.273 -0.845 0 -1.028 -0.307 -1.170 2 0.155 -0.262 -0.534 1 -1.795 -2.051 -0.398 0 -1.007 1.974 0.189 1 0.596 -0.493 -1.369 Pause Namelist ; PD = One,X1,X2,X3 $ ? ? We compute two regressions, the linear and the nonlinear $ ? Pause Sample ; 1-15 $ Crmodel ; lhs = y ; rhs = PD $ Matrix ; bols = b $ Minimize ; lhs = Y ; start = 0,0,0,0 ; labels = b1,b2,b3,b4 ; fcn = dot[PD] $ Pause Matrix ; check = mdif (bols,b) $ ? ? The nonlinear regression is based on E[Y|X] = exp(b'x) ? Pause Minimize ; lhs = y ; start = b ; labels = b1,b2,b3,b4 ; fcn = exp(dot[PD]) $ ? ? Finally, the log-likelihood function is maximized. We omit the ? factorial term which does not involve the parameters. ? Pause Minimize ; start = b ; labels = b1,b2,b3,b4 ; alg=n ; fcn = exp(dot[PD]) - y*dot[PD] $