Question

Submit two separate text files for the following questions. Try to explain your findings in the text file. 1. R Practice ECO520 Homework 7 Introduction to R There are two

videos available to learn R in D2L. When you watch the "R Practice 1" video, you need to write the R code as the video shows. You can change some of the numbers or format, but you have to show all the instructions in the video in a txt file. 2. Regression Analysis on House Price in Chicago Revisit the Chicago House Price Example. Use the following code to load the house price data. # MLS 2021 Chicago House Price in R # if you use Rstudio in bigblue server, use the following code housel <- read.csv ("/var/www/html/jlee141/econdata/housing/mls2020_sample.csv") # if you use your own local Rstudio, use the following code #housel <- read.csv ("https://bigblue.depaul.edu/jlee141/econdata/housing/mls2020_sample.csv") # Converting to a category variable house1 $ZIP <-as.factor (housel$ZIP) # Creating a logical variable housel$sold <- as.logical (house1 $SOLD_30DAY) # Creating a numerical variable house1 $AGESQ <- (house1$AGEBLD^2) # find available zip codes, and select a ZIP code and save as indata table (house1$ZIP) indata <- subset (housel, ZIP == '6XXXX") # Make sure to choose your own zip code 1) Descriptive Analytics in R a. Show the summary statistics of all variables and investigate any missing or outliers. b. Make the histograms of the log of house price, the age of the building, and the square feet. c. Create scatter plots between the log of house price vs. the log of square feet. Add a linear regression line of the scatter plot. d. Find the median price by the bedroom size and the mean price by the zip code 2) Split the "indata” into 70% of the train and 30% of the test data set. Modify the following code and use your student ID number as the seed number. # Train and Test Data set.seed (DePaulID) train_ind <- sample(nrow(indata),round(0.7*nrow(indata))) train <- indata[train_ind,] test <- indata[-train_ind,] 3) Let's consider the following regression models, use the train data set to estimate the model, and compare the performance regarding the root mean square of error (RMSE) on the test data. Which model gives the best performance on the prediction? Model1 : LOG_PRICE= b0 + b1 LOG_SQFT + e Model2: LOG_PRICE= b0 + b1 LOG_SQFT + b2 BEDROOM + b3 BATHROOM + e Model3: LOG_PRICE= b0 + b1 LOG_SQFT + b2 BEDROOM + b3 BATHROOM + b4 GARAGE + b5 FIREPLACE+ b6 AGEBLD + b7 AGESQ + b8 SOLD_30DAY + e Model4: Model 3 with an option of stepwise and direction = both Submit your R work in a text file with your answers.