/* TEST FOR HETEROSCEDASTICITY AND TECHNICAL INEFFICENCY */ /* 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; sigmahat2 = (resid'*resid)/nobs; /* Breusch-Pagan Test */ z = constant~region2~region3; g = (resid.*resid/sigmahat2) - 1; LM = (g'*z*inv(z'*z)*z'*g)/2; print "LM Statistic for BP Hd Test = " LM;