代做Stata Exercise and Commands调试SPSS
- 首页 >> CSStata Exercise and Commands
Due 11/4 (Monday) @ 11:59pm on Moodle | Solo Assignment
1. Import the Excel format data “BWGHT Excel data” into Stata and save as a Stata data file. Remember to check the "import first row as variable names" box.
Try the following command and click the save button:
label variable bwght “birth weight, ounces”
help label
2. Type clear in the command window, click enter before opening the data set “BWGHT.DTA” (Stata format, with all the labels already filled in).
3. Produce descriptive statistics for cigs, bwght, fatheduc, and male
Useful commands: sum (for continuous variables), tab (for categorical variables)
4. Regression analysis using OLS (bwght as Y)
a. Start with one control variable: cigs.
Interpret the estimated slope coefficient.
b. Then multiple controls: cigs, faminc, parity, male, white.
Interpret each estimated slope coefficient and the coefficient of determination.
c. Add fatheduc to the above set of controls. What happens to the number of observation used in this regression?
d. Add motheduc to the equation. Should we keep both fatheduc and motheduc in the equation?
Command for joint hypothesis test after running a regression:
test fatheduc motheduc
5. Results table: look for important information such as coefficients, t-test and overall significance test results. [You only need to paste the results table here.]
6. Case selections: e.g., reg bwght cigs faminc if cigs>0
[Paste the results table here and discuss the main difference from the regression without including if cigs>0 in the command.]
7. Missing values: identify and exclude. [Try the following command, paste the results table and discuss the main difference from the regression without including if fatheduc!=. in the command.
Command: reg bwght cigs faminc if fatheduc!=.
8. Try alternative combinations of control variables as well as different measures of the dependent variable. [Paste the results tables from various regressions you tried.]
What is your final choice of the dependent variable (i.e., bwght, lbwght, or bwgthlbs) and control variables?
9. Write down your version of the estimated regression equation (with actual numeric coefficients and standard errors) and interpret each slope coefficient. See if you can make a conclusion regarding the effect of smoking on birth outcomes.
10. Based on your estimated regression equation, find the residuals for the 2nd and 36th observations.
Command after running the regression: predict residual, r
[We are creating a new variable named “residual” here.]
Try this command to list the value of the variable “residual” from the 2nd to the 36th observations:
list residual in 2/36
Alternatively, we can open the data browser window, locate the last column which is now the new variable named “residual,” and find the two values from there.