** FLS 6183 & FLP 0468 ** Lab 2: Omitted Variable Bias * Data: 13/09/2018 clear * Part a. No correlation between X and Z * We will create a data set with 500 observations. We are establishing that X has a mean of 7 and a standard deviation of 8. * We are estiablishing at Y with mean 100 and standard deviation of 20. We are also establishing that Z has a mean of 20 and a standard deviation of 2. * In addition, we will stipulate that the correlation between X and Z is 0, that the correlation between X and Y = 0.7 and the correlation between Y and Z = 0.3. * x, y and z are randomly drawn from a normal distribution. Please note in the matrix C below the order is (y, x, z) in each colunm and row. matrix m = (100,7,20) matrix sd = (20,8,2) matrix C = (1, 0.7, 0.3 \ 0.7, 1, 0 \ 0.3, 0, 1) drawnorm y x z, n(500) means (m) sds(sd) corr(C) seed(12345) summarize corr y x z regress y x estimates store m1 regress y x z estimates store m2 esttab m1 m2, se esttab m1 m2, ci * Part b. Correlation between X and Z =0.75 * We will create a data set with 500 observations. We are establishing that X has a mean of 7 and a standard deviation of 8. * We are estiablishing at Y with mean 100 and standard deviation of 20. We are also establishing that Z has a mean of 20 and a standard deviation of 2. * In addition, we will stipulate that the correlation between X and Z is 0.75, that the correlation between X and Y = 0.7 and the correlation between Y and Z = 0.3. * x, y and z are randomly drawn from a normal distribution. clear matrix m = (100,7,20) matrix sd = (20,8,2) matrix C = (1, 0.7, 0.3 \ 0.7, 1, 0.75 \ 0.3, 0.75, 1) drawnorm y x z, n(500) means (m) sds(sd) corr(C) seed(12345) summarize corr y x z regress y x estimates store m3 regress y x z estimates store m4 esttab m2 m4, se esttab m3 m4, se esttab m3 m4, ci * Part C. Analysis with Dummy Variable generate random = runiform() kdensity random sum random, detail gen d=1 if random <=0.5 replace d=0 if random >0.5