Brian Yarno
8/29/2017
This application provides a prediction of 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
Outputs
Example of Map
library(mapdata)
countries <- map('world', names = TRUE, plot = FALSE)
antarctica <- grep("^Antarctica", countries)
countries <- countries[-antarctica]
map('world', regions = countries)
plot(map('world', regions = c("Germany", "Italy", "Japan", "Belgium", "Canada"), fill = TRUE, col = "red", add = TRUE))
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
clust <- kmeans(LifeCycleSavings[names(LifeCycleSavings) %in% c("pop15", "pop75", "ddpi", "sr")], 7)
clust$cluster
Australia Austria Belgium Bolivia Brazil
5 7 7 2 4
Canada Chile China Colombia Costa Rica
5 6 4 2 4
Denmark Ecuador Finland France Germany
1 2 5 7 7
Greece Guatamala Honduras Iceland India
7 2 2 6 4
Ireland Italy Japan Korea Luxembourg
5 7 1 2 7
Malta Norway Netherlands New Zealand Nicaragua
1 7 1 5 2
Panama Paraguay Peru Philippines Portugal
2 6 4 4 1
South Africa South Rhodesia Spain Sweden Switzerland
5 5 5 7 7
Turkey Tunisia United Kingdom United States Venezuela
2 2 7 5 4
Zambia Jamaica Uruguay Libya Malaysia
4 3 5 3 2