RMarkdown Test: Hiring in the US

Labor Hiring in US

Collecting, Cleaning, and Graphing

I used the following packages for this data venture.

The link to the data is shown below at the Bureau of Labor Statistics.

download <- "https://download.bls.gov/pub/time.series/jt/jt.data.3.Hires"
jt.hires <- read.csv(download, header = TRUE, sep = "\t")
jt.hires1 <- jt.hires %>% 
  filter(period == "M13") %>% 
  group_by(year) %>% 
  summarise(value = sum(value))

“M13” is the annual data: this figure is mixed with the monthly.

Plotting Hiring through the years

## `geom_smooth()` using method = 'loess'

The data includes a linear model using ggplot.

new_lm <- lm(jt.hires1, formula = value ~ year)
summary(new_lm)
## 
## Call:
## lm(formula = value ~ year, data = jt.hires1)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -52287 -16214   4881  21976  36740 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1509311.0  2780152.4   0.543    0.595
## year           -617.5     1383.8  -0.446    0.662
## 
## Residual standard error: 27950 on 15 degrees of freedom
## Multiple R-squared:  0.0131, Adjusted R-squared:  -0.05269 
## F-statistic: 0.1991 on 1 and 15 DF,  p-value: 0.6618
years <- c(2017, 2018, 2019)

Create a prediction model

Using a Linear Model, predict for years 2017, 2018, & 2019.

Somehow the prediction shows a dip from 2017 levelling through 2019.

tail(pred2)
## # A tibble: 6 x 2
##    year   value
##   <dbl>   <dbl>
## 1  2015 286010.
## 2  2016 291497.
## 3  2017 300594.
## 4  2017 263854.
## 5  2018 263237.
## 6  2019 262619.
pred2 <- filter(pred2, year > 2014)
ggplot(pred2, aes(x= year, y = value)) + geom_line() + labs(title = "New Graph with Predictions for 2017-2019",x = "Year", y = "Hiring Total") 

As per above there is trend downward in the prediction. Yet current data is showing that the economy is reaching full employment.

Also, the error of this model is that date is in integer form which I assume is an error affecting the model. Per the summary of the prediction model, it shows a really bad r2 number so the prediction is probably not reliable.

I should have used a time series model, but for my first RMarkdown this is just learning.

 

 

Leave a comment