Moment of Impact

Directions

Brace myself for the impact!

Comparing variances using the F-test.

Data for demo

Back to the spellbook

1. Load data

##   ï..Pile_Number Pile_Length_Estimated Pile_Length_Actual
## 1              1                 10.58              18.58
## 2              2                 10.58              18.58
## 3              3                 10.58              18.58
## 4              4                 10.58              18.58
## 5              5                 10.58              28.58
## 6              6                 10.58              26.58

Change the column names.

##   Number Estimated_Length Actual_Length
## 1      1            10.58         18.58
## 2      2            10.58         18.58
## 3      3            10.58         18.58
## 4      4            10.58         18.58
## 5      5            10.58         28.58
## 6      6            10.58         26.58

2. F test

2-sided test.

H0: Variance of Pile_Length_Estimated = Variance of Pile_Length_Actual.

H1: Variance of Pile_Length_Estimated <> Variance of Pile_Length_Actual.

## 
##  F test to compare two variances
## 
## data:  pile$Estimated_Length and pile$Actual_Length
## F = 0.95805, num df = 310, denom df = 310, p-value = 0.7062
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.7665136 1.1974461
## sample estimates:
## ratio of variances 
##          0.9580495

1-sided test upper.

H0: Variance of Pile_Length_Estimated <= Variance of Pile_Length_Actual.

H1: Variance of Pile_Length_Estimated > Variance of Pile_Length_Actual.

## 
##  F test to compare two variances
## 
## data:  pile$Estimated_Length and pile$Actual_Length
## F = 0.95805, num df = 310, denom df = 310, p-value = 0.6469
## alternative hypothesis: true ratio of variances is greater than 1
## 95 percent confidence interval:
##  0.7945451       Inf
## sample estimates:
## ratio of variances 
##          0.9580495

1-sided test lower

H0: Variance of Pile_Length_Estimated >= Variance of Pile_Length_Actual.

H1: Variance of Pile_Length_Estimated < Variance of Pile_Length_Actual.

## 
##  F test to compare two variances
## 
## data:  pile$Estimated_Length and pile$Actual_Length
## F = 0.95805, num df = 310, denom df = 310, p-value = 0.3531
## alternative hypothesis: true ratio of variances is less than 1
## 95 percent confidence interval:
##  0.0000 1.1552
## sample estimates:
## ratio of variances 
##          0.9580495

3. Alternate data format

Wide format.

##   Number Estimated_Length Actual_Length
## 1      1            10.58         18.58
## 2      2            10.58         18.58
## 3      3            10.58         18.58
## 4      4            10.58         18.58
## 5      5            10.58         28.58
## 6      6            10.58         26.58

Convert from wide to long.

##    Number      Length_Type Length
## 1       1 Estimated_Length  10.58
## 2       2 Estimated_Length  10.58
## 3       3 Estimated_Length  10.58
## 4       4 Estimated_Length  10.58
## 5       5 Estimated_Length  10.58
## 6       6 Estimated_Length  10.58
## 7       7 Estimated_Length  10.58
## 8       8 Estimated_Length  10.58
## 9       9 Estimated_Length  10.58
## 10     10 Estimated_Length  10.58
## 11     11 Estimated_Length  10.58
## 12     12 Estimated_Length   5.83
## 13     13 Estimated_Length   5.83
## 14     14 Estimated_Length   5.83
## 15     15 Estimated_Length   5.83

2-sided test.

H0: Variance of Pile_Length_Estimated = Variance of Pile_Length_Actual.

H1: Variance of Pile_Length_Estimated <> Variance of Pile_Length_Actual.

## 
##  F test to compare two variances
## 
## data:  pile_long$Length by pile_long$Length_Type
## F = 0.95805, num df = 310, denom df = 310, p-value = 0.7062
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.7665136 1.1974461
## sample estimates:
## ratio of variances 
##          0.9580495

1-sided test upper.

H0: Variance of Pile_Length_Estimated <= Variance of Pile_Length_Actual.

H1: Variance of Pile_Length_Estimated > Variance of Pile_Length_Actual.

## 
##  F test to compare two variances
## 
## data:  pile_long$Length by pile_long$Length_Type
## F = 0.95805, num df = 310, denom df = 310, p-value = 0.6469
## alternative hypothesis: true ratio of variances is greater than 1
## 95 percent confidence interval:
##  0.7945451       Inf
## sample estimates:
## ratio of variances 
##          0.9580495

1-sided test lower

H0: Variance of Pile_Length_Estimated >= Variance of Pile_Length_Actual.

H1: Variance of Pile_Length_Estimated < Variance of Pile_Length_Actual.

## 
##  F test to compare two variances
## 
## data:  pile_long$Length by pile_long$Length_Type
## F = 0.95805, num df = 310, denom df = 310, p-value = 0.3531
## alternative hypothesis: true ratio of variances is less than 1
## 95 percent confidence interval:
##  0.0000 1.1552
## sample estimates:
## ratio of variances 
##          0.9580495