Build a predictive model to forecast data with R,’Everything is explained in the word doc! This is a business forecasting course that uses R to build some models. Theres no standard/required method to do the modeling feel free to use any. Please upload the R code file too~ Thanks! data scraping and preparation hints(below) code: #Homework 3: webscraping data understand and preparation step #Import the data by scraping the website library(rvest) #this is a package that contains function to scrape website library(tidyverse) library(ggplot2) library(forecast) #define the URL variable: url=”https://www.census.gov/econ/currentdata/dbsearch?program=MWTS&startYear=1992&endYear=2020&categories%5B%5D=4232&dataType=SM&geoLevel=US¬Adjusted=1&submit=GET+DATA&releaseScheduleId=” #read_html(url) = %>% read_html() furniture= url %>% read_html() %>% html_nodes(xpath=//*[@id=”report0″]/table) %>% html_table() #in what data structure furniture are? class(furniture) #what are the column types in furniture? str(furniture) unlist(furniture) furniture=furniture[] # take/extract first list element which is adata frame and store it as data frame structure #in what data structure furniture are now? class(furniture) # remove first column: furniture = furniture[-1] #check: furniture # remove comma and convert to numeric type: # Explanation why it will not work exactly what we did in class. # One little trick is needed! Let me show how we can break it # “drill down” and identify the issue: furniture # this is a data frame with 12 columns and character type data gsub(“”””furniture) # this will produce a data structure that consist of # a sequence of vectors where each vector is a column from a data frame # to see what the above function produces lets use cat function: ehn output # looks strange( contaiuns strange formats such as \ or / etc. try cat function): cat(gsub(“”””furniture)) # Though visually output looks a bit nicer it is still unclear how to deal # with such output. In addition to data frame (format/data structure for # storing tabular data) R has another data structure for storing tabular data # that are of the same type i.e. all columns are either numerical or all # columns are character or TRUE/FALSE etc. It is matrix. So data frame when # all columns are of the same type could be converted to matrix using as.matrix: as.matrix(furniture) # this is still a table of numbers # you run ?as.matrix and read a bit more # Why this is useful? check this out: gsub(“”””as.matrix(furniture)) # gsub function is applied to all columns! Yippee! # and now can convert to numeric: as.numeric(gsub(“”””as.matrix(furniture))) # Note that as.numeric also changes the data structure the data is stored in: # it changed from matrix(data table) into a vector which conveniently going # to be converted to a time series object. There is little nuance: as.numeric # formed a vector by taking a first column then put second column values etc # It basically ruined the time order of data! The data should follow # chronological order: 1992 jan 1992 feb … 1992 dec 1993 jan 1993 feb …. # to achieve that we can transpose matrix which is an outcome of as.matrix i.e. # switch rows and columns: # example starts a=matrix(1:1025) a t(a) # example ends # lets at t(): as.numeric(gsub(“”””t(as.matrix(furniture)))) # Now convert data into the ts object: y=ts(as.numeric(gsub(“”””t(as.matrix(furniture))))start=c(19921)frequency =12) autoplot(y) # All the code to scrape the data clean and create a ts object can be written # using the pipe oprator %>%. Remember %>%passes output of function # the next functions FIRST parameter. For gsub data is the third parameter. # Using pipe when oput put of one fuction is not the first input for another fucntion # see below gsub function we use . dot notation to tell R to use output of the # previous function). Strange – but thats how it works. We just need to remmeber y = url %>% read_html() %>% html_nodes(xpath=//*[@id=”report0”]/table) %>% html_table() %>% last %>% select(-Year) %>% as.matrix %>% t %>% gsub(“”””.) %>% as.numeric %>% ts(start=c(19921)frequency =12) autoplot(y) Requirements: Answers following doc guidelines and R code file (any forecasting style that you are familiar with) | .doc file ‘
We value our customers and so we ensure that what we do is 100% original..
With us you are guaranteed of quality work done by our qualified experts.Your information and everything that you do with us is kept completely confidential.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
The Product ordered is guaranteed to be original. Orders are checked by the most advanced anti-plagiarism software in the market to assure that the Product is 100% original. The Company has a zero tolerance policy for plagiarism.Read more
The Free Revision policy is a courtesy service that the Company provides to help ensure Customer’s total satisfaction with the completed Order. To receive free revision the Company requires that the Customer provide the request within fourteen (14) days from the first completion date and within a period of thirty (30) days for dissertations.Read more
The Company is committed to protect the privacy of the Customer and it will never resell or share any of Customer’s personal information, including credit card data, with any third party. All the online transactions are processed through the secure and reliable online payment systems.Read more
By placing an order with us, you agree to the service we provide. We will endear to do all that it takes to deliver a comprehensive paper as per your requirements. We also count on your cooperation to ensure that we deliver on this mandate.Read more