Extensive research has been done on climate change and economic changes respectively but there is not a significant amount of research about their relation towards one another. There are research papers that touch on this but in different aspects and focus more on other factors like political aspects. I would like to look a little broader and look at the difference between each climate zone and their economic differences. This can be taken with a grain of salt as there are many factors that could effect the economic situation being left out. The data was pulled from NASA’s POWER data access viewer; here I pulled the data by region since pulling the whole country in one go was unavailable. Thus, I will conduct research on each region respectively and then compare the results. This study will be conducted on the Köppen climate classification scale to determine climate types for study. I will keep the this one the first level of the scale as further scaling would take significantly more time to process.
Köppen climate classification
There are three levels to this climate classification the first scale is the 5 main climate groups A(tropical), B(Arid), C(Temperate), D(Continental), and E(Polar), the second layer is the seasonal precipitation type, and the final layer indicates the heat levels. Through this three layer system that was created by Wladimir Köppen in 1884 we are able to accurately dial in on a specific climate type. getwd()
Research Questions
A. Is there a relation between climate zone and economic growth?
B. Do Southern climates have the largest economic growth?
Hypothesis
My hypothesis is testing if there is an impact since certain climates effect the type of labor, conditions, longevity of materials, abundance of materials, and it alters the level of difficult of human growth. This study will focus more on generating climate regions and comparing the economic status within each region and try to identify trends that are occurring. I believe the regions with the biggest economic growth would be the south with their flatter lands or the west coast since its climate is good for technological advances.
The hypothesis will be tested as follows:
H0A
Climate region differences will not be predictors of economical change.
H1A
Climate region differences will be predictors of economical change.
H0A
Southern climates will not show greater economic growth.
H1A
Southern climates will show greater economic growth.
Analytical Planning
flowchart LR
A[Importing Data] --> B(Data Cleaning)
B --> C[Descriptive Statistics]
C --> D(Hypothesis testing)
D --> E[Regression Analysis 1]
E --> F[Research Question 1]
F --> G{Conclusion}
D --> H[Regression Analysis 2]
H --> I[Research Question 2]
I --> G{Conclusion}
Library
Code
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.1.3
-- Attaching packages --------------------------------------- tidyverse 1.3.2 --
v ggplot2 3.3.6 v purrr 0.3.4
v tibble 3.1.8 v dplyr 1.0.9
v tidyr 1.2.0 v stringr 1.4.1
v readr 2.1.2 v forcats 0.5.2
Warning: package 'ggplot2' was built under R version 4.1.3
Warning: package 'tibble' was built under R version 4.1.3
Warning: package 'tidyr' was built under R version 4.1.3
Warning: package 'readr' was built under R version 4.1.3
Warning: package 'dplyr' was built under R version 4.1.3
Warning: package 'stringr' was built under R version 4.1.3
Warning: package 'forcats' was built under R version 4.1.3
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()
Code
library(dplyr)library(kableExtra)
Attaching package: 'kableExtra'
The following object is masked from 'package:dplyr':
group_rows
Code
library(lubridate)
Attaching package: 'lubridate'
The following objects are masked from 'package:base':
date, intersect, setdiff, union
Code
library(plyr)
Warning: package 'plyr' was built under R version 4.1.3
------------------------------------------------------------------------------
You have loaded plyr after dplyr - this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
------------------------------------------------------------------------------
Attaching package: 'plyr'
The following objects are masked from 'package:dplyr':
arrange, count, desc, failwith, id, mutate, rename, summarise,
summarize
The following object is masked from 'package:purrr':
compact
Had trouble with pivot_wider since it would split the values up by each name but then would fill in the values with NA for the other sections. This added a ton of NA values that one looked bad and were hard to deal with. I had to go a more manual way and do it for each part of PARAMETER to get the exact number of rows I needed. This stopped the NA values and got them all lined up so it reduced the size of the document from 500k+ rows to 89290 rows. This is huge in terms of running the data and working with it. Finally, I just merged the data together and then I was able to rename all the columns and start regression analysis.
Error in group_by(., Latitude, Longitude): object 'Weather_region_Amherst' not found
Code
# creating the mean value for each long and lat for each variableMeans_variables <-ddply(Weather_region_Amherst, .(Year, Latitude, Longitude), summarise,Annual_Temperature =mean(Temperature),Annual_Humidity =mean(Humidity),Annual_Precipitation =sum(Precipitation),Average_Pressure =mean(Surface_Pressure),Average_Wind_10Meter =mean(Wind_10_meter),Average_Wind_50Meter =mean(Wind_50_meter))
Error in empty(.data): object 'Weather_region_Amherst' not found
Code
# Creating the regions based on longitude and latitude Weather_region_Amherst <- Means_variables %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))
Error in is.data.frame(.data): object 'Means_variables' not found
Code
data <-merge(Means_variables, Economy)
Error in merge(Means_variables, Economy): object 'Means_variables' not found
Code
data <- data %>%distinct(Annual_Temperature, Annual_Humidity, Annual_Precipitation, Year_Money_Millions)
Error in UseMethod("distinct"): no applicable method for 'distinct' applied to an object of class "function"
Error in cor(data$Year_Money_Millions ~ data$Annual_Temperature): supply both 'x' and 'y' or a matrix-like 'x'
Code
test <-lm(Year_Money_Millions ~log(Annual_Temperature), data = data)
Error in model.frame.default(formula = Year_Money_Millions ~ log(Annual_Temperature), : 'data' must be a data.frame, environment, or list
Code
summary(test)
Error in summary(test): object 'test' not found
Code
plot(test)
Error in plot(test): object 'test' not found
Code
corrplot(data)
Error in corrplot(data): could not find function "corrplot"
Code
plot(Year_Money_Millions ~ Annual_Temperature + Annual_Humidity + Annual_Precipitation, data = data, col ="steelblue", pch =20, xlim =c(0, 100),cex.main =0.9,main ="Percentage of English language learners")
Error in FUN(X[[i]], ...): invalid 'envir' argument of type 'closure'
Year Month Latitude Longitude
Min. :1990 Length:88536 Min. :25.25 Min. :-85.75
1st Qu.:1997 Class :character 1st Qu.:26.75 1st Qu.:-83.75
Median :2005 Mode :character Median :28.50 Median :-81.75
Mean :2005 Mean :28.50 Mean :-81.75
3rd Qu.:2013 3rd Qu.:30.25 3rd Qu.:-79.75
Max. :2020 Max. :31.75 Max. :-77.75
Temperature Humidity Precipitation Surface_Pressure
Min. : 3.76 Min. :51.16 Min. : 0.030 Min. : 99.85
1st Qu.:20.46 1st Qu.:74.69 1st Qu.: 1.760 1st Qu.:101.45
Median :23.99 Median :77.32 Median : 3.050 Median :101.64
Mean :23.20 Mean :77.26 Mean : 3.529 Mean :101.61
3rd Qu.:27.24 3rd Qu.:80.12 3rd Qu.: 4.760 3rd Qu.:101.82
Max. :30.83 Max. :91.78 Max. :22.510 Max. :102.48
Wind_10_meter Wind_50_meter
Min. :1.24 Min. : 2.520
1st Qu.:3.51 1st Qu.: 4.660
Median :4.69 Median : 5.660
Mean :4.74 Mean : 5.719
3rd Qu.:5.95 3rd Qu.: 6.690
Max. :9.74 Max. :10.840
Weather_region_Florida <- Florida %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Florida
Year Month Latitude Longitude
Min. :1990 Length:66960 Min. :43.25 Min. :-102.75
1st Qu.:1997 Class :character 1st Qu.:44.25 1st Qu.:-100.75
Median :2005 Mode :character Median :45.50 Median : -98.50
Mean :2005 Mean :45.50 Mean : -98.50
3rd Qu.:2013 3rd Qu.:46.75 3rd Qu.: -96.25
Max. :2020 Max. :47.75 Max. : -94.25
Temperature Humidity Precipitation Surface_Pressure
Min. :-22.850 Min. :31.92 Min. : 0.010 Min. :89.54
1st Qu.: -2.780 1st Qu.:61.57 1st Qu.: 0.570 1st Qu.:94.45
Median : 7.450 Median :68.34 Median : 1.220 Median :95.83
Mean : 7.186 Mean :69.63 Mean : 1.615 Mean :95.46
3rd Qu.: 18.120 3rd Qu.:77.34 3rd Qu.: 2.340 3rd Qu.:96.79
Max. : 30.490 Max. :97.99 Max. :10.000 Max. :99.02
Wind_10_meter Wind_50_meter
Min. :3.130 Min. : 4.740
1st Qu.:4.690 1st Qu.: 6.660
Median :5.130 Median : 7.180
Mean :5.104 Mean : 7.155
3rd Qu.:5.520 3rd Qu.: 7.650
Max. :7.600 Max. :10.240
Weather_region_Illinois <- Illinois %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Illinois
Year Month Latitude Longitude
Min. :1990 Length:77748 Min. :38.25 Min. :-102.75
1st Qu.:1997 Class :character 1st Qu.:39.25 1st Qu.:-100.75
Median :2005 Mode :character Median :40.75 Median : -98.25
Mean :2005 Mean :40.75 Mean : -98.25
3rd Qu.:2013 3rd Qu.:42.25 3rd Qu.: -95.75
Max. :2020 Max. :43.25 Max. : -93.75
Temperature Humidity Precipitation Surface_Pressure
Min. :-14.92 Min. :32.96 Min. : 0.000 Min. :85.57
1st Qu.: 1.38 1st Qu.:58.52 1st Qu.: 0.690 1st Qu.:91.58
Median : 10.92 Median :66.34 Median : 1.540 Median :95.39
Mean : 10.92 Mean :66.23 Mean : 1.949 Mean :94.30
3rd Qu.: 20.83 3rd Qu.:74.14 3rd Qu.: 2.840 3rd Qu.:97.13
Max. : 32.89 Max. :96.56 Max. :15.870 Max. :99.52
Wind_10_meter Wind_50_meter
Min. :2.440 Min. : 3.890
1st Qu.:4.530 1st Qu.: 6.550
Median :5.030 Median : 7.160
Mean :4.994 Mean : 7.111
3rd Qu.:5.480 3rd Qu.: 7.710
Max. :7.450 Max. :10.050
Weather_region_Middle <- Middle %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Middle
Year Month Latitude Longitude
Min. :1990 Length:81840 Min. :32.75 Min. :-112.8
1st Qu.:1997 Class :character 1st Qu.:33.75 1st Qu.:-110.4
Median :2005 Mode :character Median :35.25 Median :-108.0
Mean :2005 Mean :35.25 Mean :-108.0
3rd Qu.:2013 3rd Qu.:36.75 3rd Qu.:-105.6
Max. :2020 Max. :37.75 Max. :-103.2
Temperature Humidity Precipitation Surface_Pressure
Min. :-14.10 Min. :11.31 Min. :0.0000 Min. :69.19
1st Qu.: 4.54 1st Qu.:38.12 1st Qu.:0.3000 1st Qu.:79.63
Median : 12.08 Median :46.83 Median :0.7200 Median :82.13
Mean : 12.43 Mean :46.47 Mean :0.9725 Mean :82.40
3rd Qu.: 20.55 3rd Qu.:54.76 3rd Qu.:1.3900 3rd Qu.:84.65
Max. : 36.19 Max. :95.05 Max. :8.0500 Max. :97.50
Wind_10_meter Wind_50_meter
Min. :1.630 Min. : 2.530
1st Qu.:3.240 1st Qu.: 4.750
Median :3.770 Median : 5.510
Mean :3.879 Mean : 5.638
3rd Qu.:4.460 3rd Qu.: 6.460
Max. :7.730 Max. :10.510
Weather_region_Newmexico <- New_Mexico %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Newmexico
North
Code
region <- North %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)North <-tidy_function(region)North <- North %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(North)
Year Month Latitude Longitude
Min. :1990 Length:74400 Min. :43.25 Min. :-113.2
1st Qu.:1997 Class :character 1st Qu.:44.25 1st Qu.:-110.9
Median :2005 Mode :character Median :45.50 Median :-108.5
Mean :2005 Mean :45.50 Mean :-108.5
3rd Qu.:2013 3rd Qu.:46.75 3rd Qu.:-106.1
Max. :2020 Max. :47.75 Max. :-103.8
Temperature Humidity Precipitation Surface_Pressure
Min. :-18.250 Min. :21.78 Min. :0.010 Min. :72.47
1st Qu.: -2.540 1st Qu.:53.77 1st Qu.:0.620 1st Qu.:81.50
Median : 5.350 Median :63.19 Median :1.090 Median :85.36
Mean : 6.032 Mean :64.19 Mean :1.318 Mean :85.14
3rd Qu.: 14.840 3rd Qu.:73.32 3rd Qu.:1.780 3rd Qu.:89.66
Max. : 28.130 Max. :99.59 Max. :8.280 Max. :94.15
Wind_10_meter Wind_50_meter
Min. :1.520 Min. : 2.780
1st Qu.:3.180 1st Qu.: 4.880
Median :4.080 Median : 5.950
Mean :4.042 Mean : 5.959
3rd Qu.:4.860 3rd Qu.: 6.960
Max. :8.080 Max. :10.790
Weather_region_North <- North %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_North
South
Code
region <- South %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)South <-tidy_function(region)South <- South %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(South)
Year Month Latitude Longitude
Min. :1990 Length:84816 Min. :32.25 Min. :-91.25
1st Qu.:1997 Class :character 1st Qu.:33.62 1st Qu.:-89.25
Median :2005 Mode :character Median :35.00 Median :-86.75
Mean :2005 Mean :35.00 Mean :-86.75
3rd Qu.:2013 3rd Qu.:36.38 3rd Qu.:-84.25
Max. :2020 Max. :37.75 Max. :-82.25
Temperature Humidity Precipitation Surface_Pressure
Min. :-5.29 Min. :36.84 Min. : 0.010 Min. : 92.41
1st Qu.: 8.10 1st Qu.:72.24 1st Qu.: 2.380 1st Qu.: 98.34
Median :15.73 Median :78.50 Median : 3.340 Median : 99.68
Mean :15.46 Mean :76.75 Mean : 3.612 Mean : 99.15
3rd Qu.:23.33 3rd Qu.:82.34 3rd Qu.: 4.570 3rd Qu.:100.43
Max. :32.63 Max. :92.29 Max. :16.850 Max. :102.22
Wind_10_meter Wind_50_meter
Min. :1.140 Min. :2.360
1st Qu.:1.980 1st Qu.:3.880
Median :2.430 Median :4.520
Mean :2.605 Mean :4.626
3rd Qu.:3.100 3rd Qu.:5.260
Max. :6.430 Max. :9.270
Weather_region_South <- South %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_South
Year Month Latitude Longitude
Min. :1990 Length:78120 Min. :33.75 Min. :-121.8
1st Qu.:1997 Class :character 1st Qu.:35.25 1st Qu.:-120.2
Median :2005 Mode :character Median :37.25 Median :-118.5
Mean :2005 Mean :37.25 Mean :-118.5
3rd Qu.:2013 3rd Qu.:39.25 3rd Qu.:-116.8
Max. :2020 Max. :40.75 Max. :-115.2
Temperature Humidity Precipitation Surface_Pressure
Min. :-8.91 Min. :11.89 Min. : 0.0000 Min. : 73.88
1st Qu.: 7.29 1st Qu.:33.86 1st Qu.: 0.1100 1st Qu.: 82.98
Median :13.43 Median :49.53 Median : 0.4100 Median : 89.04
Mean :13.38 Mean :50.99 Mean : 0.9714 Mean : 89.33
3rd Qu.:19.72 3rd Qu.:66.72 3rd Qu.: 1.1300 3rd Qu.: 96.48
Max. :35.71 Max. :97.56 Max. :19.2300 Max. :102.32
Wind_10_meter Wind_50_meter
Min. :1.65 Min. : 2.360
1st Qu.:2.80 1st Qu.: 3.900
Median :3.26 Median : 4.480
Mean :3.44 Mean : 4.632
3rd Qu.:3.79 3rd Qu.: 5.150
Max. :9.93 Max. :11.320
Weather_region_SouthCali <- South_California %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_SouthCali
Year Month Latitude Longitude
Min. :1990 Length:104160 Min. :29.25 Min. :-103.75
1st Qu.:1997 Class :character 1st Qu.:30.75 1st Qu.:-101.38
Median :2005 Mode :character Median :32.50 Median : -99.00
Mean :2005 Mean :32.50 Mean : -99.00
3rd Qu.:2013 3rd Qu.:34.25 3rd Qu.: -96.62
Max. :2020 Max. :35.75 Max. : -94.25
Temperature Humidity Precipitation Surface_Pressure
Min. :-2.62 Min. :14.00 Min. : 0.000 Min. : 84.89
1st Qu.:10.66 1st Qu.:52.22 1st Qu.: 0.750 1st Qu.: 92.21
Median :18.42 Median :62.76 Median : 1.710 Median : 96.59
Mean :17.99 Mean :62.28 Mean : 2.156 Mean : 95.64
3rd Qu.:25.80 3rd Qu.:73.30 3rd Qu.: 3.050 3rd Qu.: 99.23
Max. :35.35 Max. :94.14 Max. :33.700 Max. :102.51
Wind_10_meter Wind_50_meter
Min. :1.220 Min. :2.690
1st Qu.:3.840 1st Qu.:5.670
Median :4.470 Median :6.490
Mean :4.348 Mean :6.387
3rd Qu.:5.010 3rd Qu.:7.200
Max. :7.200 Max. :9.780
Weather_region_Texas <- Texas %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Texas
Washington
Code
region <- Washington %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)Washington <-tidy_function(region)Washington <- Washington %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(Washington)
Year Month Latitude Longitude
Min. :1990 Length:82212 Min. :41.75 Min. :-122.8
1st Qu.:1997 Class :character 1st Qu.:43.25 1st Qu.:-120.8
Median :2005 Mode :character Median :44.75 Median :-118.8
Mean :2005 Mean :44.75 Mean :-118.8
3rd Qu.:2013 3rd Qu.:46.25 3rd Qu.:-116.8
Max. :2020 Max. :47.75 Max. :-114.8
Temperature Humidity Precipitation Surface_Pressure
Min. :-14.040 Min. :20.81 Min. : 0.00 Min. :76.13
1st Qu.: 0.670 1st Qu.:55.59 1st Qu.: 0.63 1st Qu.:84.95
Median : 6.970 Median :70.02 Median : 1.35 Median :87.59
Mean : 7.653 Mean :68.57 Mean : 1.90 Mean :88.43
3rd Qu.: 14.840 3rd Qu.:82.60 3rd Qu.: 2.46 3rd Qu.:92.25
Max. : 28.950 Max. :99.83 Max. :19.67 Max. :99.34
Wind_10_meter Wind_50_meter
Min. :1.180 Min. :1.960
1st Qu.:2.160 1st Qu.:3.700
Median :2.860 Median :4.420
Mean :2.923 Mean :4.509
3rd Qu.:3.550 3rd Qu.:5.190
Max. :6.830 Max. :9.480
Weather_region_Washington <- Washington %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Washington
Year Month Latitude Longitude
Min. :1990 Length:74400 Min. :38.75 Min. :-92.25
1st Qu.:1997 Class :character 1st Qu.:39.75 1st Qu.:-89.88
Median :2005 Mode :character Median :41.00 Median :-87.50
Mean :2005 Mean :41.00 Mean :-87.50
3rd Qu.:2013 3rd Qu.:42.25 3rd Qu.:-85.12
Max. :2020 Max. :43.25 Max. :-82.75
Temperature Humidity Precipitation Surface_Pressure
Min. :-15.01 Min. :42.91 Min. : 0.070 Min. : 96.84
1st Qu.: 1.16 1st Qu.:74.30 1st Qu.: 1.620 1st Qu.: 98.52
Median : 10.68 Median :78.66 Median : 2.470 Median : 98.91
Mean : 10.17 Mean :78.26 Mean : 2.712 Mean : 98.89
3rd Qu.: 19.68 3rd Qu.:82.78 3rd Qu.: 3.500 3rd Qu.: 99.27
Max. : 31.10 Max. :96.86 Max. :11.770 Max. :100.75
Wind_10_meter Wind_50_meter
Min. :1.230 Min. : 2.73
1st Qu.:3.720 1st Qu.: 5.64
Median :4.600 Median : 6.69
Mean :4.527 Mean : 6.55
3rd Qu.:5.280 3rd Qu.: 7.43
Max. :9.630 Max. :10.79
Weather_region_WestV <- West_Virginia %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_WestV
State Economy data
The economic data is pulled from the Bureau of Economic Analysis (Analysis, n.d.). This data is the ins, outs, and the difference between the former two in income by state. The data ranges from 1990 to 2020 and covers every state in the US.
Code
# Reading in economic dataEconomy <-read.csv("_data/Economy.csv")# Renaming the columns to remove the XEconomy <- Economy %>% dplyr::rename('1990'= X1990) %>% dplyr::rename('1991'= X1991) %>% dplyr::rename('1992'= X1992) %>% dplyr::rename('1993'= X1993) %>% dplyr::rename('1994'= X1994) %>% dplyr::rename('1995'= X1995) %>% dplyr::rename('1996'= X1996) %>% dplyr::rename('1997'= X1997) %>% dplyr::rename('1998'= X1998) %>% dplyr::rename('1999'= X1999) %>% dplyr::rename('2000'= X2000) %>% dplyr::rename('2001'= X2001) %>% dplyr::rename('2002'= X2002) %>% dplyr::rename('2003'= X2003) %>% dplyr::rename('2004'= X2004) %>% dplyr::rename('2005'= X2005) %>% dplyr::rename('2006'= X2006) %>% dplyr::rename('2007'= X2007) %>% dplyr::rename('2008'= X2008) %>% dplyr::rename('2009'= X2009) %>% dplyr::rename('2010'= X2010) %>% dplyr::rename('2011'= X2011) %>% dplyr::rename('2012'= X2012) %>% dplyr::rename('2013'= X2013) %>% dplyr::rename('2014'= X2014) %>% dplyr::rename('2015'= X2015) %>% dplyr::rename('2016'= X2016) %>% dplyr::rename('2017'= X2017) %>% dplyr::rename('2018'= X2018) %>% dplyr::rename('2019'= X2019) %>% dplyr::rename('2020'= X2020) # Pivoting to combine all the years into one columnEconomy <- Economy %>%pivot_longer(cols =c('1990', '1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020'),names_to ="Year",values_to ="Yearly_Fianace",)## Change from char to numericEconomy$Year <-as.numeric(Economy$Year)# Changing the finance column to be in millionsEconomy <- Economy %>%mutate(Year_Money_Millions = Yearly_Fianace/1000)Economy <- Economy %>%select(State, Year, Year_Money_Millions, Description) %>%filter(Description =="Adjustment for residence")Economy <- Economy %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))
Error in eval_tidy(pair$lhs, env = default_env): object 'Latitude' not found
References
Analysis, B. o. (n.d.). Regional Economic Accounts: Download. Retrieved from BEA: https://apps.bea.gov/regional/downloadzip.cfm
Research, NASA Langley. The POWER Project. 08 May 2021. 21 February 2022. https://power.larc.nasa.gov.
(“These data were obtained from the NASA Langley Research Center (LaRC) POWER Project funded through the NASA Earth Science/Applied Science Program.”)
Source Code
---title: "Final Project"author: "Ethan Campbell"description: "Climate region effect on state economies"date: "10/15/2022"format: html: df-print: paged toc: true code-fold: true code-copy: true code-tools: true css: "styles.css"categories: - finalpart1---# IntroductionExtensive research has been done on climate change and economic changes respectively but there is not a significant amount of research about their relation towards one another. There are research papers that touch on this but in different aspects and focus more on other factors like political aspects. I would like to look a little broader and look at the difference between each climate zone and their economic differences. This can be taken with a grain of salt as there are many factors that could effect the economic situation being left out. The data was pulled from NASA's POWER data access viewer; here I pulled the data by region since pulling the whole country in one go was unavailable. Thus, I will conduct research on each region respectively and then compare the results. This study will be conducted on the Köppen climate classification scale to determine climate types for study. I will keep the this one the first level of the scale as further scaling would take significantly more time to process.## Köppen climate classificationThere are three levels to this climate classification the first scale is the 5 main climate groups A(tropical), B(Arid), C(Temperate), D(Continental), and E(Polar), the second layer is the seasonal precipitation type, and the final layer indicates the heat levels. Through this three layer system that was created by Wladimir Köppen in 1884 we are able to accurately dial in on a specific climate type. getwd() ![Climate Classification](/images/koppen.png)::: callout-note## Research QuestionsA. Is there a relation between climate zone and economic growth?B. Do Southern climates have the largest economic growth?:::# HypothesisMy hypothesis is testing if there is an impact since certain climates effect the type of labor, conditions, longevity of materials, abundance of materials, and it alters the level of difficult of human growth. This study will focus more on generating climate regions and comparing the economic status within each region and try to identify trends that are occurring. I believe the regions with the biggest economic growth would be the south with their flatter lands or the west coast since its climate is good for technological advances.The hypothesis will be tested as follows:::: callout-tip## H~0A~Climate region differences [will not]{.underline} be predictors of economical change.:::::: callout-tip## H~1A~Climate region differences [will]{.underline} be predictors of economical change.:::::: callout-tip## H~0A~Southern climates [will not]{.underline} show greater economic growth.:::::: callout-tip## H~1A~Southern climates [will]{.underline} show greater economic growth.:::# Analytical Planning```{mermaid}flowchart LR A[Importing Data] --> B(Data Cleaning) B --> C[Descriptive Statistics] C --> D(Hypothesis testing) D --> E[Regression Analysis 1] E --> F[Research Question 1] F --> G{Conclusion} D --> H[Regression Analysis 2] H --> I[Research Question 2] I --> G{Conclusion}```# Library```{r}library(tidyverse)library(dplyr)library(kableExtra)library(lubridate)library(plyr)```# Descriptive statistics## Reading in the dataData was collected```{r}# Reading in all the weather data Amherst <-read.csv("_data/amherst.csv", skip =14)Florida <-read.csv("_data/flordia.csv", skip =14)Illinois <-read.csv("_data/illinois.csv", skip =14)Middle <-read.csv("_data/middle.csv", skip =14)Newmexico <-read.csv("_data/Newmexico.csv", skip =14)North <-read.csv("_data/North.csv", skip =14)South <-read.csv("_data/South.csv", skip =14)SouthCali <-read.csv("_data/SouthCali.csv", skip =14)Texas <-read.csv("_data/Texas.csv", skip =14)Washington <-read.csv("_data/washington.csv", skip =14)WestV <-read.csv("_data/WestV.csv", skip =14)```### AmherstHad trouble with pivot_wider since it would split the values up by each name but then would fill in the values with NA for the other sections. This added a ton of NA values that one looked bad and were hard to deal with. I had to go a more manual way and do it for each part of PARAMETER to get the exact number of rows I needed. This stopped the NA values and got them all lined up so it reduced the size of the document from 500k+ rows to 89290 rows. This is huge in terms of running the data and working with it. Finally, I just merged the data together and then I was able to rename all the columns and start regression analysis.```{r}# Bringing all the month columns into one columnregion <- Amherst %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)# trying to create a function that would apply to all regionstidy_function <-function(region, Tidy_region, t2m, rh2m, wh10m, wh50m, PRECTOTCORR){ Tidy_region <- region %>%select(PARAMETER, Month_Average, YEAR, LAT, LON, MONTH) %>%filter(PARAMETER =='PS') Tidy_region <- Tidy_region %>%group_by(PARAMETER) %>% dplyr::mutate(row =row_number()) %>% tidyr::pivot_wider(names_from = PARAMETER, values_from = Month_Average) %>%select(-row) Tidy_region <- Tidy_region %>%select(PS, YEAR, MONTH, LAT, LON) t2m <- region %>%select(PARAMETER, Month_Average, YEAR) %>%filter(PARAMETER =='T2M') t2m <- t2m %>%group_by(PARAMETER) %>% dplyr::mutate(row =row_number()) %>% tidyr::pivot_wider(names_from = PARAMETER, values_from = Month_Average) %>%select(-row) t2m <- t2m %>%select(T2M, YEAR) Tidy_region$T2M <- t2m$T2M rh2m <- region %>%select(PARAMETER, Month_Average, YEAR, LAT) %>%filter(PARAMETER =='RH2M') rh2m <- rh2m %>%group_by(PARAMETER) %>% dplyr::mutate(row =row_number()) %>% tidyr::pivot_wider(names_from = PARAMETER, values_from = Month_Average) %>%select(-row) rh2m <- rh2m %>%select(RH2M, YEAR) Tidy_region$RH2M <- rh2m$RH2M wh10m <- region %>%select(PARAMETER, Month_Average, YEAR, LAT) %>%filter(PARAMETER =='WS10M') wh10m <- wh10m %>%group_by(PARAMETER) %>% dplyr::mutate(row =row_number()) %>% tidyr::pivot_wider(names_from = PARAMETER, values_from = Month_Average) %>%select(-row) wh10m <- wh10m %>%select(WS10M, YEAR) Tidy_region$WS10M <- wh10m$WS10M wh50m <- region %>%select(PARAMETER, Month_Average, YEAR, LAT) %>%filter(PARAMETER =='WS50M') wh50m <- wh50m %>%group_by(PARAMETER) %>% dplyr::mutate(row =row_number()) %>% tidyr::pivot_wider(names_from = PARAMETER, values_from = Month_Average) %>%select(-row) wh50m <- wh50m %>%select(WS50M, YEAR) Tidy_region$WS50M <- wh50m$WS50M PRECTOTCORR <- region %>%select(PARAMETER, Month_Average, YEAR, LAT) %>%filter(PARAMETER =='PRECTOTCORR') PRECTOTCORR <- PRECTOTCORR %>%group_by(PARAMETER) %>% dplyr::mutate(row =row_number()) %>% tidyr::pivot_wider(names_from = PARAMETER, values_from = Month_Average) %>%select(-row) PRECTOTCORR <- PRECTOTCORR %>%select(PRECTOTCORR, YEAR) Tidy_region$PRECTOTCORR <- PRECTOTCORR$PRECTOTCORR# renaming all the variables to easier to digest names Tidy_region <- Tidy_region %>% dplyr::rename(Temperature = T2M) %>% dplyr::rename(Humidity = RH2M) %>% dplyr::rename(Wind_10_meter = WS10M) %>% dplyr::rename(Surface_Pressure = PS) %>% dplyr::rename(Wind_50_meter = WS50M) %>% dplyr::rename(Precipitation = PRECTOTCORR) %>% dplyr::rename(Latitude = LAT) %>% dplyr::rename(Longitude = LON) %>% dplyr::rename(Month = MONTH) %>% dplyr::rename(Year = YEAR)}Amherst <-tidy_function(region)## Getting them in clean looking orderAmherst <- Amherst %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)Amherst <- Amherst %>%mutate(Temperature = Temperature*9/5+32)view_amherst <- Amherst %>%slice(1:10)kable(view_amherst, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Amherst Data") %>%kable_styling(font_size =16)# aggregate the months into 1 year# Converting abbreviation to normal wordWeather_region_Amherst$Month <-mapvalues(Weather_region_Amherst$Month, from =c("NOV", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "DEC"), to =c("November", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "December"))# Change word to numeric valueWeather_region_Amherst <- Weather_region_Amherst %>%mutate(Month =recode(Month,January =1,February =2,March =3,April =4,May =5,June =6,July =7,August =8,September =9,October =10,November =11,December =12))# Changing from year month to date columnWeather_region_Amherst$Date <-with(Weather_region_Amherst, ym(sprintf('%04d%02d', Year, Month)))Year <-format(as.Date(Weather_region_Amherst$Date), format ="%Y")Weather_region_Amherst %>%group_by(Latitude, Longitude) %>%mutate(Annual_Temperature =mean(Temperature),Annual_Humidity =mean(Humidity),Annual_Precipitation =sum(Precipitation))# creating the mean value for each long and lat for each variableMeans_variables <-ddply(Weather_region_Amherst, .(Year, Latitude, Longitude), summarise,Annual_Temperature =mean(Temperature),Annual_Humidity =mean(Humidity),Annual_Precipitation =sum(Precipitation),Average_Pressure =mean(Surface_Pressure),Average_Wind_10Meter =mean(Wind_10_meter),Average_Wind_50Meter =mean(Wind_50_meter))# Creating the regions based on longitude and latitude Weather_region_Amherst <- Means_variables %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))data <-merge(Means_variables, Economy)data <- data %>%distinct(Annual_Temperature, Annual_Humidity, Annual_Precipitation, Year_Money_Millions)cor(data$Year_Money_Millions ~ data$Annual_Temperature)test <-lm(Year_Money_Millions ~log(Annual_Temperature), data = data)summary(test)plot(test)corrplot(data)plot(Year_Money_Millions ~ Annual_Temperature + Annual_Humidity + Annual_Precipitation, data = data, col ="steelblue", pch =20, xlim =c(0, 100),cex.main =0.9,main ="Percentage of English language learners")# Creating weather types# Creating the 4 regions ```### Florida```{r}region <- Florida %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)Florida <-tidy_function(region)Florida <- Florida %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(Florida)view_Florida <- Florida %>%slice(1:10)kable(view_Florida, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Florida Data") %>%kable_styling(font_size =16)Weather_region_Florida <- Florida %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Florida```### Illinois```{r}region <- Illinois %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)Illinois <-tidy_function(region)Illinois <- Illinois %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(Illinois)view_Illinois <- Illinois %>%slice(1:10)kable(view_Illinois, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Illinois Data") %>%kable_styling(font_size =16)Weather_region_Illinois <- Illinois %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Illinois```### Middle```{r}region <- Middle %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)Middle <-tidy_function(region)Middle <- Middle %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(Middle)view_Middle <- Middle %>%slice(1:10)kable(view_Middle, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Middle Data") %>%kable_styling(font_size =16)Weather_region_Middle <- Middle %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Middle```### New Mexico```{r}region <- Newmexico %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)New_Mexico <-tidy_function(region)New_Mexico <- New_Mexico %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(New_Mexico)view_Newmexico <- New_Mexico %>%slice(1:10)kable(view_Newmexico, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Amherst Data") %>%kable_styling(font_size =16)Weather_region_Newmexico <- New_Mexico %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Newmexico```### North```{r}region <- North %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)North <-tidy_function(region)North <- North %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(North)view_North <- North %>%slice(1:10)kable(view_North, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Northern Data") %>%kable_styling(font_size =16)Weather_region_North <- North %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_North```### South```{r}region <- South %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)South <-tidy_function(region)South <- South %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(South)view_South <- South %>%slice(1:10)kable(view_South, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Southern Data") %>%kable_styling(font_size =16)Weather_region_South <- South %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_South```### South California```{r}region <- SouthCali %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)South_California <-tidy_function(region)South_California <- South_California %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(South_California)view_SouthCali <- South_California %>%slice(1:10)kable(view_SouthCali, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="South California Data") %>%kable_styling(font_size =16)Weather_region_SouthCali <- South_California %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_SouthCali```### Texas```{r}region <- Texas %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)Texas <-tidy_function(region)Texas <- Texas %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(Texas)view_Texas <- Texas %>%slice(1:10)kable(view_Texas, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Texas Data") %>%kable_styling(font_size =16)Weather_region_Texas <- Texas %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Texas```### Washington```{r}region <- Washington %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)Washington <-tidy_function(region)Washington <- Washington %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(Washington)view_Washington <- Washington %>%slice(1:10)kable(view_Washington, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="Washington Data") %>%kable_styling(font_size =16)Weather_region_Washington <- Washington %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_Washington```### West Virgina```{r}region <- WestV %>%pivot_longer(cols =c(NOV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC),names_to ="MONTH",values_to ="Month_Average",)West_Virginia <-tidy_function(region)West_Virginia <- West_Virginia %>%select(Year, Month, Latitude, Longitude, Temperature, Humidity, Precipitation, Surface_Pressure, Wind_10_meter, Wind_50_meter)summary(West_Virginia)view_WestV <- West_Virginia %>%slice(1:10)kable(view_WestV, digits =2, align ="ccccccc", col.names =c("Year", "Month", "Latitude", "Longitude", "Temperature", "Humidity", "Precipitation", "Surface Pressure", "Wind 10 Meters", "Wind 50 Meters"), caption ="West Virginia Data") %>%kable_styling(font_size =16)Weather_region_WestV <- West_Virginia %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))Weather_region_WestV```### State Economy dataThe economic data is pulled from the Bureau of Economic Analysis (Analysis, n.d.). This data is the ins, outs, and the difference between the former two in income by state. The data ranges from 1990 to 2020 and covers every state in the US.```{r}# Reading in economic dataEconomy <-read.csv("_data/Economy.csv")# Renaming the columns to remove the XEconomy <- Economy %>% dplyr::rename('1990'= X1990) %>% dplyr::rename('1991'= X1991) %>% dplyr::rename('1992'= X1992) %>% dplyr::rename('1993'= X1993) %>% dplyr::rename('1994'= X1994) %>% dplyr::rename('1995'= X1995) %>% dplyr::rename('1996'= X1996) %>% dplyr::rename('1997'= X1997) %>% dplyr::rename('1998'= X1998) %>% dplyr::rename('1999'= X1999) %>% dplyr::rename('2000'= X2000) %>% dplyr::rename('2001'= X2001) %>% dplyr::rename('2002'= X2002) %>% dplyr::rename('2003'= X2003) %>% dplyr::rename('2004'= X2004) %>% dplyr::rename('2005'= X2005) %>% dplyr::rename('2006'= X2006) %>% dplyr::rename('2007'= X2007) %>% dplyr::rename('2008'= X2008) %>% dplyr::rename('2009'= X2009) %>% dplyr::rename('2010'= X2010) %>% dplyr::rename('2011'= X2011) %>% dplyr::rename('2012'= X2012) %>% dplyr::rename('2013'= X2013) %>% dplyr::rename('2014'= X2014) %>% dplyr::rename('2015'= X2015) %>% dplyr::rename('2016'= X2016) %>% dplyr::rename('2017'= X2017) %>% dplyr::rename('2018'= X2018) %>% dplyr::rename('2019'= X2019) %>% dplyr::rename('2020'= X2020) # Pivoting to combine all the years into one columnEconomy <- Economy %>%pivot_longer(cols =c('1990', '1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020'),names_to ="Year",values_to ="Yearly_Fianace",)## Change from char to numericEconomy$Year <-as.numeric(Economy$Year)# Changing the finance column to be in millionsEconomy <- Economy %>%mutate(Year_Money_Millions = Yearly_Fianace/1000)Economy <- Economy %>%select(State, Year, Year_Money_Millions, Description) %>%filter(Description =="Adjustment for residence")Economy <- Economy %>%mutate(Regions =case_when( Latitude >=23.25& Latitude <=40.75& Longitude >=-95.5& Longitude <=-70.5~'Southeast', Latitude >=25& Latitude <=37& Longitude >=-114.75& Longitude <=-95.6~'Southwest', Latitude >=32.3& Latitude <=49& Longitude >=-124.36& Longitude <=-102~'West', Latitude >=39.7& Latitude <=47.4& Longitude >=-81& Longitude <=-66~'Northeast', Latitude >=35& Latitude <=49& Longitude >=-104& Longitude <=-80.5~'Midwest' ))```# References::: {#refs}- Analysis, B. o. (n.d.). Regional Economic Accounts: Download. Retrieved from BEA: https://apps.bea.gov/regional/downloadzip.cfm- Research, NASA Langley. The POWER Project. 08 May 2021. 21 February 2022. https://power.larc.nasa.gov.("These data were obtained from the NASA Langley Research Center (LaRC) POWER Project funded through the NASA Earth Science/Applied Science Program."):::