Introduction

On the 1 March 2020 AoSHQ gun thread, Weasel tested some Federal and PMC ammunition by measuring the velocities of 9 rounds (3 groups of 3) of each type. The interest is to compare the consistency of the velocities.

Import Data

Read in the .ods file with the velocity measurements:

vel3 <- read_ods("Ammo_Test.ods")

vel3
Mfr Shot1 Shot2 Shot3
Federal 2753 2757 2738
Federal 2740 2730 2751
Federal 2735 2740 2740
PMC 2889 2878 2876
PMC 2870 2884 2883
PMC 2890 2890 2883

I organized the data with the same logic as Weasel presented it, but my groups are on rows instead of in columns. This arrangement is more convenient for the analyses I have in mind.

Shewhart Charts

I will plot the 3-shot groups on Shewhart (or control) charts. I will calculate the chart limits using the Federal groups. That will make it easier to compare the two manufacturers.

Chart of Group Means

mean.qcc <- qcc(vel3[1:3, 2:4], type = "xbar", sizes = 3, 
      labels = vel3$Mfr[1:3], 
      newdata = vel3[4:6, 2:4], newlabels = vel3$Mfr[4:6],
      plot = FALSE, chart.all = TRUE)

plot(mean.qcc, title = "3-shot Means")

This chart of group means tells us only what we already knew: the two different cartridges have different velocities. The next chart, of the group ranges (what Weasel calls the Extreme Spread), will compare variation between the two manufacturers.

Chart of Group Ranges

range.qcc <- qcc(vel3[1:3, 2:4], type = "R", sizes = 3, 
      labels = vel3$Mfr[1:3], 
      newdata = vel3[4:6, 2:4], newlabels = vel3$Mfr[4:6],
      plot = FALSE, chart.all = TRUE)

plot(range.qcc, title = "3-shot Ranges")

This chart of 3-shot ranges does not suggest that the two different types of ammunition exhibit different variation in velocity. All the ranges are fairly close to the Federal mean range of 15fps.

Analysis as Two Groups

While Weasel measured the velocities in 3-shot groups, I didn’t notice anything in the blog post to suggest that those groups relate to any real-world characteristics of the ammo or test conditions. If each group came from a different box or lot, we could use those groups to assess box-to-box or lot-to-lot variation. As it is, we can also analyze the velocity measurements as 2 groups of 9 shots.

Data Wrangling

I will re-shape the data set to ignore the 3-shot groups, ending up with 9 Federal shots and 9 PMC shots. I will also create a variable that normalizes the velocities by converting them to the difference between each velocity and the mean for the manufacturer. That will help us visualize the variation of the two groups without the influence of the two different velocity levels.

vel9 <- vel3 %>% 
  gather(key = Shot, value = velocity, Shot1:Shot3) %>% 
  arrange(Mfr)

vel9$Shot <- NULL

## Compute means by Mfr.
vel.summ <- vel9 %>% 
  group_by(Mfr) %>% 
  summarise(mfr_mean = mean(velocity))

vel9 <- vel9 %>% 
  mutate(mfr_mean = if_else(Mfr == "Federal", 
                            true = vel.summ$mfr_mean[1],
                            false = vel.summ$mfr_mean[2]),
         vel_norm = velocity - mfr_mean)
  
vel9
Mfr velocity mfr_mean vel_norm
Federal 2753 2742.667 10.3333333
Federal 2740 2742.667 -2.6666667
Federal 2735 2742.667 -7.6666667
Federal 2757 2742.667 14.3333333
Federal 2730 2742.667 -12.6666667
Federal 2740 2742.667 -2.6666667
Federal 2738 2742.667 -4.6666667
Federal 2751 2742.667 8.3333333
Federal 2740 2742.667 -2.6666667
PMC 2889 2882.556 6.4444444
PMC 2870 2882.556 -12.5555556
PMC 2890 2882.556 7.4444444
PMC 2878 2882.556 -4.5555556
PMC 2884 2882.556 1.4444444
PMC 2890 2882.556 7.4444444
PMC 2876 2882.556 -6.5555556
PMC 2883 2882.556 0.4444444
PMC 2883 2882.556 0.4444444

Boxplots

The graph below is a boxplot, devised by the very important statistician John Tukey. They provide a visual summary and comparion of the two groups of velocity measurements. I have added dots to the box plots to display the individual measurements. Those have random locations horizontally so we can see all the points.

ggplot(vel9, aes(Mfr, vel_norm)) +
  geom_boxplot() +
  geom_point(position = position_jitter())

The boxplot displays the normalized velocity measurements, so the difference in the velocity level of the two cartridges is removed. We can see that the variation is about the same for the two groups.

F-test of Variation by Manufacturer

This section has F-tests of the hypothesis that the variance of the two groups is the same. I applied the test to both the raw and normalized velocities. The results are identical, confirming that the normalization that we used didn’t affect the variance. To be rigorous, we should test the measurements for normality (meaning consitent with a Gaussian distribution) before applying this test, but I dispensed with that because the samples are small and this is just for fun.

vel.ftest <- var.test(velocity ~ Mfr, data = vel9)
vel.ftest

    F test to compare two variances

data:  velocity by Mfr
F = 1.7118, num df = 8, denom df = 8, p-value = 0.4638
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.3861164 7.5886516
sample estimates:
ratio of variances 
          1.711754 
vel_norm.ftest <- var.test(vel_norm ~ Mfr, data = vel9)
vel_norm.ftest

    F test to compare two variances

data:  vel_norm by Mfr
F = 1.7118, num df = 8, denom df = 8, p-value = 0.4638
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.3861164 7.5886516
sample estimates:
ratio of variances 
          1.711754 

This test result does not suggest that the variances of the two groups of velocity measurements differ.

Conclusions

Though the samples are small, they are more than adequate to detect the difference in average velocity between these two cartridge types. We do not see evidence that one type is more variable than the other. Larger samples might detect such a difference. If we know how big a difference would be of practical interest, we could calculate the sample sizes required to detect such a difference.

Reference: R Core Team (2018). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.