First I installed the necessary packages.

Then I read in the State Indicator file.

I retained only the continuous variables.

statdata3 <- statedata2 %>% select (Population, Income, Illiteracy, LifeExp, Murder, HSGrad)

I loaded the cormat functions and computed the correlations and correlogram for the six variables.

## $r
##            LifeExp Income HSGrad Population Illiteracy Murder
## LifeExp          1                                           
## Income        0.34      1                                    
## HSGrad        0.58   0.62      1                             
## Population  -0.068   0.21 -0.098          1                  
## Illiteracy   -0.59  -0.44  -0.66       0.11          1       
## Murder       -0.78  -0.23  -0.49       0.34        0.7      1
## 
## $p
##            LifeExp  Income  HSGrad Population Illiteracy Murder
## LifeExp          0                                             
## Income       0.016       0                                     
## HSGrad     9.2e-06 1.6e-06       0                             
## Population    0.64    0.15     0.5          0                  
## Illiteracy   7e-06  0.0015 2.2e-07       0.46          0       
## Murder     2.3e-11    0.11 0.00032      0.015    1.3e-08      0
## 
## $sym
##            LifeExp Income HSGrad Population Illiteracy Murder
## LifeExp    1                                                 
## Income     .       1                                         
## HSGrad     .       ,      1                                  
## Population                       1                           
## Illiteracy .       .      ,                 1                
## Murder     ,              .      .          ,          1     
## attr(,"legend")
## [1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1

The following plot demonstrates the relationship between HS Grad and Income.

The following plot demonstrates the relationship between Illiteracy and Income

The following is a scatterplot of Murder by Illiteracy group by HSGrad

The null hypothesis is that there is no difference in Income between states above median HSGrad and states less than or equal to median HSGrad. I have to first find the mean of HS Grad and then recode the variable for less than or equal or above the mean. I ran a t-test. The \(\alpha\) = 0.05. I would fail to reject the null hypothesis because the p-value is 0.055, which is greater than \(\alpha\).

## 
##  0  1 
## 25 25
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.0     0.0     0.5     0.5     1.0     1.0
## 
##  Two Sample t-test
## 
## data:  Income by statdata3$HSGrad
## t = -1.9642, df = 48, p-value = 0.05531
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -671.518476    7.838476
## sample estimates:
## mean in group 0 mean in group 1 
##         4269.88         4601.72

The null hypothesis is that there is no difference in Murder between one group of states (to include Alabama, Alaska, Arkansas, Georgia, Illinois, Kentucky, Louisiana, Mississippi, and Michigan) and another group of states (Arizona, Connecticut, Iowa, Kansas, Maine, Minnesota, Nebraska, New Hampshire, North Dakota). I have to create a variable for the first set of states and another variable for the second set of states. Then combine the data of the two variables. Next, I ran a t-test. The \(\alpha\) = 0.05. I would reject the null hypothesis because the p-value is 2.392e-08, which is less than \(\alpha\).

## 
##  Welch Two Sample t-test
## 
## data:  state1a$Murder and state2a$Murder
## t = 10.124, df = 15.943, p-value = 2.393e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   6.833892 10.454997
## sample estimates:
## mean of x mean of y 
## 12.011111  3.366667