Week 4 - Developing Data Products Course Project

Shiny Application on Prediction Model

Yue Li
2018/02/18

Introduction

This presentation is created for Developing Data Products Course project. The purpose is to provide supporting documentation to the respective Shiny application.

The Shiny application is at: https://cranberryly.shinyapps.io/data_products

The Shiny application source code is at: https://github.com/cranberryly/Developing_Data_Products_Coursera

About the Shiny application

The Shiny application is based on mtcars dataset, it trains a linear model in the backgroud using existing data and will generate preidctions according to user's input.

The prediction is mpg miles per gallon, the input variables are: wt, qsec and am, which are weight, ¼ mile time and transmission type.

About the Prediction Model

The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973-74 models).

A multivariate linear regression model is trained to include 3 significant attributes based on variables' p-value.

fit <- lm(mpg ~ wt + qsec + am, data=mtcars)

About User's Input

The User needs to input the value of weight, ¼ mile time and transmission type to get the predicted miles per gallon value of their interest.

userInput <- data.frame(input$var1,input$var2,input$var3)
names(userInput)<-c("wt","qsec","am")
predict(fit,newdata=userInput)