# Optimization of Virtual Loudspeakers for Spatial Room Acoustics Reproduction with Headphones
## 2 Virtual loudspeaker Position Optimization
### Statistical Analysis  
The ABX test is designed to detect the small differences of the compared signals. Therefore the difference should not be detected by all the participants or otherwise the test loses its purpose. The contrary also holds: if the difference is too small, all participants have to guess and the result of the experiment is statistical noise. That being said, an approximation to the ability to distinguish the sound samples is needed to determine the expected detection rate over the listener population. In other words, the experimenter should decide how big portion of the subjects has truly heard the difference in the samples. When determining the threshold, one should also keep in mind the time and resources that can be used--smaller threshold needs more subjects and vice versa. The limit selected for this experiment is a compromise between distinction and the number of subjects; the expected detection threshold was set at one third of the population.  
The determined threshold cannot be used directly to determine how large proportion of subjects has successfully discriminated the difference. Instead, the determined threshold needs to be adjusted to calculate the proportion \(P_{obs}\) with the rearrangement of [PERSON]'s formula [19]:  
\[P_{obs}=P_{d}+P_{0}(1-P_{d}) \tag{11}\]where \(P_{d}\) is the proportion of subjects that truly noticed the difference and \(P_{0}\) is the proportion of the population that got the test right by chance. \(P_{obs}\) basically tells us the proportion of subjects that should score the sample pair right to prove the alternate hypothesis right.  
After calculating the required observed proportion, the required number of subjects can be approximated with the following equation [19]:  
\[N=\left[\frac{Z_{a}\sqrt{p_{0}q_{0}}+Z_{\beta}\sqrt{p_{a}q_{a}}}{p_{0}-p_{a}} \right]^{2} \tag{12}\]  
where \(Z_{a}\) and \(Z_{\beta}\) are the corresponding Z-scores of selected false positive and negative rates; \(p_{0}\) is the chance probability; \(p_{a}\) is the chosen probability for an alternate hypothesis; and \(q_{0}=1-p_{0}\), \(q_{a}=1-p_{a}\). However, required subject count becomes prohibitively large if our selected detection threshold is used for a simple ABX test setup. The reason for this is the chance of a subject guessing the correct sample--for the used test, the chance rate is 50 percent per evaluated pair. According to the Equation (12), 94 participants would be needed to ensure the significance of the effect. To reduce the number of required subjects, replications of the same samples were used. The strategy was to make the participant evaluate the same sample pair multiple times. The subject was required to get all the replications right for the test case in order to count the sample as properly discriminated. The number of replications in this test was set at four times per sample pair, effectively reducing the chance rate to 6.25 percent and the number of required participants to 15 people.  
To calculate Z-score for the results, the proportion of true discriminators should be calculated from the results. The equation for calculating the adjusted proportion \(P_{adj}\) can be derived from Equation (11):  
\[P_{adj}=\frac{P_{obs}-P_{0}}{1-P_{0}}. \tag{13}\]  
From \(P_{adj}\), Z-score can be calculated with a binomial test for proportions [19]:  
\[z=\frac{P_{adj}-p_{0}-1/(2N)}{\sqrt{p_{0}q_{0}/N}} \tag{14}\]  
where \(N\) is the number of subjects. Finally, 95 percent confidence intervals were calculated [19]:  
\[\text{CI}_{95\%}=P_{adj}\pm Z_{95\%}\text{SE}_{P_{adj}} \tag{15}\]  
where \(Z_{95\%}=1.645\) is the Z-score for 95 percent confidence interval and \(\text{SE}_{P_{adj}}\) is the standard error for the adjusted proportion of discriminators [19]:  
\[\text{SE}_{P_{adj}}=\sqrt{\frac{P_{adj}(1-P_{adj})}{N}}. \tag{16}\]