Homework 1 519021911239 叶航宇 1. Prove. Since we have: So the left: 2. Solution. Assume a simple regression model as: for any sample for the input , we have: , we could estimate by: the residuals: since we have , we need to get optimal solution: By FOC (first order condition), we have devided by : then we have: so we get 3. Prove. so we have: 4. Prove. since we have: we could get: by averaging: and substract: therefore: so 5. Since so we have for any : and since: so 6. 1. No. Because the change of study time may cause change of other variale. 2. There is a exact linear relationship among all the independent variables. 3. 7. 1. is probable to be negative and nox, the housing price will be is probable to be positive. With one percent more percent cheaper. 2. Maybe more nox means less housing area and fewer rooms. downward 3. Yes. Computer Exercises 1. average: 13.46 lowest: 9 highest: 18 2. black: 120 non-black: 815 percentage of no black: 87.17 3. 1. average wage: 957.95 black average wage: 735.84 non-black average wage: 990.65 2. On average, black men earn less. 3. No. Being black may have effect on one's wage, but is not the only parameters. And the sample here only shows the causality. 4. married == 0: 100 the group who are not married has a higher sample mean education. 5. 1. corr: 0.3271 Positive, means that they are positively correlated. 2. The more years of education, the higher sample mean of monthly earnings. The scatter plot confirm this relation ship. Code 1 *** Program name: Sample Do File.do 2 3 * NOTE: Whenever a line begins with an asterisk, STATA ignores the whole line - this is just a comment/note. 4 capture log close 5 clear /* The 'clear' command gets rid of all data in memory*/ 6 set memory 60000 /* Allocate 60MB memory to Stata */ 7 set matsize 150 /*Set the maximum number of variables in a model*/ 8 set more off /*tells Stata not to pause or display the ” –more–” message when showing results.*/ 9 10 * This line tells Stata where the files are located. USE "" if your folder names contain spaces. 11 * THIS IS THE ONLY LINE YOU NEED TO CHANGE. 12 cd "D:\OneDrive\2020学年第二学期\计量经济学\homework\week 1" 13 14 * NOTE: The next lines set up the .log file. It will contain all of the output 15 * from this program when it is run. It will be saved in the same directory as the 16 * program and will be replaced with each new run. I have called the log-file ProblemSet1. 17 log using sample.log, replace 18 19 * This line reads in the data set called WAGE1.dta in the same directory (in my case this is directory "datasets"). 20 use "WAGE2", clear 21 22 * Type all commands you need below. The commands should NOT contain an asterisk. 23 24 * 1 25 sum educ 26 27 * 2 28 tab black 29 30 * 3 31 tab black, sum(wage) 32 33 * 4 34 tab married, sum(educ) 35 36 * 5 37 corr educ wage 38 tab educ, sum(wage) 39 40 scatter wage educ 41 42 * To execute all commands in the Do File, click CTRL+D 43 44 log close 45 exit, clear 46