Warning: Parameter 2 to wp_hide_post_Public::query_posts_join() expected to be a reference, value given in /home/rexercis/public_html/wp-includes/class-wp-hook.php on line 286
Common problems with complex modeling analysis with R is that model results are often complex objects and getting to values, like model coefficients, demand a lot of manipulations; others vary from one model to another. Fortunately, the
broom package provides nice and easy to use solutions to the problem.
Answers to the exercises are available here.
Please do all exercises using the
tidiverse packages (mostly
ggplot2.) If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Reconstruct the plot from exercise 1, adding a prediction line.
Fit the data with inverse relations instead of a linear one. Like before, display the coefficients and add a prediction line to the plot. (Hint: use
Compare the performance of both models.
To evaluate the model stability, re-fit the better of the models 100 times with the bootstrap procedure and plot histograms of coefficients.
Plot the predictions from bootstrapped models.
Fit the model once again, but this time, separately for a different number of cylinders (
cyl variable). Plot the prediction for each group separately, plus the prediction from the previous model.
Display the model performance summaries. Compare the sum of deviance with a model not grouped by the number of cylinders.
Apply k-means on the
iris data set testing
k from 2 to 5. Display the performance summary for each number of clusters.
Petal.Width showing assignment to clusters and centers of the cluster.
- Become a Top R Programmer Fast with our Individual Coaching Program
- Explore all our (>4000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below