/* INTERACTIVE DUMMY VARIABLE IN EARNINGS EQUATION */ /* Load Data and Define Variables */ load path=c:\gauss35\classes\econ5340\data\; load x[1001,12]=cps88.asc; data = x[2:1001,.]; age = data[.,1]; age2 = age^2; grade = data[.,3]; lnwage = data[.,6]; potexp = data[.,9]; married = data[.,5]; margrade = married.*grade; nobs = rows(data); constant = ones(nobs,1); xmat = constant~age~age2~grade~married~margrade; k = cols(xmat); /* Least Squares Estimation */ urb = inv(xmat'*xmat)*(xmat'*lnwage); print "estimated coefficient vector = " urb; /* Estimated Linear Regression (Married=0) */ grade = seqa(8,0.01,nobs); age = 28*ones(nobs,1); age2 = (28^2)*ones(nobs,1); constant = ones(nobs,1); null = zeros(nobs,1); margrade = grade.*null; married = zeros(nobs,1); xmat = constant~age~age2~grade~married~margrade; lnwage0 = xmat*urb; /* Estimated Linear Regression (Married=1) */ married = ones(nobs,1); margrade = grade.*constant; xmat = constant~age~age2~grade~married~margrade; lnwage1 = xmat*urb; /* Graph of the Estimated Linear Regression */ library pgraph; graphset; title("Predicted lnwage of Married and Unmarried Evaluated at Age=28"); xlabel("Grade"); ylabel("lnwage"); xy(grade,lnwage0~lnwage1);