Write R code to perform the tasks below and obtain answers for the specific questions asked. Save the final R code in a single file. Once done, submit your answers by filling out this form, where you will also need to submit your R code.
Download the file annual.csv and read it into R as a data frame called climate
.
Using the R function cut()
, create a new column in climate
that converts the variable Volcano into a categorical variable called VolcanoF
with three levels called “low”, “medium”, and “high”. The first level should contain the lowest third of the data, the second should contain the middle third, and the third should contain the highest third of the data.
Fit the model Temp ~ CO2
. Report the p-value for CO2
and the value of R2 for the model.
Fit the model Temp ~ CH4
. Report the p-value for CH4
and the value of R2 for the model.
Fit the model Temp ~ VolcanoF
. Is VolcanoF
significant at level 0.05? Report the relevant p-value.
Fit a model with Temp
as response and main effects for CO2
and VolcanoF
as predictors.
Is VolcanoF
significant in the presence of CO2
at level 0.05? Report the relevant p-value.
Is CO2
significant in the presence of VolcanoF
at level 0.05? Report the relevant p-value.
Temp
as response and CO2
, NH4
, and NO2
as predictors.
CH4
significant at level 0.05 in the presence of the other predictors?NO2
significant at level 0.05 in the presence of the other predictors?CO2
significant at level 0.05 in the presence of the other predictors?NO2
and CO2
?