ECON 178 S2 2022: Problem Set
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
ECON 178 S2 2022: Problem Set
2022
Instructions:
● The homework has a total of 120 points. The TA will randomly pick two problems (one from the conceptual questions and one from the applied questions) to grade and these problems are worth 90 points (you will get 90 points if your answers are correct or almost correct). The remaining 30 points will be graded on completion of this assignment.
● There will be two separate submissions: one for your R code and one for your writeup. Please submit both on Canvas (more details for the submission of the R part are given in “Applied questions”).
● Please follow the policy stated in the syllabus about academic integrity.
● You must read, understand, agree and sign the integrity pledge
(https://academicintegrity.ucsd.edu/forms/form-pledge.html) before completing any assign- ment for ECON178. After you sign the pledge form, a receipt will be emailed to you. Please include this receipt in the submission of your assignment on Canvas.
Conceptual questions
Conceptual question 1
In the textbook: 5.4.3b(ii) (p.198); 6.8.4 (p.260) parts a,b,c,d only (Recall that RSS is the “Sum of Squared Residuals”, training RSS is the RSS for the training set and test RSS is the RSS for the test set). Please find these questions in “textbook.pdf”under “Modules -> Assignments”.
Conceptual question 2
In the textbook: 6.8.1c (p.259), 6.8.2a (p.259), 6.8.3a,b,c,d (p.260). Please find these questions in “textbook.pdf”under “Modules -> Assignments”.
Applied questions (with the use of R)
For this question you will be asked to use tools from R for coding.
Installation
● To install R, please see https://www .r-project .org/.
● Once you install R, please install also R Studio https://rstudio.com/products/rstudio/ download/.
● You will need to use R Studio to solve the problem set.
Useful readings
In addition to the lectures provided by the instructor and the TA, you might find the following readings useful:
● Chapter 2.3 and 3.6 in the textbook ”An introduction to statistical learning with applications in R”.
Applied question 1
This exercise helps you get familiar with basic commands in R by working with the Forest Fires data set (Dua, D. and Graff, C., 2019, UCI Machine Learning Repository;1 see:
https://archive.ics.uci.edu/ml/datasets/Forest+Fires). This data set is available on Canvas = Assignments.
1. Download the dataset from Canvas and open it using the command “read.csv”.
2. Open the data and report how many columns and rows the dataset has;
3. See the names of the variables (see online the command “names”);
4. Run a linear regression with “area” as a function of “temp” using the command “lm”;
5. Report the summary of your results (see online the command “summary”)
7. Plot a scatter plot of the regression (Hint: use abline() to draw the regression line)
8. Write down the interpretation of the coefficients as a comment in your .R script (Hint: see template file).
Please write all your answer and code in template_ps1.R file and submit that file on Canvas as described in the “Submission” section below.
Download
from Canvas = Assignments
● data_ps1.csv;
● template_ps1.R
Submission
● Open the template_ps1.R file that we provided on Canvas = Assignments.
● All your solutions and code need to be saved in a single file named template_ps1_YOURFIRSTANDLASTNAME.R file. Please use the template_ps1.R pro- vided in Canvas to structure your answers.
● Any file that is not an .R will not be accepted, and the grade for this exercise will be zero.
● Please submit your code on Canvas.
1 Dua, D. and Graff, C. (2019). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.
Applied question 2
Please find “AppliedQuestion_2.pdf” under Modules -> Assignments, and complete the exercises in “AppliedQuestion_2.pdf”. Please write all your answer and code in template_ps2.R file and submit that file on Canvas similarly as “Applied question 1”.
Download
from Canvas = Assignments
● wine_red.txt;
● student.matG.txt;
● template_ps2.R
Applied question 3
Please find “AppliedQuestion_3.pdf” under Modules -> Assignments, and complete the exercises in “AppliedQuestion_3.pdf”. Please write all your answer and code in template_ps3.R file and submit that file on Canvas similarly as “Applied question 1”.
Download
from Canvas = Assignments
● template_ps3.R
● There are no data files for you to download for Applied question 3. The first line of code in “Hint” of “AppliedQuestion_3.pdf” provides you the command for opening the data needed for this question.
2022-08-22