A Brief Study on US Unemployment and Wages using Quandl database

This document is written with R 3.3.1 using RMarkdown. For more information,please visit my homepage.

It was orginally created on 2016/11/03, and updated on 2016-11-11 13:59:36

Loading the economic and fiancnal data

## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 'data.frame':    108 obs. of  8 variables:
##  $ Date         : Date, format: "2007-07-01" "2007-08-01" ...
##  $ Unemployment : num  4.7 4.6 4.7 4.7 4.7 5 5 4.9 5.1 5 ...
##  $ Nonfarm      : num  138052 138028 138116 138201 138316 ...
##  $ Duration     : num  17.2 17 16.3 17 17.3 16.6 17.5 16.9 16.5 16.9 ...
##  $ CPI          : num  208 208 209 209 211 ...
##  $ Newhomeprice : num  307100 301300 292200 310100 316800 ...
##  $ Housepermit  : num  1354 1330 1183 1264 1197 ...
##  $ Hourlyearning: num  21 21 21 21.1 21.1 ...
##       Date             Unemployment      Nonfarm          Duration    
##  Min.   :2007-07-01   Min.   : 4.60   Min.   :129733   Min.   :16.30  
##  1st Qu.:2009-09-23   1st Qu.: 5.50   1st Qu.:132002   1st Qu.:26.52  
##  Median :2011-12-16   Median : 7.40   Median :136013   Median :32.60  
##  Mean   :2011-12-16   Mean   : 7.26   Mean   :135904   Mean   :30.66  
##  3rd Qu.:2014-03-08   3rd Qu.: 9.00   3rd Qu.:138418   3rd Qu.:36.98  
##  Max.   :2016-06-01   Max.   :10.00   Max.   :144172   Max.   :40.70  
##       CPI         Newhomeprice     Housepermit     Hourlyearning  
##  Min.   :207.6   Min.   :245200   Min.   : 478.0   Min.   :20.96  
##  1st Qu.:217.3   1st Qu.:271625   1st Qu.: 607.0   1st Qu.:22.30  
##  Median :227.5   Median :294950   Median : 874.0   Median :23.24  
##  Mean   :225.9   Mean   :302750   Mean   : 851.6   Mean   :23.29  
##  3rd Qu.:235.5   3rd Qu.:332300   3rd Qu.:1050.2   3rd Qu.:24.33  
##  Max.   :239.9   Max.   :384000   Max.   :1354.0   Max.   :25.62

Quick Summary of the Dataset:

There are total 108 number of observations for each variable, with time period from 2007-07-01 to 2016-06-01.

The Relationship Between Hourly Earning Ratio And Unemployment

library(xts)
library(ggplot2)
library(ggfortify)
data<- xts(data[,-1],as.Date(data$Date,format="%m/$d/%Y"))
autoplot(data[,c(1,7)],ts.colour = "blue",main="US Monthly Unemployment Rate and Hourly Earning ")

## Visualize the Unemp and Hourly Rate
library(ggvis)
## 
## Attaching package: 'ggvis'
## The following object is masked from 'package:ggplot2':
## 
##     resolution
data<-as.data.frame(data)
g<-ggvis(data,x=~Hourlyearning,y=~Unemployment,fill=~Duration) %>% layer_points() %>%layer_smooths() 
g

Correlation between Unemployment, Duration of Unemployment and Hourly Earning

ARIMA Analysis of Unemployment Rate

library(forecast)
## Loading required package: timeDate
## This is forecast 7.3
## 
## Attaching package: 'forecast'
## The following object is masked from 'package:ggfortify':
## 
##     gglagplot
data<-as.xts(data)
fit1<-auto.arima(data[,1])
summary(fit1)
## Series: data[, 1] 
## ARIMA(1,2,1)                    
## 
## Coefficients:
##           ar1      ma1
##       -0.1214  -0.7423
## s.e.   0.1212   0.0804
## 
## sigma^2 estimated as 0.02983:  log likelihood=36.27
## AIC=-66.53   AICc=-66.3   BIC=-58.54
## 
## Training set error measures:
##                        ME      RMSE       MAE       MPE     MAPE
## Training set 0.0001647617 0.1694724 0.1331492 0.1015715 1.917134
##                    MASE          ACF1
## Training set 0.01833965 -0.0007451305

Regression Analysis

data<-as.ts(data)
fit2<-lm(data[,1]~data[,-1],data=data)
summary(fit2)
## 
## Call:
## lm(formula = data[, 1] ~ data[, -1], data = data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.39850 -0.11465 -0.00175  0.11588  0.34735 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              6.146e+01  1.427e+00  43.058  < 2e-16 ***
## data[, -1]Nonfarm       -5.135e-04  1.715e-05 -29.940  < 2e-16 ***
## data[, -1]Duration      -3.808e-02  6.698e-03  -5.685 1.27e-07 ***
## data[, -1]CPI            4.941e-03  9.356e-03   0.528   0.5986    
## data[, -1]Newhomeprice  -2.135e-06  1.191e-06  -1.793   0.0760 .  
## data[, -1]Housepermit   -4.307e-04  1.926e-04  -2.236   0.0275 *  
## data[, -1]Hourlyearning  7.154e-01  5.558e-02  12.870  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1645 on 101 degrees of freedom
## Multiple R-squared:  0.9918, Adjusted R-squared:  0.9913 
## F-statistic:  2032 on 6 and 101 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fit2,las=0.8)