// Task 1 routine setup capture log close set more off estimates clear log using cda04b-ex4.log, replace text version 9.2 set scheme s2mono // pgm: cda04b-ex4.do // task: 4 - Binary Regression - Excercise // project: CDA Lab Guide // author: your name // date: today's date use science3, clear // Task 2: Keep jobclass, female, enrol and phd, Examine the variables // drop missing cases. // Step 2.1 keep the four variables and summarize them. // Step 2.2 drop missing cases // Step 2.3 verify the last step. // Task 3: Create a binary dependent variable hijob from jobclass. // // hijob=1 if jobclass>2, else 0. Missing values remain missing. // // Verify your transformation. Add variable and values labels. // Step 3.1 Create a binary dependent variable hijob, from jobclass. // Step 3.2 Add variable and values labels. // Step 3.3 verify variable creation // Task 4: Estimate a probit of hijob on female, enrol and phd. // List coefficients and compute predict probabilities for each observation. // Label the variables created by predict. // Step 4.1 Estimate the probit model. // Step 4.2 List coefficients. // Step 4.3 Predict probabilities. // Step 4.4 Label the variable created by predict. // Task 5: Do the same with a logit model. // Step 5.1 Estimate the logit model. // List coefficients. // Step 5.3 Predict probabilities. // Step 5.4 Label the variable created by predict // Task 6: Compare logit and probit predictions with a graph. // Task 7: Interpret the logit regression // Task 7a: compute predicted probability with variables at their means // Task 7b: predicted probability for males with other variables at mean // Task 7c: for females // Task 7d: differences for males and females // Task 7e: discrete and marginal change // Task 7f: discrete and marginal change for females with other // variables at the mean. // Task 7g: compute predictions as phd varies, first for feamle=1 // with other variables held at mean; then for males. // Task 8: [Optional] Compare the logit and probit coefficients. // a) Why are the unstandardized coefficients so different? // b) How different are they? // c) Why are the standardized coefficients similar? // d) Why aren't they exactly the same? /* Type your answer here */ // Task 9: [Optional] Use foreach to make transformations. // // Example: There are 3 variables (jobclass, felclass, phdclass) // that have the similar coding. Suppose that we want to turn all // of these variables into dummy variables with 3 and 4 recoded to 1 // and 1 and 2 recoded to 0. Then run a logit regressions. // Method 1: Without looping use science3, clear // Method 2: With looping using the foreach command use science3, clear log close exit