# I have a question about which statistical analysis test to run

Ok, So I have 30 bags right. In each bag there are five colors. I have data for how many of each color there is in each. Ex. 5 green, 4 black, 6 white, 5 blue, and 5 red. I have 30 of those data sets. I need to know how to run a test to see if the probability of one color is higher than the others per bag or if it isnt. H0 is say P=.2 Ha is P=/= .2 How do I do it?
I am know of ANOVA but I dont think that fits well with this test. Unless Im mistaken of course. Then there is chi squared which only works for a single sample. So I am missing something with ANOVA or Chi Sqaured or there is some other test that is escaping my mind right now.

BTW there needs to be a math topic. Sure stats is very much apart of engineering and in this case is about engineering there should be a math topic.

Would just charting it out be acceptable?

Like in your example green would be 20%, black 16%, white 24%, blue 20%, and red 20%. And just do that for each bag? Dump it all into a chart and then compare from bag to bag.

It's not the quickest solution, but it's straightforward.

Maybe just a general STEM topic?

not what I mean.
I have already filled boxes. Each one has an arrangement of colors. They should all be at 20%. I need to know how far off they are from that as a group.
Think about it like this. I want to put five different types of objects into boxes, I dont care about how many of each. I want proportions to be right. And I want them to be close to 20%. 95% CI that they are. Currently the setup I have spits out some arrangement. I need to know if that arrangement is with in the 95% CI that I want. So can I can say yes it isnt perfect but based off this many samples of boxes we have this distribution with this CI and thus its good enough.
As of right now Im going with Chi-Squared fit -of-goodness for each and taking that P-values and turning them into binary yes no and running a Z test to see if the non evenly distributed boxes account for a significant amount of the group.
But this seems a little uh not so correct.

So I guess there is an acceptable number for the amount of colors there can be based off how many total there are in the box. then I need to say that there is either an acceptable amount of boxes passing or not passing.

The problem with just taking averages of the averages is that the boxes dont all have the same amount in each box. plus its bad habit to do that.

Just so we're clear, you have:
- 30 bags
- In each individual bag there are a randomisation of 5 colours?
- All bags are "independent" of other bags

I think maybe you should check out the multinomial distribution, it's like a bigger version of the binomial/Bernoulli distribution haha. I'll have a gander later, this seems interesting!

EDIT: Actually, one thing you could also look at is quality control statistics. Specifically, the R charts and Shewhart Charts. They pretty much do what you're looking to do for many samples.
http://www.jmp.com/support/help/Shewhart_Control_Charts.shtml

I'm actually well acquainted with shewhart Charts but they aren't a test. They are more like violin graphs. They are a represention of data in a picture. I have no problems showing the data. I have a problem coming up with the bounds of the chart. If you get what I mean. What makes this difficult is that the bags are all independent and have different total sums. Also what makes this hard is I'm not looking for a value but a percentage based off a value and the sum of the total in the bag and then comparing it against other bag precents. I'm honestly not sure if it's possible just bc of the nature of the question. Basiclly I'm coming up with a solution to fill a bag with mixed parts but have the bags be the same. I'm trying to figure out if having one nozzle fill a bag with an already perfect ratio of items is better than to have five nozzles fill the bag with an close to correct amount.
i need to know which has better results statically. That's the hard part. Bc one could have a higher percentage of correct parts but also higher standard deviation while the other could have lower percentage of correct ratios but also smaller deviation. It's not fun.

Shewhart Charts are a nice way to show data but they don't help you come up with the bounds.
I need a way to show that one is better or worse in some way than the other.

The reason it needs to be per bag is bc a customer who buys this bag/box will only have that one box to work with. He or she isn't going to have 100 boxes and sum them up. The problem with summing them up like that is that we are talking integer numbers. They don't divid into factions very well and thus you'll end up with an unbalance with say 100 bags. But I'm trying to have 1 bag be closer to 100,000 bags. It's weird but there is some middle ground were the data goes all wonky. It's actually more representative of you have only one bag vs 100. Just how integer stuff works out sometimes.
It's like the common skittles or m&m question of which is more common in a bag. People think that 100 bags is a large sample group. It's not. 100,000 is and 1 bag repsents it better than 100 bags do. Clearly skittles doesn't skew the ratio. M&M does tho. But it's still a set ratio.

Ah I see, so since the sample sizes are different and you're comparing between two nozzle types, you may have to use a weighted/un-weighted factorial ANOVA. (i.e. 2x5 with nozzle type vs. colour or something)

I'm fairly certain that the weighted/un-weighted tests account for having different sample sizes across the groups you're comparing.

https://www.r-bloggers.com/r-tutorial-series-two-way-anova-with-unequal-sample-sizes/
This might help explain it better haha.

Other than that I'm pretty strapped for ideas! Sorry!

Again I'm pretty sure like I said ANOVA doesn't work in this case Bc I'm not comparing outputs. I'm comparing a ratio. Basiclly I'm wondering if there is some sort of chi-squared method that takes into account multiple samples. As far as I can tell it's a no. And by multiple samples I mean multiple independent studies of independent colors. I'm not sure I said that right. Chi squared works if you have one data set. It takes what you expected and compares it to what you have and gives tells you if you are outside some CI level or not. But I need that done multiple times to compare the outputs of the chi squared function. So once it has all the P values it then needs to decide if those yes and no's fit into another CI. That's why ANOVA doesn't work. It's good at multiple samples of related data. You can't run ANOVA to see if a data point is in spec or not.
Make sense? I'm not sure I'm writing this well.