Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Individual Assignment 1

EC295 – Winter 2023

Due: Friday, February 10 at 9 PM

Assignment Description

In this assignment you are asked to manipulate data, estimate statistical relationships, and interpret the findings. The main goal behind the assignment is to help you get more comfortable applying statistical methods and using software, but also to think about a policy-relevant topic that economists actively research today.

The questions below guide you through the process of statistical estimation.   You are provided the relevant Stata commands you will need, some of which you will not have seen before.  It will therefore be useful for you to use the help” function in Stata, and/or to look up the command in the Stata reference  manuals  (which are available within Stata as  PDFs), or Google.   You are also, as always, welcome to ask me for help.

strongly suggest that you start this assignment early because it will not be possible (in my opinion) to do well if you start close to the due date.  There are parts that you may find difficult; you will want to identify them and leave enough time to ask questions if necessary.

Assignment Instructions

Data analysis

In mylearningspace, you will find a datafile called EC295Assignment1.dta” that contains the data for this assignment.  The data come from a study of serious adolescent offenders as they transition from adolescence into early adulthood:  Pathways to  Desistance Study . Download the dataset on to your computer and make note of the folder where you save it.

I have also provided a template dofile that all students must use to write their assignment dofile (if you are using R, you will need to recreate something similar to this). Store it in the same folder where you put your data.  You will need to manipulate that template in the following way:

-     Rename the file from EC295_assign1TEMP.do” to your last name followed by your student number (no spaces)

-     After cd, replace INSERT THE PATH TO THE FOLDER WHERE YOU STORE THE DATA with the path to the folder where you stored the EC295Assignment1.dta” dataset.  Do not remove the quotation marks.

-     After log using, replace INSERT YOUR LAST NAME AND STUDENT NUMBER HERE with your last name and student number, with no space between the two. Do not remove the quotation marks

-     After set seed, replace INSERT YOUR STUDENT NUMBER HERE with your full student number.

Leave all other commands and comments untouched.  You should type in your Stata commands below the line that says Insert your stata commands below here”, but above Insert your stata commands above here” .

Note that the set seed and sample commands will take a random 95% subsample of the data that is different for every student.  For this reason, the numbers that you get with your output will not be the same for any two students.  Be mindful of this if you are comparing your work with your peers.

Submission

You are required to submit three documents:

a)   A report containing your answers to all the questions.   I outline below how I would like your report to look.  The overall goal is that the answers to each question must be easily identifiable in a readable, professional-looking document.  Submit to Gradescope.

b)   Stata dofile.  Submit electronically using the dropbox in mylearningspace.

c)   Stata log file. Submit electronically using the dropbox in mylearningspace.

In the report described in (a) above, please answer all questions in the same order as they are stated on the question sheet.  For each question and sub-question, include the relevant Stata code (if any) that you used, the output generated by that command if there was any, and an interpretation if you are asked to provide it.  For example, if you were answering the following hypothetical question, it might look like this:

************************************************************************************ 1)   Locate the variable y

a.   Using the tab command, provide a frequency distribution for y

Stata commands:

tab y;

Output:

y |      Freq.     Percent        Cum.

------------+-----------------------------------

1 | 2 | 3 | 4 | 5 |

23,844

138,568

9,049

63,162

2,651

10.05

58.40 3.81    26.62 1.12

10.05

68.45

72.26

98.88

100.00

------------+-----------------------------------

Total |    237,274      100.00                                                                                                                                               ************************************************************************************ You could also format your own output tables rather than copying and pasting Stata output if you find it easier. The key is that as long as the questions are answered in order, and the Stata commands used for each subquestion and associated output are clear, it will be fine.

A note on plagiarism: this is an independent assignment, which I expect you to complete on your own. It is plagiarism to copy someone elses work verbatim, which includes Stata dofiles.  Any work you submit should be yours only.

Thank you note : I am very grateful to Professor Justin Smith for sharing his class material. This assignment represents a modified version of a STATA homework developed by him.

In mylearningspace you will find a dataset called EC295Assignment1.dta” .  Please use this datafile to answer the following questions.  Each question is worth 5 points, for a total of 85.

1)   (5 points) Using the describe command, report the number of observations in the data, the number of variables, and comment briefly about what variables are in the dataset (you do  not  need to individually describe each variable, but instead give an overview).

