Week4Assignment - mtcars Predictor Analysis

Chris Woods
9th May 2019

Objectives

The application must include:

  • an input widget which is operated on by server.R code
  • reactive output displayed as a result of server calculations
  • documentation so a novice user could use the application

R Code

The code below is run within the Presentation.

column <- names(mtcars)
description <- c("Miles/(US) gallon","Number of cylinders","Displacement (cu.in.)",
                  "Gross horsepower","Rear axle ratio","Weight (1000 lbs)","1/4 mile time",
                  "Engine (0 = V-shaped, 1 = straight)","Transmission (0 = automatic, 1 = manual)",
                  "Number of forward gears","Number of carburetors")
table<-cbind(column,description)

The code below is then run on the following page.

kable(table)

Solution

The analysis is based on the mtcars dataset which has 11 columns/ variables as set out below. Any one of these can be selected as the outcome and then the Server code calculates the p-value for all the other variables as predictors. The lower the p-value, the greater the predictive nature of the variable.

A selectsize input widget is used to choose the Outcome and the values for this are calculated within the Server code.

column description
mpg Miles/(US) gallon
cyl Number of cylinders
disp Displacement (cu.in.)
hp Gross horsepower
drat Rear axle ratio
wt Weight (1000 lbs)
qsec ¼ mile time
vs Engine (0 = V-shaped, 1 = straight)
am Transmission (0 = automatic, 1 = manual)
gear Number of forward gears
carb Number of carburetors

Output

The results are shown in tabular form and also a spider chart.

alt text