This page is hosted on AFS file server space, which is being shut down on November 13, 2018. If you are seeing this message, your service provider needs to take steps now. Visit afs.unc.edu for more information.

*Stata Commands
*Assignment 1

*Problem 5
tab1 y x
su y x
su y x, detail
scatter y x
reg y x
scatter y x || lfit y x
lincom x*30
display 2.114+1.1648
predict yhat, xb
reg y x, beta

*Problem 6
reg y x
predict residuals, residuals
sum(residuals)
su residuals

*Problem 12
reg y x

*To get predicted values
predict yhat

*To get standard errors of predicted values
predict stderr, stdp

*Confidence Interval for Estimate of Y-h (generate is a command that creates a new variable*
generate yhatll = yhat-stderr*invttail(118,.975)
gen yhatul = yhat+stderr*invttail(118,.975)

*To get standard errors of Y-h(new)
predict stderrpr, stdf

*Confidence Interval for Y-h(new)
generate pryhatll = yhat-stderrpr*invttail(118,.975)
gen pryhatul = yhat+stderrpr*invttail(118,.975)