Week 8 practice: Linear modeling and broom

To practice the new tests we’ve learned, we’ll use the built-in mtcars dataset.

Test Practice

correlation

What is the correlation between horsepower and weight? Is it significant?

### answer here


linear model

Plot

Plot a scatterplot of the rear axle ratio vs. fuel displacement. Does the relationship look linear?

### answer here 


Test

Since the relationship looks approximately linear, test it with lm()

### answer here


ANOVA

Do an ANOVA of quarter mile time over the number of cylinders in the the engine.

### answer here)


Now take the same ANOVA from the chunk above and add a post-hoc Tukey test to it.

### answer here


broom

Pick one of the three tests you did above and practice tidying it up with the three broom functions!


tidy()

Add tidy() onto end of your test.

### answer here


glance()

Add glance() onto the end of your test to look at the model parameters.

### answer here


augment()

Add the results of the test back to mtcars using augment()

### answer heres)


Use the augmented table from the chunk above to plot something.

### answer here



Come Up with Your Own Questions

Use the tests talked about this week, cor(), cor.test(), lm(), aov(), and/or TukeyHSD() to ask two more questions about the mtcars dataset.


Question 1

Plot

Look at mtcars again. What’s another question you could ask about it? Plot the variable(s) you’re interested in below

### answer here


Ask a Question

Based on the variables you just plotted, what’s your question?

Type your question here


Test

Pick one of the tests to answer your question and run it in the chunk below.

### answer here


Answer the Question

What do you conclude from your test?

Type your answer here


Question 2

Plot

Look at mtcars again. What’s another question you could ask about it? Plot the variable(s) you’re interested in below

### answer here


Ask a Question

Based on the variables you just plotted, what’s your question?

Type your question here Can displacement predict horsepower?


Test

Pick one of the tests to answer your question and run it in the chunk below.

### answer here


Answer the Question

What do you conclude from your test?

Type your answer here