7.4 Exercises
7.4.1 Exercise
Using the multivariable regression Shiny app, hack some p-values to prove to yourself the principle of multiple testing.
From the default position, select “additive model” then set “Error standard deviation” to 2. Leave all true effects at 0. How many clicks of “New Sample” did you need before you got a statistically significant result?
7.4.2 Exercise
Plot the GDP per capita by year for countries in Europe.
Add a best fit straight line to the plot.
In which countries is the relationship not linear?
Advanced: make the line curved by adding a quadratic/squared term, e.g., \(y~x^2+x\). Hint: check geom_smooth() help page under formula
.
7.4.3 Exercise
Compare the relationship between GDP per capita and year for two countries of your choice. If you can’t choose, make it Albania and Austria.
Fit and plot a regression model that simply averages the values across the two countries.
Fit and plot a best fit regression model.
Use your model to determine the difference in GDP per capita for your countries in 1980.
7.4.4 Exercise
Use the Western Collaborative Group Study data to determine if there is a relationship between age and cholesterol level.
Remember to plot the data first.
Make a simple regression model. Add other variables to adjust for potential confounding.