/* ** max3.e - A Tobit Model ** ** Computes heteroskedastic-consistent covariance matrix ** of parameters. It also illustrates switching algorithms. ** */ library maxlik; #include maxlik.ext; maxset; proc lpr(x,z); local t,s,m,u; s = x[4]; m = z[.,2:4]*x[1:3,.]; u = z[.,1] ./= 0; t = z[.,1]-m; retp(u.*(-(t.*t)./(2*s)-.5*ln(2*s*pi)) + (1-u).*(ln(cdfnc(m/sqrt(s)))) ); endp; x0 = { 1, 1, 1, 1 }; _mlcovp = 3; _mlditer = 10; _mlmdmth = "NEWTON BRENT"; output file = max3.out reset; call maxprt(maxlik("tobit",0,&lpr,x0)); print; print "information matrix v-c of par's"; print _mlhsvcp; print; print "cross product v-c of par's"; print _mlcpvcp; output off;