Shiny App Presentation

Brian Yarno
8/29/2017

Overview

This application predicts a hypothetical country's Savings Ratio based the values of three variables the user defines.

  • Predictions are based on the Life Cycle Savings dataset in the R library.

Inputs

  • % of Population 15 and Younger
  • % of Population 75 and Older
  • Disposable Income Growth Rate

Outputs

  • Savings Ratio Prediction
  • List of Countries with Similar Profile
  • Map Highlighting Location of Similar Countries

User Instructions

  1. Select Values for each variable using the drop down boxes on the left hand side
  2. Click the “Calculate” button. This will generate the predictions
  3. Each time the selections are changed, click the “Calculate” button to refresh the predictions

Example of Map Output plot of chunk map

Methods: Savings Ratio Prediction

  • Linear regression model is fit on 50 observations in dataset
    • model uses all variables in the dataset except dpi, as it was found to be an insignificant predictor.
lm(sr ~ pop15 + pop75 + ddpi, data = LifeCycleSavings)

Call:
lm(formula = sr ~ pop15 + pop75 + ddpi, data = LifeCycleSavings)

Coefficients:
(Intercept)        pop15        pop75         ddpi  
    28.1247      -0.4518      -1.8354       0.4278  

Methods: Determining Similar Countries

  • Matching countries are determined by using the K-Means clustering algorithm with 10 clusters
  • Each country in the dataset is assigned to a cluster based on the values of variables inluced in the linear predction model.
  • A cluster is then assigned to the hypothetical country
clust <- kmeans(LifeCycleSavings[names(LifeCycleSavings) %in% c("pop15", "pop75", "ddpi", "sr")], 10)
clust$cluster
     Australia        Austria        Belgium        Bolivia         Brazil 
             8              6              6              3              9 
        Canada          Chile          China       Colombia     Costa Rica 
             8              5              9             10              9 
       Denmark        Ecuador        Finland         France        Germany 
             6             10              2              6              6 
        Greece      Guatamala       Honduras        Iceland          India 
             2             10              3              5              3 
       Ireland          Italy          Japan          Korea     Luxembourg 
             8              6              7             10              1 
         Malta         Norway    Netherlands    New Zealand      Nicaragua 
             7              2              6              8              3 
        Panama       Paraguay           Peru    Philippines       Portugal 
            10              5              9              9              2 
  South Africa South Rhodesia          Spain         Sweden    Switzerland 
             8              8              2              1              6 
        Turkey        Tunisia United Kingdom  United States      Venezuela 
            10             10              1              8              3 
        Zambia        Jamaica        Uruguay          Libya       Malaysia 
             9              4              8              4             10