ECN 627 Econometrics I Section 01/02/03/04/06/06 Fall 2021 Programming Assignment Due Date: Nov 23, 2021 Instructions: Please answer all questions using R-studio and paste the corresponding outputs to...

1 answer below »
Hi there, it is an assignment for an econometrics course using the R studio program.


ECN 627 Econometrics I Section 01/02/03/04/06/06 Fall 2021 Programming Assignment Due Date: Nov 23, 2021 Instructions: Please answer all questions using R-studio and paste the corresponding outputs to this word file for each question. Outputs can be found at the Console window located at the left bottom of R- studio interface. You may either directly copy and paste the outputs or take screenshots of them and paste the pictures. When pasting the outputs, please make sure you have included the commands and ONLY the commands that produce these outputs. Upload the filled word file to D2L – Assessments – Programming Assignment. Here are two sample questions and their solutions: Sample Question 1: How much is the natural logarithm of 10? Solution 1 (screenshots): Output: Solution 2 (copy and paste): Output: > log(10) [1] 2.302585 Sample Question 2: Clear the memory. Solution 1 (screenshots): Output: Solution 2 (copy and paste): Output: > rm(list = ls()) Note that in both outputs, we have lines staring with “>” (i.e. “>log(10)” and “>rm(list=ls())”). Such lines correspond to your R codes that generate the results. Please make sure such commands are included in your answer for each question. Some questions may need multiple lines of commands. Do not include unnecessary lines. Grading Policy: Each question from 1 to 12 is worth 2 marks. You get 1 mark for correct commands and 1 mark for correct results. Question 13 is worth 6 marks. You get 3 marks for correct codes and 3 marks for correct graph. The total is 30 marks. The teaching assistant, Hari, will grade the programming assignment and determine how to award partial credits. Here is the assignment question: Background: We want to predict the quality of red wine based on physicochemical tests. We obtain a dataset, “winequality-red.csv”, with the following variables. 1 - fixed acidity 2 - volatile acidity 3 - citric acid 4 - residual sugar 5 - chlorides 6 - free sulfur dioxide 7 - total sulfur dioxide 8 - density 9 - pH 10 - sulphates 11 - alcohol Output variable (based on sensory data): 12 - quality (score between 0 and 10) Please download the dataset and address the following questions. Question 1: Clear memory, set the directory as the folder where you save the dataset “winequality-red.csv”, and check if the directory is correctly specified. Output: Question 2: Load dataset using the “read.csv” command. Output: Question 3: Calculate the mean of variable “quality”. Output: Question 4: Calculate the variance of variable “quality”. Output: Question 5: Generate a new variable “log_quality”, as the natural logarithm of (“quality” + 0.000001). Output: Question 6: Regress “log_quality” on “alcohol” and summarize the regression results. Output: Question 7: Regress “log_quality” on “alcohol”, “fixed acidity”, “volatile acidity” and “residual sugar”. Output: Question 8: List all the coefficients of the second regression. Output: Question 9: Display the OLS estimate of the coefficient of “alcohol” in the second regression. Output: Question 10: Display the standard error of the OLS estimate of the coefficient of “alcohol” in the second regression. Output: Question 11: Compute and display the value of the t-statistic of H0: the coefficient “alcohol” in the second regression is 0.05 H1: the coefficient “alcohol” in the second regression is not 0.05 Output: Question 12: Compute and display the p-value of the hypothesis testing in question 12. Output: Question 13: Plot the “residual sugar” against “citric acid” and add a regression line of “residual sugar” on “citric acid” (residual sugar is the dependent variable, citric acid is the regressor). Put “residual sugar” at the vertical axis and the “citric acid” at the horizontal axis. In the output area below, you need to display both the results and the graph. Output:
Answered Same DayNov 21, 2021

Answer To: ECN 627 Econometrics I Section 01/02/03/04/06/06 Fall 2021 Programming Assignment Due Date: Nov 23,...

Suraj answered on Nov 22 2021
109 Votes
ECN 627 Econometrics Section01/02/03/04/06/06Fall 2021 Programming Assignment
ECN 627 Econometrics Sec
tion01/02/03/04/06/06Fall 2021 Programming Assignment
Question 1: Clear memory, set the directory as the folder where you save the dataset
“winequality-red.csv”, and check if the directory is correctly specified.
Output:
> rm(list = ls())
> getwd()
[1] "C:/Users/Hp/Documents"
> setwd("C:/Users/Hp/Desktop")
Question 2: Load dataset using the “read.csv” command.
Output: The data set is loaded as follows:
df<-read.csv("winequality-red.csv",sep = ";")
Question 3: Calculate the mean of variable “quality”.
Output: The mean of the variable quality is calculated with following command:
avg<-mean(df$quality)
> avg
[1] 5.636023
Question 4: Calculate the variance of variable “quality”.
Output: The variance of the variable “quality” is given as follows:
variance<-var(df$quality)
> variance
[1] 0.6521684
Question 5: Generate a new variable “log_quality”, as the natural logarithm of (“quality” +0.000001).
Output: The new variable generated is given as...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here