2)   Suppose you are interested in learning about the relationship between years of criminal experience and number of crimes.

a.   (5  points)  Using  the  tabulate  command,  generate  a  table  with  the  joint  probability distribution between years of criminal experience is above 0” and number of crimes is above 0” .  Describe the results [hint: you will need to add the cell option to this command to produce the joint probability distribution . Options are added after a comma (e.g., tabulate var1 var2, cell)].

b.   (5 points) Use the tabulate command to produce the probability distribution for number of crimes  is  above  0” .   Then  use the  tabulate  command  again to  produce  the  probability distribution for “number of crimes is above 0” conditional on years of criminal experience is above 0” .  How does the probability of engaging in a crime change when you take individuals with more some criminal experience?  Based on this, is the number of crimes independent of criminal experience? [hint: you will need to use the if option to generate the conditional probability distribution].

3)   Suppose you are now interested in testing some hypotheses about the population average number of crimes.

a.   (5  points)  Using  the  summarize  command  compute  the  mean,  standard  deviation,  and median number of crimes. Interpret each value [hint: you will need to use the detail option to get the median].

b.   (5 points) Manually compute the t-statistic for testing the null hypothesis that the average number of crimes equals 20 against the alternative that it does not equal 20.

c.   (5 points) Combining the display and invttail functions, compute the critical value for the hypothesis test in part (b) if the significance level is 5%.  Compare the observed value of t from part (b) to the critical value and decide whether you accept or reject the null hypothesis.


d.   (5 points) Using the ci command, compute a 95% confidence interval for the average number of crimes.  What is the set of null hypotheses would we accept at the 5% level?

e.   (5 points) Using the ci command, compute a 90% confidence interval for the average number of crimes.  Explain why the interval is narrower than the one in (d).

f.    (5 points) Combining the display and invttail functions, compute the critical value for testing the null hypothesis that the average number of crimes is smaller than or equal to 20 against the alternative that it is larger than 20, if the significance level is 1%.  Compare the actual value of t from part (b) to the critical value and decide whether you accept or reject the null hypothesis.

g.   (5 points) Using the ttest command, perform the same hypothesis test as in (f).  Based on the p-value for this test, what significance levels are consistent with rejecting the null? Do you accept the null hypothesis at the 5% significance level? Do you accept the null hypothesis at the 10% significance level? [hint: the ttest command performs both one-sided and two-sided tests at the same time, and  reports the  p-values for each along the  bottom  row,  in the following order: lower-tailed test, two- tailed test, and upper-tailed test].

4) Suppose you think that the number of crimes is related to years of criminal experience .

a.   (5 points) Using the correlate command, compute the covariance between the number of crimes and years of criminal experience [hint: you will need to use the covariance option to observe the covariance. If you do not add the option, the command displays the correlation coefficient].  Next, use the generate command to create a new variable called months_crime that equals years of criminal experience times 12. Compute the covariance between this new variable and number of crimes.  Compare the two covariances and explain any difference .

b.   (5 points) Use the correlate command to compute the correlation between the number of crimes and years of criminal experience.   Then  use the same command to compute the correlation between the number of crimes and months of criminal experience . Compare the two correlations and explain any differences .

c.   (5 points) Using the twoway scatter command, generate a scatterplot with number of crimes on the vertical axis and years of criminal experience on the horizontal axis.   Based on this graph, answer the following questions:

i.   What is the apparent direction and strength of the relationship between number of crimes and years of criminal experience?

ii.   Are there any outliers? If so, what effect would this have on your answer to (i) above?

d.   (5 points) Suppose now that number of crimes and years of criminal experience are related through the following simple regression function

ncTimes =  F0  + F1yeaTs_cTime + u

Provide an interpretation for F0, F1, and u.

e.   (5 points) With the regress command, estimate the parameters of the regression function using Ordinary Least Squares.  Comment on the relationship between number of crimes and years of criminal experience.

f.    (5 points) Using the R2, describe how well the regression line fits the data.

g.    (5 points) One of the key assumptions of the linear regression model, in this context, is that E[u|years_crime] =  0.  Explain the meaning of this assumption, and whether you think it is justified in this model.