/* ** max2.e - The Tobit Model ** ** This example illustrates a different method for computing the ** Tobit function in which MAXLIK will have to be forced to pass ** the data one observation at a time. This example produces the ** the same results as MAX1.E. */ library maxlik; #include maxlik.ext; proc lpr(x,z); local t,s,m; s = x[4]; m = z[.,2:4]*x[1:3,.]; if z[.,1]; t = z[.,1]-m; retp(-(t.*t)./(2*s)-.5*ln(2*s*pi)); else; retp(ln(cdfnc(m/sqrt(s)))); endif; endp; maxset; let x0 = 1 1 1 1; __title = "tobit example"; __row = 1; output file = max2.out reset; call maxprt(maxlik("tobit",0,&lpr,x0)); output off;