I have a dataset containing observations of wave lengths in milliseconds and the corresponding durations of noise in milliseconds. Each observation is labeled with a group (A or B) and a subject.
I want to determine if the proportions of noise in the waves of group A are greater than or equal to those in group B. To quantify the noise proportion, I have a metric called "p," which is calculated by dividing the duration of the noise by the duration of the wave.
Here's an example of my dataset:
grupo Subject noise(s) length(s) p
A X1 1094 1520 0.719820213
A X2 150 1852 0.081245657
... ... ... ... ...
B X26 113906 136779 0.832774474
B X27 83327 142258 0.585743053
B X28 112903 147737 0.764213143
I would like to know the proper way to perform a proportion test to compare the noise proportions between group A and group B. Should I average out the "p" column for each group and then proceed with the test? If so, how can I perform this test using a statistical software or library?
Why Do I ask?
I'm facing confusion regarding the appropriate approach for conducting a proportion test in a specific scenario. Typically, when performing a proportion test, we have the counts (n) and the total sample sizes (N) for each group. However, in my case, I have individual observations represented by proportions, and I need to calculate a statistic to assess if the noise proportion differs significantly between group A and group B.
To clarify, the noise proportion is calculated by dividing the duration of the noise by the duration of the corresponding wave for each observation. It's important to note that a simple t-test comparing the mean noise durations is not appropriate because the noise duration is dependent on the wave duration. Therefore, I believe a proportion test is more suitable for this analysis.
I would greatly appreciate guidance on how to proceed in this situation. Specifically, I'm looking for suggestions on the appropriate statistical methods, and if possible, references to articles, books, or research papers that discuss similar approaches.
Thank you in advance for any insights or resources you can provide.
here is my full dataset:
df <- data.frame(
grupo = c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B"),
Subject = c("X1", "X2", "X3", "X4", "X5", "X6", "X7", "X15", "X16", "X17", "X18", "X19", "X20", "X21", "X29", "X30", "X8", "X9", "X10", "X11", "X12", "X13", "X14", "X22", "X23", "X24", "X25", "X26", "X27", "X28"),
noise = c(1094, 150, 8303, 1203, 2133, 1443, 9117, 5177, 4482, 40057, 46129, 90512, 20294, 90888, 76439, 56250, 12095, 8046, 4141, 31651, 58280, 28082, 38608, 46389, 93565, 40294, 97831, 113906, 83327, 112903),
length = c(1520, 1852, 12478, 16241, 21720, 27199, 32678, 76510, 81989, 87468, 92947, 98426, 103905, 109384, 153216, 158695, 38157, 43636, 49115, 54594, 60073, 65552, 71031, 114863, 120342, 125821, 131300, 136779, 142258, 147737),
p = c(0.719820213, 0.081245657, 0.665404337, 0.074051034, 0.098219923, 0.053041614, 0.278977528, 0.067662175, 0.054660867, 0.457964591, 0.496291317, 0.919593764, 0.195312579, 0.830902015, 0.498893504, 0.354454487, 0.316979866, 0.184394298, 0.084321059, 0.579747946, 0.97014446, 0.428392012, 0.54353371, 0.403864003, 0.777487753, 0.320251289, 0.745093182, 0.832774474, 0.585743053, 0.764213143)
)