/* HETEROSCEDASTICITY, TECHNICAL INEFFICENCY, AND WHITE'S ESTIMATOR */ /* Load Data and Define Variables */ load path = c:\gauss35\classes\econ5340\data\; load x[464,30] = tescores.txt; tescore = x[.,2]; modern = x[.,3]; experience = x[.,4]; gender = x[.,5]; age = x[.,6]; elemed = x[.,7]; seced = x[.,8]; somecollege = x[.,9]; college = x[.,10]; prof = x[.,11]; plots = x[.,12]; crops = x[.,13]; erosion = x[.,14]; fertility = x[.,15]; aptitude = x[.,16]; slope = x[.,17]; pests = x[.,18]; weeddens = x[.,19]; weedhght = x[.,20]; plantdis = x[.,21]; hydromorph = x[.,22]; lowland = x[.,23]; irrigated = x[.,24]; raindays = x[.,25]; rainqty = x[.,26]; region2 = x[.,27]; region3 = x[.,28]; yr94 = x[.,29]; yr95 = x[.,30]; nobs = rows(x); constant = ones(nobs,1); y = -ln(tescore); xmat = constant~modern~modern^2~experience~experience^2~gender~age~age^2~elemed~ seced~somecollege~college~prof~plots~plots^2~crops~crops^2~erosion~fertility~ aptitude~slope~slope^2~pests~pests^2~weeddens~weeddens^2~weedhght~weedhght^2~ plantdis~plantdis^2~hydromorph~lowland~irrigated~raindays~raindays^2~ rainqty~rainqty^2~region2~region3~yr94~yr95; k = cols(xmat); vnum = seqa(1,1,k); /* ************** */ /* OLS Regression */ /* ************** */ b = inv(xmat'*xmat)*(xmat'*y); resid = y - xmat*b; s2 = resid'*resid/(nobs - k); varb = s2*inv(xmat'*xmat); seb = sqrt(diag(varb)); tstat = b./seb; print "Variable Coefficient Standard Error t Statistic "; print vnum~b~seb~tstat; print; /* F Tests for Exclusion Restrictions */ Id = eye(k); Rx = Id[2:17,.]; Rz = Id[18:k,.]; qx = zeros(17-2+1,1); qz = zeros(k-18+1,1); Fx = (Rx*b - qx)'*inv(Rx*inv(xmat'*xmat)*Rx')*(Rx*b - qx)/((17-2+1)*s2); Fz = (Rz*b - qz)'*inv(Rz*inv(xmat'*xmat)*Rz')*(Rz*b - qz)/((k-18+1)*s2); print "F Statistic for Managerial Variables = " Fx; print "F Statistic for Exogenous Variables = " Fz; print; /* White's Estimator of Var(b) */ wvarb = inv(xmat'*xmat)*((xmat.*resid^2)'*xmat)*inv(xmat'*xmat); wseb = sqrt(diag(wvarb)); wtstat = b./wseb; print "Variable Coefficient White's Standard Error t Statistic "; print vnum~b~wseb~wtstat; print; /* Wald Test for Exclusion Restrictions */ wvarb = inv(xmat'*xmat)*((xmat.*resid^2)'*xmat)*inv(xmat'*xmat); Wx = (Rx*b - qx)'*inv(Rx*wvarb*Rx')*(Rx*b - qx); Wz = (Rz*b - qz)'*inv(Rz*wvarb*Rz')*(Rz*b - qz); print "Wald Statistic for Managerial Variables = " Wx; print "Wald Statistic for Exogenous Variables = " Wz;