Relationship between height and weight based on American women's data

R- Slidify

Sandip Biswas
Part 2 - Reproducible pitch presentation

Reproducible pitch project - description

This is my reproducible pitch presentation, where I describe what I did in my simple app project. The simple app predicts the expected weight given the height.

To checkout the app please visit, shiny app

The app is based on the dataset "women" that is part of the basic package in R.The data set gives the average heights and weights for American women aged 30-39. The structure of the data is,

##   height weight
## 1     58    115
## 2     59    117
## 3     60    120
## 4     61    123
## 5     62    126
## 6     63    129

Where height is in "inches" and weight is in "lb".

Exploring the data

Lets explore the relationship between height and weight through a scatterplot

plot of chunk unnamed-chunk-3

The relationship seems approximately linear. We will use this relationship to make a predictive model.

Predictive model

We fit a linear model with these two variables and use the same for prediction,

fit <- lm(weight ~ height, data = women)

Summary of the model is given below,

## 
## Call:
## lm(formula = weight ~ height, data = women)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -1.73  -1.13  -0.38   0.74   3.12 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -87.517      5.937     -15    2e-09 ***
## height         3.450      0.091      38    1e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.5 on 13 degrees of freedom
## Multiple R-squared:  0.99,   Adjusted R-squared:  0.99 
## F-statistic: 1.4e+03 on 1 and 13 DF,  p-value: 1.1e-14

Shiny app based on linear model

Based on the linear model, we design an app where height is provided through a slider input and expected weight is calculated based on the linear model. This app is deployed in Shiny server. Screenshot of the Shiny app is provided below,

image