View the CO2 dataset (last seen in Quiz 3.3) like a spreadsheet.
View(CO2)
Use ggplot2 to create a scatter plot with conc on the x-axis, uptake on the y-axis, where each point is colored according to its Type ("Quebec" vs "Mississippi"). Put the x-axis on a log scale.
ggplot(CO2, aes(x=conc, y=uptake, color=Type)) + geom_point() + scale_x_log10()
Based on this graph, does the Quebec or Mississippi grass, on average, have a higher CO2 uptake for a given concentration?
Quebec
Perform a multiple linear regression explaining CO2 uptake by both the log of the concentration and the Type variable. Save it to a variable called "mfit"
mfit = lm(uptake ~ log(conc) + Type, data=CO2)
View a summary of this multiple linear regression
summary(mfit)
Use ggplot2 to create a scatter plot with conc on the x-axis, uptake on the y-axis, where each point is colored according to its Type ("Quebec" vs "Mississippi") and the shape of each point (the "pch" or "shape" aesthetic) is determined by the Treatment ("chilled" vs "nonchilled"). Put the x-axis on a log scale.
ggplot(CO2, aes(x=conc, y=uptake, color=Type, shape=Treatment)) + geom_point() + scale_x_log10()
Perform a multiple linear regression explaining CO2 uptake by the log of the concentration and the Type and Treatment variables. Save it to a variable called "mfit2"
mfit2 = lm(uptake ~ log(conc) + Type + Treatment, data=CO2)
View a summary of this multiple linear regression
summary(mfit2)
What is the p-value of the "Treatment" variable in this regression?
1.11e-08
Based on this graph, what combination of treatment and type leads to the lowest CO2 uptake?
Mississippi+chilled