# Significance of difference between 2 variables of Cauchy distribution

I've got to verify whether there is a significant difference in value market shares between 2 versions of packaging (A and B) of a given beverage:

For the 'Packaging A' I've got a sample of 600 purchases on which I compute average 'Packaging A' purchase value as well as the average value of entire category purchase. Both outcomes are of normal distribution so their ratio - value share - is of the Cauchy distribition.

Could anyone advice me, how to find a Cauchy distribution statistic by which I could verify the hypothesis of difference between the 2 packaging versions in value shares? (for the Packaging B the sample is 650).

-
If the assumption of normality seems to be reasonable for both sets, you can use the two-sample t-test for testing the hypothesis of equallity of means. In R, this is implement in the command t.test. I do not think there is the need for taking the ratio of the observations, given that you are interested on comparing the two groups (see the description of the t-test). You can also check the assumption of homoscedasticity using the F-test. –  user10525 May 30 '12 at 9:05
I have to know, how the change in packaging influences market shares irrespective of the absolute change of sales value, so I guess I should take the ratios though and build the statistic of Cauchy distribution... Any other ideas, warmly welcome of course.. –  aldo May 30 '12 at 9:20
The ratio of two normal distributions has a Cauchy distribution only if the two distributions are independent and both have zero mean, which seems unlikely here. Else it's a more complex Gaussian ratio distribution. –  onestop May 30 '12 at 9:38
MathWorld does appear to be wrong here, in that it's not specifying enough conditions on the normal distributions. I'm not seriously suggesting using the Gaussian ratio distribution though. There's got to be a simpler way of approaching this.. –  onestop May 30 '12 at 10:06
By taking the ratios you lose information because you start with the joint distribution of $(A,B)\leftrightarrow (A/B,B)$ and you are only taking into account the marginal information of $A/B$. –  user10525 May 30 '12 at 11:52

1) The two distributions aren't Normal, since there's no chance of observing a 0 or negative value. That doesn't mean the Normal isn't a useful approximation, but when taking the ratio and trying to work with the functional form of the Normal, you're making life a little more difficult than it has to be.

2) I'd suggest using the bootstrap to build your confidence interval on the ratio. Specifically, draw, say, 1000 samples of size 600 with replacement from the "Packaging A" results, and an equal number of samples of size 650 with replacement from the "Packaging B" results. For a simple confidence interval, form the 1000 ratios, sort, and just pick off the 25th and 975th largest numbers.

For (typically) better confidence intervals, although possibly not much better, use the "boot" package in R. An example with a little cheating (padding the shorter series with NA means the bootstrap might select samples a little smaller or larger than 600 from the shorter series, although with such a large sample this will have little effect on the results) is below:

# Create random purchase values; pad shorter series with NA
PurchaseValueA <- c(rgamma(600, 5, 1), rep(NA, 50))
PurchaseValueB <- rgamma(650, 4.75, 1.1)
df <- data.frame(PVA=PurchaseValueA, PVB=PurchaseValueB)

# Bootstrap statistic function
foo <- function(data, i) {
mean(data$PVA[i], na.rm=TRUE) / mean(data$PVB[i], na.rm=TRUE)
}

# Run the bootstrap, calculate confidence intervals
boot.foo <- boot(df, foo, 1000)
boot.ci(boot.foo)

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 10000 bootstrap replicates

CALL :
boot.ci(boot.out = boot.foo)

Intervals :
Level      Normal              Basic
95%   ( 1.151,  1.273 )   ( 1.150,  1.272 )

Level     Percentile            BCa
95%   ( 1.153,  1.275 )   ( 1.152,  1.274 )
Calculations and Intervals on Original Scale
Warning message:
In boot.ci(boot.foo) : bootstrap variances needed for studentized intervals


As we can see, all the CIs are essentially the same.

-
Thanks. I'll try to implement the boostrap method in Excel as I'm not fluent in R. Just to make sure if I got everything correct: when you wrote about 10000 draws for both packaging versions and forming 1000 ratios afterwards you missed one 0 in the latter number? (or added the excesive one in the former)? If not, I'd not understand where this inequality comes from. –  aldo May 30 '12 at 13:56
Right, I'll correct it. You don't really need 10,000 draws, 1000 will do the job, and probably less since your distributions aren't very skewed. –  jbowman May 30 '12 at 14:12
@jbowman I like 10000 for confidence intervals. The talk about Cauchy was a red herring because the numerator and denominator are both nonnegative. it is possible that a distribution like a gamma might be a better choice than normal. I guess I would like to see the fit to the normal and the gamma for both A and B. Bootstrapping is a good suggestion. What bootstrap CI did to OP use? Was it just the percentile method. If so I would recommend to try at least one of the higher order bootstrap CIs. –  Michael Chernick May 30 '12 at 22:43
@MichaelChernick - always good to get advice from an actual expert! (+1) I think the OP is trying to do this in Excel, so the percentile method first, but afterwards I don't know. I hope he takes your advice and does the extra work to program something better. –  jbowman May 30 '12 at 23:03
@jbowman If he has resampling stats for Excel I think he can now do BCa if he wants to. –  Michael Chernick May 31 '12 at 0:49