University Solutions Hub provides Visual Analytics Week 9 solution
(Visual Analytics).
Week 9: working with models
- Using the gapminder data, create a plot comparing log(gdp PerCa with
Life Exp and show three different smoothers in three different colors
with a legend showing each smoother type.
- In a paragraph compare and contrast the smoother types. LOESS, Cubic
Spline, and OLS
- Look at the gapminder data with str()
- Create a linear model of the gapminder data with life expectancy as
the target of a multifactor model built from gdpPercap, pop, and
continent. Store it in a variable called ‘out’.
- print a summary of out.
- notice that printing a summary of gapminder will produce different
results because summary() knows that out is the output of a linear
model.
- Use min() and max() to get the minimum and maximum values of per
capita GDP and create a vector of 100 evenly spaced elements between
them while holding population constant at it’s median and showing the
values by continent using a vector..
- use predict() to calculate the fitted values for evey row in the
dataframe and show the upper and lower bounds of a 95% confidence
interval. Store the result in a variable predi_out.
- Use cbind() to bind the two data frames together by column.
- Look at the top six rows of the result with head()
- make an OLS plot the combined dataframes after subsetting continent
to Africa and Europe using geom_ribbon to show the prediction
intervals.
- What does the alpha aesthetic do?
Note:
Only for knowledge gain and helping to the students(who are facing
difficulties when solving to the Assessments/ Home works) with their
course support.