-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLab_04_Regression.Rmd
More file actions
39 lines (25 loc) · 3.6 KB
/
Copy pathLab_04_Regression.Rmd
File metadata and controls
39 lines (25 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
title: "Lab 04 - Regression"
author: "EE375"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction
Anthropogenic carbon dioxide (CO2) is the CO2 produced by human activities such as fossil fuel combustion and cement production. Anthropogenic CO2 emissions vary around the world based on the density of human populations, and the intensity of CO2 producing activities in different countries. Your task is to find the best social indicators for predicting CO2 emissions. To do this, you will use data on the economies, societies, and physical characteristics of the world’s countries. This data is aggregated the World Bank and is available here: http://data.worldbank.org/. I have pulled together the most recent value available for each country for selected indicators into an Excel file available for download on Blackboard.
# Step 1: Data import and processing
Begin by opening the “World_Development_Indicators” Excel file. The “Data” sheet contains the data you will be working with, the “Variables Metadata” sheet contains descriptions of the variables you will be using, and some information about how these data were gathered. The “Country Metadata” sheet contains information about the countries included in this analysis, including the 3 letter country code used in the Data sheet.
1. Export the “Data” sheet of the Excel file to a .csv file (do this in Excel). When you export the file from Excel, make sure you name it “World_Development_Indicators.csv” so that I can knit your code when grading.
2. Load the file into RStudio using the read.csv function in R. Make sure to use the correct arguments in the read.csv call so that variable names are preserved and **missing values are read correctly** (hint: look back at the help for read.csv to understand how to set what character strings are converted to NA)! (Show code)
# Step 2: Hypotheses generation
3. In addition to CO2 emissions, there are several potential explanatory variables in this dataset. Using the information from the metadata sheets in the Excel file, write down your initial hypothesis about which variables you expect to affect per capita CO2 emissions and in what direction (i.e. whether the relationship will be positive, negative, or take on some other non-linear shape). **Propose at least 6 explanatory variables**
# Step 3: Exploratory data analysis
At this stage you'll want to look at univariate scatter plots and correlations between your explanatory variables and response variable.
4. Show the code to produce a series of *scatter plots* for each of your explanatory variables (x) versus per capita CO2 emissions (y). In words, describe the relationships you see. Do any of your response variables appear to be non-linear?
5. Show your code to generate a *table of correlations* between your candidate explanatory variables and per capita CO2 emissions. Are the strengths and directions of these correlations consistent with your hypotheses?
# Step 4: Univariate analyses
6. _For each of your explanatory variables_, in R **fit a linear regression** of that variable versus per capita CO2 emissions. Report the full table of regression statistics for each model. You should have at least 6 regression tables since you have at least 6 proposed variables.
7. Show the code that updates your **scatter plots with regression lines** for each candidate variable.
8. Were there any **variables that you would eliminate** because they were not significantly correlated with per capita CO2 emissions?
9. **What univariate model** would form the starting point for testing multivariate models and why?