Copyright © 2018 Pearson Education, Inc. 130
First try uses the same starting values for the two segments. Iterations
Never get started.
|-> calc ; yb = xbr(y) ; sb = sdv(y) $
|-> maximize
; labels = lambda,mu1,s1,mu2,s2
; start = .5, yb,sb,yb,sb
; fcn = log(lambda*1/s1*n01((y -mu1)/s1) + (1-lambda)*1/s2*n01((y-
mu2)/s2)) $
Iterative procedure has converged
NOTE: Convergence in initial iterations is rarely
at a true function optimum. This may not be a
solution (especially if initial iterations stopped).
Exit from iterative procedure. 3 iterations completed.
Convergence values:
Gradient Norm: Tolerance= .1000D -05, current value= .4896D -07
Function Change: Tolerance= .0000D+00, current value= .1958D -08
Parameter Change: Tolerance= .0000D+00, current value= .1691D -07
Smallest abs. param. change from start value = .0000D+00
At least one parameter did not leave start value.
Normal exit: 3 iterations. Status=0, F= .2135387D+04
Error 143: Models - estimated variance matrix of estimates is singular
Error 447: Current estimated covariance matrix for slopes is singular
Second try with better starting values.
|-> calc ; yb1=.9*yb ; sb1 = .9*sb
; yb2=1.1*yb ; sb2=1.1*sb $
|-> maximize
; labels = lambda,mu1,s1,mu2,s2
; start = .5, yb1,sb1,yb2,sb2
; fcn = log(lambda*1/s1*n01((y -mu1)/s1) + (1-lambda)*1/s2*n01((y-
mu2)/s2)) $
Iterative procedure has converged
Normal exit: 19 iterations. Status=0, F= .1942574D+04
-----------------------------------------------------------------------------
User Defined Optimization
Dependent variable Function
Log likelihood function -1942.57381
Estimation based on N = 1000, K = 5
Inf.Cr.AIC = 3895.1 AIC/N = 3.895
--------+--------------------------------------------------------------------
| Standard Prob. 95% Confidence
UserFunc| Coefficient Error z |z|>Z* Interval
--------+--------------------------------------------------------------------
LAMBDA| .30986*** .01608 19.27 .0000 .27835 .34138
MU1| .99937*** .06079 16.44 .0000 .88023 1.11850
S1| .88624*** .05345 16.58 .0000 .78149 .99100
MU2| 4.91473*** .04250 115.65 .0000 4.83144 4.99802
S2| .98467*** .03351 29.38 .0000 .91899 1.05036
--------+--------------------------------------------------------------------
***, **, * ==> Significance at 1%, 5%, 10% level.
Model was estimated on Aug 19, 2017 at 04:45:10 PM
-----------------------------------------------------------------------------
Third try moves segments closer together. Results are a bit less precise.
|-> sample;1-1000$
|-> calc;ran(12345)$
|-> create ; y1=rnn(1,1) ; y2 = rnn(2,1) $
|-> create ; c = rnu(0,1) $
|-> create ; if(c < .3)y=y1 ; (else) y=y2 $
|-> calc ; yb = xbr(y) ; sb = sdv(y) $
|-> calc ; yb1=.9*yb ; sb1 = .9*sb