Let’s work through Example 3 in Section 11.4. This is the same data we analyzed in Table 3 from Section 11.3.
Table5 <- read.csv("https://sullystats.github.io/Statistics6e/Data/Chapter11/Table3.csv")
head(Table5,n=3)
## Flight Control
## 1 8.59 8.65
## 2 6.87 7.62
## 3 7.00 7.33
The syntax for the test is
var.test(data_frame\(*x*, *data_frame*\)y, alternative = “less”,“greater”,“two.sided”)
var.test(Table5$Flight,Table5$Control,alternative="two.sided")
##
## F test to compare two variances
##
## data: Table5$Flight and Table5$Control
## F = 1.024, num df = 13, denom df = 13, p-value = 0.9666
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.3287201 3.1897184
## sample estimates:
## ratio of variances
## 1.023975
The test statistic is \(F_0 = 1.024\) and the P-value is 0.9666.
Let’s use the Tornado_2017 data and determine if the variability in the length of Georgia tornadoes is greater than that of Louisiana.
Tornado <- read.csv("https://sullystats.github.io/Statistics6e/Data/Tornadoes_2017.csv")
Data_LA_GA <- subset(Tornado,State=="LA"|State=="GA") # The | means "or" in R
head(Data_LA_GA)
## Month Day Time State F.Scale Injuries Fatalities PropLoss Length Width
## 3 1 2 10:06:00 LA 1 0 0 25000 0.30 20
## 4 1 2 10:17:00 LA 1 0 0 50000 1.20 50
## 5 1 2 10:30:00 LA 1 0 0 20000 4.64 100
## 6 1 2 10:30:00 LA 1 0 0 150000 2.74 100
## 7 1 2 11:06:00 LA 1 0 0 50000 0.54 50
## 8 1 2 11:30:00 LA 0 0 0 75000 0.54 25
## NumberStates F0
## 3 1 No
## 4 1 No
## 5 1 No
## 6 1 No
## 7 1 No
## 8 1 Yes
install.packages("mosaic")
library(mosaic)
sd(Length~State,data=Data_LA_GA)
## GA LA
## 7.725883 4.048813
The sample standard deviation for length of tornadoes in Georgia is 7.73 miles; the sample standard deviation for length of tornadoes in Louisiana is 4.05 miles.
var.test(Length ~ State,data=Data_LA_GA,alternative="greater") #Mosaic not needed for this command.
##
## F test to compare two variances
##
## data: Length by State
## F = 3.6412, num df = 117, denom df = 86, p-value = 8.42e-10
## alternative hypothesis: true ratio of variances is greater than 1
## 95 percent confidence interval:
## 2.599724 Inf
## sample estimates:
## ratio of variances
## 3.641169
The test statistic is \(F_0 = 3.64\) and the P-value is 8.42e-10 (which is 0.000000000842).