this linear model tries to answer to the question of how the unemployment rate affects the appareances of UFOS in the United States, the data gather here came from National UFO Reporting Center Report Index by State / Province src=http://www.nuforc.org/webreports/ndxloc.html
The unemployment rate came from : Unemployment rate src=http://www.bls.gov/web/laus/laumstrk.htm BLS
and then the population rate by state from the census.gov
Pop <- read.csv("Population.csv")
Ue <- read.csv("Unemployment.csv")
UFO <- read.csv("UFO.CSV")
# Merging the data first:Unemployment and Population and then PU with the amount of UFO reports
PU <- merge(Pop,Ue)
head(PU)
## State Population Rank Rate
## 1 ALABAMA 4,822,023 42 6.0
## 2 ALASKA 731,449 47 6.4
## 3 ARIZONA 6,553,255 46 6.3
## 4 CALIFORNIA 38,041,430 41 5.9
## 5 COLORADO 5,187,582 10 4.0
## 6 CONNECTICUT 3,590,347 28 5.2
UFPU <- merge(PU, UFO)
UFPU$Population <- as.numeric(UFPU$Population)
head(UFPU)
## State Population Rank Rate Count
## 1 ALABAMA 29 42 6.0 889
## 2 ALASKA 44 47 6.4 451
## 3 ARIZONA 38 46 6.3 3336
## 4 CALIFORNIA 25 41 5.9 11542
## 5 COLORADO 30 10 4.0 1938
## 6 CONNECTICUT 22 28 5.2 1217
plot(UFPU$Population,UFPU$Count)
plot(UFPU$Rate, UFPU$Count)
reg <-lm(Count~Rate+Population,data=UFPU)
summary(reg)
##
## Call:
## lm(formula = Count ~ Rate + Population, data = UFPU)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2214.7 -888.2 -572.9 305.2 9430.0
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 63.325 1344.161 0.047 0.963
## Rate 362.830 257.120 1.411 0.165
## Population -3.681 18.523 -0.199 0.843
##
## Residual standard error: 1924 on 46 degrees of freedom
## Multiple R-squared: 0.04159, Adjusted R-squared: -8.212e-05
## F-statistic: 0.998 on 2 and 46 DF, p-value: 0.3764
reg3 <-lm( Count~ Rate,data = UFPU)
summary(reg3)
##
## Call:
## lm(formula = Count ~ Rate, data = UFPU)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2265.4 -914.1 -537.6 232.1 9438.1
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8.982 1280.701 -0.007 0.994
## Rate 358.120 253.396 1.413 0.164
##
## Residual standard error: 1905 on 47 degrees of freedom
## Multiple R-squared: 0.04076, Adjusted R-squared: 0.02036
## F-statistic: 1.997 on 1 and 47 DF, p-value: 0.1642
library(ggplot2)
splot <- ggplot(aes(UFPU$Count,UFPU$Rate),data = UFPU)
splot + geom_point() + geom_smooth(method="lm")
cor(UFPU$Count,UFPU$Rate)
## [1] 0.2019033
You can also embed plots, for example:
plot(UFPU\(Rate,UFPU\)Count) abline(reg3)
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.