CUNY SPS R-WORKSHOP

Final Assignment

Tage N Singh

This Project use A Consolidate Dataset From 1969 to 1989 and is accessed from github.

The Question ? ?

– Is THERE CORRELATION ACROSS REGIONS/STATES (AND DC) IN THE US AMONG THE FOLLOWING : :

– US BIRTH RATES

– MEDIAN HOUSEHOLD INCOME

– PER CAPITA HOUSEHOLD INCOME

– US GROSS DEOMESTIC PRODUCT (GDP)

– FOR THE DECADES ENDING 1969, 1979,1989

– ( CURRENT DOLLARS)

- (:

library(datasets)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.3
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library("tidyverse")
## Warning: package 'tidyverse' was built under R version 4.0.3
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v tibble  3.0.6     v purrr   0.3.4
## v tidyr   1.1.2     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## Warning: package 'tibble' was built under R version 4.0.3
## Warning: package 'readr' was built under R version 4.0.3
## Warning: package 'forcats' was built under R version 4.0.3
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
popstatsURL <- ("https://raw.githubusercontent.com/tagensingh/SPS-WRKSHP-R-FINAL-PROJECT/master/1-SPS-Project-Consolidate-Data.csv")
popstatsURL <- ("1-SPS-Project-Consolidate-Data.csv")
popstats1 <- read.table(file =popstatsURL, header = TRUE , sep = ",")

summary(popstats1)
##   Region_Code        Region             State            State.Name       
##  Min.   : 1.000   Length:51          Length:51          Length:51         
##  1st Qu.: 3.000   Class :character   Class :character   Class :character  
##  Median : 5.000   Mode  :character   Mode  :character   Mode  :character  
##  Mean   : 5.667                                                           
##  3rd Qu.: 8.000                                                           
##  Max.   :11.000                                                           
##   X1969.Births     X1979.Births     X1989.Births    X1969.GDP.C.DLS 
##  Min.   :  5874   Min.   :  7292   Min.   :  6768   Min.   :  1798  
##  1st Qu.: 19306   1st Qu.: 19883   1st Qu.: 20201   1st Qu.:  4102  
##  Median : 47896   Median : 47389   Median : 50381   Median :  9622  
##  Mean   : 70569   Mean   : 68622   Mean   : 76741   Mean   : 18881  
##  3rd Qu.: 86444   3rd Qu.: 78964   3rd Qu.: 85797   3rd Qu.: 20260  
##  Max.   :352858   Max.   :379212   Max.   :533429   Max.   :107031  
##  X1979.GDP.C.DLS  X1989.GDP.C.DLS  X1969.Med.HH.Inc X1979.Med.HH.Inc
##  Min.   :  4399   Min.   : 10730   Min.   : 5221    Min.   :12096   
##  1st Qu.: 12505   1st Qu.: 27255   1st Qu.: 7132    1st Qu.:14770   
##  Median : 33496   Median : 65526   Median : 8199    Median :16647   
##  Mean   : 48812   Mean   :105217   Mean   : 8163    Mean   :16631   
##  3rd Qu.: 52526   3rd Qu.:120929   3rd Qu.: 9196    3rd Qu.:17804   
##  Max.   :293491   Max.   :722979   Max.   :11817    Max.   :25414   
##  X1989.Med.HH.Inc X1969.HH.Inc.Per.C.DLS X1979.HH.Inc.Per.C.DLS
##  Min.   :20136    Min.   :13935          Min.   :19675         
##  1st Qu.:25637    1st Qu.:18778          1st Qu.:23826         
##  Median :28706    Median :21370          Median :27088         
##  Mean   :29135    Mean   :21344          Mean   :26924         
##  3rd Qu.:31682    3rd Qu.:23969          3rd Qu.:28935         
##  Max.   :41721    Max.   :28124          Max.   :38693         
##  X1989.HH.Inc.Per.C.DLS
##  Min.   :20576         
##  1st Qu.:25369         
##  Median :28617         
##  Mean   :29348         
##  3rd Qu.:32433         
##  Max.   :43057

– Fixing The Headers

popstats2 <- popstats1

names(popstats2)[1] <- "Region_Code"
names(popstats2)[2] <- "Region_Name"
names(popstats2)[3] <- "State_Code"
names(popstats2)[4] <- "State_Name"
names(popstats2)[5] <- "Births_1969"
names(popstats2)[6] <- "Births_1979"
names(popstats2)[7] <- "Births_1989"
names(popstats2)[8] <- "GDP_1969"
names(popstats2)[9] <- "GDP_1979"
names(popstats2)[10] <- "GDP_1989"
names(popstats2)[11] <- "Median_HH_Inc_1969"
names(popstats2)[12] <- "Median_HH_Inc_1979"
names(popstats2)[13] <- "Median_HH_Inc_19689"
names(popstats2)[14] <- "Per_Capita_HH_Inc_1969"
names(popstats2)[15] <- "Per_Capita_HH_Inc_1979"
names(popstats2)[16] <- "Per_Capita_HH_Inc_1989"


head(popstats2, 6)
##   Region_Code Region_Name State_Code State_Name Births_1969 Births_1979
## 1          11        West         CA California      352858      379212
## 2          11        West         HI     Hawaii       15750       17568
## 3          11        West         NV     Nevada        8902       12293
## 4          10   Southeast         AL    Alabama       64068       61688
## 5          10   Southeast         FL    Florida      106926      120774
## 6          10   Southeast         GA    Georgia       91622       89582
##   Births_1989 GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 1      533429   106629   293491   722979               9302              18243
## 2       19051     4262    11869    29427              10675              20473
## 3       17894     2947    10295    27847               9505              18211
## 4       59917    11866    33712    68394               6419              13669
## 5      183968    27428    86263   241633               7168              14675
## 6      107023    18082    51550   133794               7346              15033
##   Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 1               35798                  26162                  31488
## 2               38829                  24418                  29381
## 3               31011                  25728                  32088
## 4               23597                  16773                  22374
## 5               27483                  22137                  27597
## 6               29021                  19111                  24302
##   Per_Capita_HH_Inc_1989
## 1                  34995
## 2                  33633
## 3                  32447
## 4                  24496
## 5                  31346
## 6                  29071

####Computing the correlation By State

popstats31 <- subset(popstats2, Region_Code == "1",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats32 <- subset(popstats2, Region_Code == "2",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats33 <- subset(popstats2, Region_Code == "3",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats34 <- subset(popstats2, Region_Code == "4",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats35 <- subset(popstats2, Region_Code == "5",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats36 <- subset(popstats2, Region_Code == "6",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats37 <- subset(popstats2, Region_Code == "7",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats38 <- subset(popstats2, Region_Code == "8",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats39 <- subset(popstats2, Region_Code == "9",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats40 <- subset(popstats2, Region_Code == "10",select=Region_Name:Per_Capita_HH_Inc_1989)
popstats41 <- subset(popstats2, Region_Code == "11",select=Region_Name:Per_Capita_HH_Inc_1989)



head(popstats31, 6)
##    Region_Name State_Code State_Name Births_1969 Births_1979 Births_1989
## 51    Far West         AK     Alaska        6824        9005       11105
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 51     2074    10891    23453              11817              25414
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 51               41408                  26966                  38693
##    Per_Capita_HH_Inc_1989
## 51                  37557
head(popstats32, 6)
##    Region_Name State_Code State_Name Births_1969 Births_1979 Births_1989
## 45 Great Lakes         IL   Illinois      193136      181153      181679
## 46 Great Lakes         IN    Indiana       94562       87380       81635
## 47 Great Lakes         MI   Michigan      163940      143237      137965
## 48 Great Lakes         MN  Minnesota       65958       65744       66409
## 49 Great Lakes         OH       Ohio      189544      167117      161647
## 50 Great Lakes         WI  Wisconsin       74044       72839       70385
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 45    60840   139253   266608               9706              19321
## 46    24212    57918   107199               8921              17582
## 47    47895   105413   190626               9997              19223
## 48    17681    46861    98313               8753              17761
## 49    52817   117117   217817               9279              17754
## 50    19521    50101    95217               8997              17680
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 45               32252                  25301                  30619
## 46               28797                  22224                  27111
## 47               31020                  24302                  29184
## 48               30909                  21993                  28284
## 49               28706                  23158                  27654
## 50               29442                  21949                  27494
##    Per_Capita_HH_Inc_1989
## 45                  32419
## 46                  28043
## 47                  30186
## 48                  30687
## 49                  28708
## 50                  28314
head(popstats33, 6)
##    Region_Name State_Code           State_Name Births_1969 Births_1979
## 37    Midsouth         DC District of Columbia       27780       20232
## 38    Midsouth         DE             Delaware       10116        9184
## 39    Midsouth         KY             Kentucky       58276       60030
## 40    Midsouth         MD             Maryland       60326       50980
## 41    Midsouth         NC       North Carolina       93956       84249
## 42    Midsouth         TN            Tennessee       73248       72148
##    Births_1989 GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 37       21351     8096    18417    37469               8283              16211
## 38       10959     3069     7304    18900               9309              17846
## 39       50381    13206    35838    65526               6537              13965
## 40       68083    17385    43628   107444              10101              20281
## 41       97868    20882    54515   133866               7025              14481
## 42       75595    15167    42194    91579               6631              14142
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 37               30727                  27813                  34012
## 38               34875                  23636                  28276
## 39               22534                  17555                  22692
## 40               39386                  25424                  31480
## 41               26647                  17910                  23281
## 42               24807                  17837                  23585
##    Per_Capita_HH_Inc_1989
## 37                  40268
## 38                  33812
## 39                  23786
## 40                  37813
## 41                  27480
## 42                  26136
head(popstats34, 6)
##    Region_Name State_Code   State_Name Births_1969 Births_1979 Births_1989
## 31     Midwest         IA         Iowa       47896       47321       38361
## 32     Midwest         KS       Kansas       35456       37419       37574
## 33     Midwest         MO     Missouri       81266       78562       78331
## 34     Midwest         ND North Dakota       11276       12752       11441
## 35     Midwest         NE     Nebraska       24806       26566       24266
## 36     Midwest         SD South Dakota       11276       12858       11253
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 31    12332    33496    52907               7880              16799
## 32     9166    26300    48814               7578              16362
## 33    21095    50601   101412               7672              15581
## 34     2178     7218    10730               6909              15293
## 35     6537    17423    31332               7426              15925
## 36     2273     6716    11790               6450              13156
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 31               26229                  20878                  27088
## 32               27291                  21204                  27901
## 33               26362                  21370                  26257
## 34               23213                  17874                  24359
## 35               26016                  20248                  26329
## 36               22503                  17280                  21626
##    Per_Capita_HH_Inc_1989
## 31                  26492
## 32                  28365
## 33                  27702
## 34                  23568
## 35                  26556
## 36                  22737
head(popstats35, 6)
##      Region_Name State_Code State_Name Births_1969 Births_1979 Births_1989
## 24 Mountain West         AZ    Arizona       34064       46714       65655
## 25 Mountain West         CO   Colorado       40100       47741       53518
## 26 Mountain West         ID      Idaho       13072       19533       15563
## 27 Mountain West         MT    Montana       11620       13804       11393
## 28 Mountain West         NM New Mexico       21316       24768       26686
## 29 Mountain West         UT       Utah       24810       42095       37021
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 24     7563    27495    67896               8199              16448
## 25     9480    33785    71179               8423              18056
## 26     2750     9286    16909               7482              15285
## 27     2761     8173    12630               7436              15420
## 28     4091    13141    24927               7096              14654
## 29     4036    13709    28668               8482              17671
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 24               27540                  21262                  26728
## 25               30140                  22485                  30360
## 26               25257                  19140                  23717
## 27               22988                  19517                  25012
## 28               24087                  17642                  23228
## 29               29470                  19524                  23934
##    Per_Capita_HH_Inc_1989
## 24                  28708
## 25                  31609
## 26                  24434
## 27                  23914
## 28                  23984
## 29                  23522
head(popstats36, 6)
##    Region_Name State_Code    State_Name Births_1969 Births_1979 Births_1989
## 18 New England         CT   Connecticut       49184       38445       48152
## 19 New England         MA Massachusetts       94852       72283       89958
## 20 New England         ME         Maine       17296       15810       16520
## 21 New England         NH New Hampshire       12288       12819       17053
## 22 New England         RI  Rhode Island       15854       12251       14689
## 23 New England         VT       Vermont        7778        7292        7871
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 18    15628    36855    95831              10877              20077
## 19    27476    62965   158200               9563              17575
## 20     3695     9335    22670               7315              13816
## 21     2817     8351    23777               8652              17013
## 22     4113     8845    21059               8617              16097
## 23     1798     4399    11120               7961              14790
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 18               41721                  28124                  32308
## 19               36952                  24671                  28311
## 20               27854                  18445                  21895
## 21               36329                  21609                  26443
## 22               32181                  22594                  26181
## 23               29792                  20067                  23452
##    Per_Capita_HH_Inc_1989
## 18                  43057
## 19                  36734
## 20                  27633
## 21                  34036
## 22                  31950
## 23                  28849
head(popstats37, 6)
##    Region_Name State_Code State_Name Births_1969 Births_1979 Births_1989
## 16  North West         OR     Oregon       34486       42870       41345
## 17  North West         WA Washington       59238       63819       71396
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 16     9353    28372    52610               8296              16780
## 17    18091    48713   108064               9125              18367
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 16               27250                  22789                  28686
## 17               31183                  24302                  30645
##    Per_Capita_HH_Inc_1989
## 16                  28617
## 17                  31826
head(popstats38, 6)
##    Region_Name State_Code   State_Name Births_1969 Births_1979 Births_1989
## 13   Northeast         NJ   New Jersey      113754       93370      114585
## 14   Northeast         NY     New York      311984      236975      281569
## 15   Northeast         PA Pennsylvania      186692      159073      166771
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 13    35852    81051   205075              10371              19800
## 14   107031   217725   473252               9268              16647
## 15    54486   120527   233162               8548              16880
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 13               40927                  26597                  30850
## 14               32965                  26119                  28462
## 15               29069                  22195                  26864
##    Per_Capita_HH_Inc_1989
## 13                  39911
## 14                  35192
## 15                  30003
head(popstats39, 6)
##      Region_Name State_Code State_Name Births_1969 Births_1979 Births_1989
## 9  South Central         AR   Arkansas       33400       35406       34139
## 10 South Central         LA  Louisiana       75092       79365       74236
## 11 South Central         OK   Oklahoma       41756       47389       46401
## 12 South Central         TX      Texas      226868      260561      307563
##    GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 9      6232    19099    37128               5356              12214
## 10    16321    51653    87574               6538              15227
## 11     9622    31546    55007               6596              14750
## 12    48575   171608   349952               7538              16708
##    Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 9                21147                  15506                  21311
## 10               21949                  16867                  24408
## 11               23577                  19502                  26033
## 12               27016                  20212                  27350
##    Per_Capita_HH_Inc_1989
## 9                   22436
## 10                  22681
## 11                  25364
## 12                  27520
head(popstats40, 6)
##   Region_Name State_Code     State_Name Births_1969 Births_1979 Births_1989
## 4   Southeast         AL        Alabama       64068       61688       59917
## 5   Southeast         FL        Florida      106926      120774      183968
## 6   Southeast         GA        Georgia       91622       89582      107023
## 7   Southeast         MS    Mississippi       47102       45628       41269
## 8   Southeast         SC South Carolina       49182       48631       53003
##   GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 4    11866    33712    68394               6419              13669
## 5    27428    86263   241633               7168              14675
## 6    18082    51550   133794               7346              15033
## 7     6801    20011    37209               5221              12096
## 8     8874    25507    61347               6835              14711
##   Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 4               23597                  16773                  22374
## 5               27483                  22137                  27597
## 6               29021                  19111                  24302
## 7               20136                  13935                  19675
## 8               26256                  16672                  22343
##   Per_Capita_HH_Inc_1989
## 4                  24496
## 5                  31346
## 6                  29071
## 7                  20576
## 8                  25373
head(popstats41, 6)
##   Region_Name State_Code State_Name Births_1969 Births_1979 Births_1989
## 1        West         CA California      352858      379212      533429
## 2        West         HI     Hawaii       15750       17568       19051
## 3        West         NV     Nevada        8902       12293       17894
##   GDP_1969 GDP_1979 GDP_1989 Median_HH_Inc_1969 Median_HH_Inc_1979
## 1   106629   293491   722979               9302              18243
## 2     4262    11869    29427              10675              20473
## 3     2947    10295    27847               9505              18211
##   Median_HH_Inc_19689 Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979
## 1               35798                  26162                  31488
## 2               38829                  24418                  29381
## 3               31011                  25728                  32088
##   Per_Capita_HH_Inc_1989
## 1                  34995
## 2                  33633
## 3                  32447

Plotting the graphs

library("ggpubr")


regionsURL <- ("https://raw.githubusercontent.com/tagensingh/SPS-WRKSHP-R-FINAL-PROJECT/master/Regions_Totals.csv")
regionsURL <- ("Regions_Totals.csv")
regions <- read.table(file =regionsURL, header = TRUE , sep = ",")

summary(regions)
##     Region           X1969.Births      X1979.Births      X1989.Births    
##  Length:11          Min.   :  93724   Min.   : 106689   Min.   : 112741  
##  Class :character   1st Qu.: 204614   1st Qu.: 209594   1st Qu.: 208915  
##  Mode  :character   Median : 377116   Median : 400970   Median : 445180  
##                     Mean   : 654370   Mean   : 636316   Mean   : 711597  
##                     3rd Qu.: 521847   3rd Qu.: 456070   3rd Qu.: 572202  
##                     Max.   :3599036   Max.   :3499737   Max.   :3913786  
##  X1969.GDP.C.DLS  X1979.GDP.C.DLS   X1989.GDP.C.DLS   X1969.Med.HH.Inc
##  Min.   : 27444   Min.   :  77085   Min.   : 160674   Min.   : 17421  
##  1st Qu.: 54554   1st Qu.: 136252   1st Qu.: 294821   1st Qu.: 30588  
##  Median : 80750   Median : 272718   Median : 542377   Median : 43915  
##  Mean   :175074   Mean   : 452622   Mean   : 975651   Mean   : 75690  
##  3rd Qu.:156641   3rd Qu.: 372925   3rd Qu.: 857598   3rd Qu.: 55403  
##  Max.   :962906   Max.   :2489420   Max.   :5366083   Max.   :416296  
##  X1979.Med.HH.Inc X1989.Med.HH.Inc  X1969.HH.Inc.Per.C.DLS
##  Min.   : 35147   Min.   :  58433   Min.   :  47091       
##  1st Qu.: 64542   1st Qu.: 114727   1st Qu.:  81770       
##  Median : 93116   Median : 151614   Median : 118853       
##  Mean   :154218   Mean   : 270158   Mean   : 197921       
##  3rd Qu.:113425   3rd Qu.: 195704   3rd Qu.: 139727       
##  Max.   :848196   Max.   :1485868   Max.   :1088566       
##  X1979.HH.Inc.Per.C.DLS X1989.HH.Inc.Per.C.DLS
##  Min.   :  59332        Min.   :  60443       
##  1st Qu.: 107696        1st Qu.: 117984       
##  Median : 153560        Median : 155421       
##  Mean   : 249662        Mean   : 272136       
##  3rd Qu.: 176708        3rd Qu.: 192343       
##  Max.   :1373139        Max.   :1496750
names(regions)[1] <- "Region"
names(regions)[2] <- "Births_1969"
names(regions)[3] <- "Births_1979"
names(regions)[4] <- "Births_1989"
names(regions)[5] <- "GDP_1969"
names(regions)[6] <- "GDP_1979"
names(regions)[7] <- "GDP_1989"
names(regions)[8] <- "Median_HH_Inc_1969"
names(regions)[9] <- "Median_HH_Inc_1979"
names(regions)[10] <- "Median_HH_Inc_1989"
names(regions)[11] <- "Per_Capita_HH_Inc_1969"
names(regions)[12] <- "Per_Capita_HH_Inc_1979"
names(regions)[13] <- "Per_Capita_HH_Inc_1989"

print("The Summary Table by Region is as follows")
## [1] "The Summary Table by Region is as follows"
summary(regions)
##     Region           Births_1969       Births_1979       Births_1989     
##  Length:11          Min.   :  93724   Min.   : 106689   Min.   : 112741  
##  Class :character   1st Qu.: 204614   1st Qu.: 209594   1st Qu.: 208915  
##  Mode  :character   Median : 377116   Median : 400970   Median : 445180  
##                     Mean   : 654370   Mean   : 636316   Mean   : 711597  
##                     3rd Qu.: 521847   3rd Qu.: 456070   3rd Qu.: 572202  
##                     Max.   :3599036   Max.   :3499737   Max.   :3913786  
##     GDP_1969         GDP_1979          GDP_1989       Median_HH_Inc_1969
##  Min.   : 27444   Min.   :  77085   Min.   : 160674   Min.   : 17421    
##  1st Qu.: 54554   1st Qu.: 136252   1st Qu.: 294821   1st Qu.: 30588    
##  Median : 80750   Median : 272718   Median : 542377   Median : 43915    
##  Mean   :175074   Mean   : 452622   Mean   : 975651   Mean   : 75690    
##  3rd Qu.:156641   3rd Qu.: 372925   3rd Qu.: 857598   3rd Qu.: 55403    
##  Max.   :962906   Max.   :2489420   Max.   :5366083   Max.   :416296    
##  Median_HH_Inc_1979 Median_HH_Inc_1989 Per_Capita_HH_Inc_1969
##  Min.   : 35147     Min.   :  58433    Min.   :  47091       
##  1st Qu.: 64542     1st Qu.: 114727    1st Qu.:  81770       
##  Median : 93116     Median : 151614    Median : 118853       
##  Mean   :154218     Mean   : 270158    Mean   : 197921       
##  3rd Qu.:113425     3rd Qu.: 195704    3rd Qu.: 139727       
##  Max.   :848196     Max.   :1485868    Max.   :1088566       
##  Per_Capita_HH_Inc_1979 Per_Capita_HH_Inc_1989
##  Min.   :  59332        Min.   :  60443       
##  1st Qu.: 107696        1st Qu.: 117984       
##  Median : 153560        Median : 155421       
##  Mean   : 249662        Mean   : 272136       
##  3rd Qu.: 176708        3rd Qu.: 192343       
##  Max.   :1373139        Max.   :1496750
head(regions,12)
##           Region Births_1969 Births_1979 Births_1989 GDP_1969 GDP_1979 GDP_1989
## 1    Great Lakes      781184      717470      699720   222966   516663   975780
## 2       Midsouth      431264      400970      437329   103824   272718   619108
## 3        Midwest      211976      215478      201226    53581   141754   256985
## 4  Mountain West      150856      203710      216604    32482   113652   233646
## 5    New England      197252      158900      194243    55527   130750   332657
## 6     North West       93724      106689      112741    27444    77085   160674
## 7      Northeast      612430      489418      562925   197369   419303   911489
## 8  South Central      377116      422721      462339    80750   273906   529661
## 9      Southeast      358900      366303      445180    73051   217043   542377
## 10          West      384334      418078      581479   115912   326546   803706
## 11 United States     3599036     3499737     3913786   962906  2489420  5366083
##    Median_HH_Inc_1969 Median_HH_Inc_1979 Median_HH_Inc_1989
## 1               55653             109321             181126
## 2               62666             128965             233099
## 3               43915              93116             151614
## 4               55153             117528             186578
## 5               52985              99368             204829
## 6               17421              35147              58433
## 7               28187              53327             102961
## 8               26028              58899              93689
## 9               32989              70184             126493
## 10              41299              82341             147046
## 11             416296             848196            1485868
##    Per_Capita_HH_Inc_1969 Per_Capita_HH_Inc_1979 Per_Capita_HH_Inc_1989
## 1               138927.49              170345.50              178357.70
## 2               168752.99              215024.42              245241.31
## 3               118853.19              153559.59              155420.51
## 4               140527.35              183069.69              182426.89
## 5               135510.58              158589.29              202258.87
## 6                47091.00               59331.48               60442.85
## 7                74911.24               86176.79              105105.85
## 8                72087.95               99102.17               98001.83
## 9                88629.53              116290.46              130862.47
## 10              103274.43              131649.08              138631.90
## 11             1088565.74             1373138.47             1496750.19
ggscatter(regions, x = "Births_1969", y = "GDP_1969", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1969", ylab = "GDP 1969")
## `geom_smooth()` using formula 'y ~ x'

##

ggscatter(regions, x = "Births_1969", y = "Median_HH_Inc_1969", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1969", ylab = "Median HH Inc 1969")
## `geom_smooth()` using formula 'y ~ x'

##

ggscatter(regions, x = "Births_1969", y = "Per_Capita_HH_Inc_1969", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1969", ylab = "Per Capita HH Inc 1969")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(regions, x = "Births_1979", y = "GDP_1979", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1979", ylab = "GDP 1979")
## `geom_smooth()` using formula 'y ~ x'

##

ggscatter(regions, x = "Births_1979", y = "Median_HH_Inc_1979", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1979", ylab = "Median HH Inc 1979")
## `geom_smooth()` using formula 'y ~ x'

##

ggscatter(regions, x = "Births_1979", y = "Per_Capita_HH_Inc_1979", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1979", ylab = "Per Capita HH Inc 1979")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(regions, x = "Births_1989", y = "GDP_1989", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1989", ylab = "GDP 1989")
## `geom_smooth()` using formula 'y ~ x'

##

ggscatter(regions, x = "Births_1989", y = "Median_HH_Inc_1989", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1989", ylab = "Median HH Inc 1989")
## `geom_smooth()` using formula 'y ~ x'

##

ggscatter(regions, x = "Births_1989", y = "Per_Capita_HH_Inc_1989", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Births 1989", ylab = "Per Capita HH Inc 1989")
## `geom_smooth()` using formula 'y ~ x'

## - Births 1969 to GDP 1969
b1969_g1969 <- cor.test(regions$Births_1969, regions$GDP_1969, 
                    method = "pearson")
b1969_g1969
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1969 and regions$GDP_1969
## t = 49.725, df = 9, p-value = 2.699e-12
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9927624 0.9995458
## sample estimates:
##      cor 
## 0.998185
## - Births 1969 to Median HH Income 1969
b1969_medhh_1969 <- cor.test(regions$Births_1969, regions$Median_HH_Inc_1969, 
                    method = "pearson")
b1969_medhh_1969
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1969 and regions$Median_HH_Inc_1969
## t = 13.443, df = 9, p-value = 2.911e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9073386 0.9939410
## sample estimates:
##       cor 
## 0.9759915
## - Births 1969 to GDP Per Capita HH Income
b1969_percaphh1969 <- cor.test(regions$Births_1969, regions$Per_Capita_HH_Inc_1969, 
                    method = "pearson")
b1969_percaphh1969
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1969 and regions$Per_Capita_HH_Inc_1969
## t = 13.399, df = 9, p-value = 2.995e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9067686 0.9939020
## sample estimates:
##       cor 
## 0.9758384
########

## - Births 1979 to GDP 1979
b1979_g1979 <- cor.test(regions$Births_1979, regions$GDP_1979, 
                    method = "pearson")
b1979_g1979
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1979 and regions$GDP_1979
## t = 64.869, df = 9, p-value = 2.482e-13
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9957378 0.9997329
## sample estimates:
##       cor 
## 0.9989323
## - Births 1969 to Median HH Income 1969
b1979_medhh_1979 <- cor.test(regions$Births_1979, regions$Median_HH_Inc_1979, 
                    method = "pearson")
b1979_medhh_1979
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1979 and regions$Median_HH_Inc_1979
## t = 14.636, df = 9, p-value = 1.396e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9209713 0.9948667
## sample estimates:
##       cor 
## 0.9796316
## - Births 1969 to GDP Per Capita HH Income
b1979_percaphh1979 <- cor.test(regions$Births_1979, regions$Per_Capita_HH_Inc_1979, 
                    method = "pearson")
b1979_percaphh1979
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1979 and regions$Per_Capita_HH_Inc_1979
## t = 14.626, df = 9, p-value = 1.404e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9208747 0.9948602
## sample estimates:
##       cor 
## 0.9796059
#######


## - Births 1979 to GDP 1979
b1989_g1989 <- cor.test(regions$Births_1989, regions$GDP_1989, 
                    method = "pearson")
b1989_g1989
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1989 and regions$GDP_1989
## t = 66.616, df = 9, p-value = 1.955e-13
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9959577 0.9997467
## sample estimates:
##       cor 
## 0.9989875
## - Births 1989 to Median HH Income 1989
b1989_medhh_1989 <- cor.test(regions$Births_1989, regions$Median_HH_Inc_1989, 
                    method = "pearson")
b1989_medhh_1989
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1989 and regions$Median_HH_Inc_1989
## t = 14.217, df = 9, p-value = 1.796e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9165398 0.9945671
## sample estimates:
##       cor 
## 0.9784525
## - Births 1989 to GDP Per Capita HH Income
b1989_percaphh1989 <- cor.test(regions$Births_1989, regions$Per_Capita_HH_Inc_1989, 
                    method = "pearson")
b1989_percaphh1989
## 
##  Pearson's product-moment correlation
## 
## data:  regions$Births_1989 and regions$Per_Capita_HH_Inc_1989
## t = 14.133, df = 9, p-value = 1.89e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9156109 0.9945042
## sample estimates:
##       cor 
## 0.9782049

– From the graphs and correlation calculations–

THERE IS POSITIVE CORRELTATION BETWEEN THE BIRTHS AND GDP, MEDIAN HOUSEHOLD INCOME AND PER CAPITA HOUSEHOLD INCOME