/* ** Lesson 8.1: Probit Model of Economic Education ** Greene [1999], Example 19.1 ** See also Spector and Mazzeo [1980] */ use gpe2; output file=gpe\output8.1 reset; n=33; load data[n,4]=gpe\grade.txt; gpa=data[2:n,1]; tuce=data[2:n,2]; psi=data[2:n,3]; grade=data[2:n,4]; z=gpa~tuce~psi~ones(rows(grade),1); call reset; @ probit model: estimation @ _nlopt=2; @ using component log-likelihood @ _method=4; _iter=50; _b={0.5,0.0,0.5,0}; call estimate(&probitf,grade~z); /* _deriv=&probitf1; call estimate(&probitf,grade~z); */ @ probit model: interpretation @ b=__b; print " Probability Slopes";; print cdfn(z*b)~(pdfn(z*b).*b[1:rows(b)-1]'); end; /* log-likelihood function of probit model */ proc probitf(x,b); local k,z,f; k=rows(b); z=x[.,2:k+1]*b; f=cdfn(z); @ normal cdf @ retp(x[.,1].*ln(f)+(1-x[.,1]).*ln(1-f)); endp; /* 1st derivatives of log-likelihood function of probit model */ proc probitf1(x,b); local z,k,f,g; k=rows(b); z=x[.,2:k+1]*b; f=cdfn(z); @ normal cdf @ g=pdfn(z); @ normal pdf @ retp((x[.,1].*(g./f)-(1-x[.,1]).*(g./(1-f))).*x[.,2:k+1]); endp;