Tub
Joined: 6/25/2005
Posts: 1377
Ok, I'll try some more values. I throw the coin 10 times and get 9 tails (0) and 1 heads (1) x_m = 0.1 sigma_m = sqrt( ( 9*0.1^2 + 1*0.9^2) / 10*11 ) = 0.09045 Now I do this again, 100 times, getting 10 heads. x_m still 0.1 sigma_m = sqrt( ( 90*0.1^2 + 10*0.9^2) / 100*101) = 0.02985 For the 68% certainty case, do I just fit an interval around x_m to get [0.1 - 0.09045, 0.1 + 0.09045] or is the result more involved? For 95.56% I'd get 0.1 - 3*0.09045 as the left boundary, which is negative, so I'm not sure I got this right. Does it even make sense to model a probability as gauss/normal distributed, ignoring the known boundaries of [0, 1]?
m00
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Tub wrote:
Does it even make sense to model a probability as gauss/normal distributed, ignoring the known boundaries of [0, 1]?
Rigorously speaking, no. You have to model your experiment so that gaussian distribution is a good approximation to it. If you consider a sample consisting of n coin tosses, you'll never have a continuous possible space of probabilities, because the possible results will always be a multiple of 1/n and, thus, countable. In your example, you're taking a sample as only one coin toss, that has only two possible values (0 or 1) and that's far from a continuous model. I'd tackle it like this: get one sample as a hundred coin tosses, x_i = number of heads / 100. Do this to n samples and evaluate the standard deviation and everything else. For sufficiently large n, the real probability distribution around 3 SD's from the mean will behave like a Gaussian and you can apply those results. I remember having done a similar experiment to this by throwing 50 dice in each sample and counting the ratio of the number of 1's, the result was pretty accurate iirc. EDIT:
Language: C++

#include <stdio> #include <math> #include <stdlib> #include <time> int v[100]; double x[5]; int main(){ double fav,mean,sigmaM; srand(time(NULL)); for (int i=0; i<5; i++){ for (int j=0; j<100; j++) v[j]=rand()%2; fav=0; for (int j=0; j<100; j++){ if (v[j]==0) fav+=(1.0/100); } x[i]=fav; } mean=0; for (int i=0; i<5; i++) mean+=x[i]; mean/=5; sigmaM=0; for (int i=0; i<5; i++) sigmaM+=pow(x[i]-mean,2); sigmaM/=(5*4); sigmaM=sqrt(sigmaM); printf("%lf +- %lf\n",mean,2.13*sigmaM); getchar(); return 0; }
Here's a virtual experiment using an RNG to simulate 100 coin tosses and to evaluate the 90% certainty with five samples. Since five is a small quantity, I used the value in a table for finite amounts of testing, which I have in hands now. I can pass it to you if you want, but with a computer you can do a large amount of tests so that the value for infinite measures is good enough. In practice, to obtain better approximation, it's usually better to increase the size of the sample than to increase the amount of observations.
Tub
Joined: 6/25/2005
Posts: 1377
But wouldn't the partitioning of results adhere order? The samples (0,0,0,0), (1,1,1,1) will yield different results than (0,1,0,1), (0,1,0,1), even though both have a clean 50/50 split. You'll also get different values depending on the partition size. If you take a run of 1000 samples, and partition it into 10 samples of 100 each, you'll get different results than with 5 samples of 200 or 20 samples of 50. Will the result actually allow more precise statements than "the std-dev from the thing I just measured is x"? Can that approach yield *strict* values for the probability interval of P(X='head')? This looks like a lot of mumbo-jumbo to me, something I often hear in stochastics.. "yeah, totally wrong, but the law of large numbers evens it out as we approach infinity. Don't worry!" :/ The thing is, I can't just pull samples out of thin air. I can't get 100 samples, n times. I'm lucky if I have 100. I'm very much aware that that is a small number and the calculated mean is unreliable. I'm interested in knowing how unreliable it is. But for this to work, I need maths that don't require thousands of samples to be accurate. My approach would be this. To start with a discrete example, assume two coins: Coin A has 1/3 chance heads Coin B had 2/3 chance heads I pick a coin randomly, I want to determine which one I got. I'm tossing 10 times, getting 4 head, 6 tails. If I'm tossing coin A, then the chance for 4 head is 1/3^4 * 2/3^6 * (10 choose 4) = 64 / 59049 * 210 ~= 22.7% If I'm tossing coin B, then the chance for 4 head is 2/3^4 * 1/3^6 * (10 choose 4) = 16 / 59049 * 210 ~= 5.7% We now know P(4 heads|picked coin A) = P(picked A and got 4 head) / P(picked A) = 0.5 * 22.7% / 0.5 = 22.7% I'm interested in P(picked A | got 4 head) = P(picked A and got 4 head) / P(got 4 head) = 0.5 * 22.7% / (0.5 * 22.7% + 0.5 * 5.7%) In other words, we just consider the sum of both probabilities as 100% and scale both values accordingly. This yields 80% chance that I'm holding Coin A, 20% chance that I'm holding Coin B. Pretty much what I expected: "It's probably Coin A, but too soon to be sure." Tossing 100 times, getting 40 head will yield 99.99990% chance to hold Coin A, which would then be a very convincing argument. So far, is there a flaw in my line of thought? Now let's extend this to the non-discrete case, There is an infinite number of coins with every possible probability, and we picked one. Equally, there is just one coin with an unknown probability. There's an implicit assumption here: that every coin has the same chance to be picked. In other words: the unknown coin we're holding can have any probability, any is equally likely. Since we don't know anything about the coin we're holding, I think that's the only valid assumption.[1] Now we define a function Pn,m(p) := if we toss a coin with probability p exactly n times, how likely will we get m times head? Pn,m(p) = p^m * (1-p)^(n-m) / (n choose m) Get rid of the terms that don't involve p, they'll cancel each other out later: P'n,m(p) := p^m * (1-p)^(n-m) We now need to find the integral from 0 to 1 to get our "100%" to which we need to scale. If we calculate the integral from a to b, divide by the integral from 0 to 1, we'll get the chance that the coin's probability for heads is between a and b. Correct so far? Based on that, we need to find suitable a and b to get our target confidence. Worst case, we'll use a binary search to narrow down the interval until we get one we like. There's just one slight problem: does anyone know how to calculate the integral of Pn,m? ;) Wolfram Alpha timed out trying to solve it and it's way beyond my highschool-math-capabilities. [1] We could guess a better initial distribution based on samples, but that would already introduce a bias. I'm not trusting my samples to be accurate, so the only safe assumption is that - even despite my gained knowledge - the coin could be anything. We're already considering the samples by eliminating the coin-probabilities that were unlikey to yield my samples; considering the samples twice would be wrong.
m00
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Well, I tried my best to explain the theory behind confidence intervals, surely the order matters if you make a partition, but if you count the number of subsets full of 0's and compare that have mixed 1's and 0's, you'll see the former is extremely small in comparison to the latter, even for small n, so the chance of your estimation being screwed up by this fact can be ignored. It's also of my opinion that stochastics is an overly simplified and "ugly" field of mathematics and I won't stand to defend it. However, when you acquire some knowledge about these subjects, you see that there are problems that mankind will probably never be able to solve exactly and approximation methods are more than necessary. The use of Gaussian distribution for this problem is very popular, I've never come across your approach, I think it's correct and easy to compute for the coin's case, but for the case of a dice, you'd have to do a five-dimensional integral, and that's very hard stuff. If you think such integration suits your needs best, that's a polynomial function, expand the (1-p) term by Newton's binomials and multiply it by p^m. The integral of a polynomial function is one of the most elementary ones.
Tub
Joined: 6/25/2005
Posts: 1377
Sure, approximations are often needed, but you need to be mindful where you're doing an approximation (and how much you're off), and my experience in stochastics is often that this step is completely ignored. Or maybe I only talked to the wrong people. Didn't mean to sound ungrateful for your help, though. Thanks! So let's do the integral: Pn,m(p) = p^m * (1-p)^(n-m) Pn,m(p) = p^m * sum(k=0 to n-m) (n-m choose k) (-1)^k p^k Pn,m(p) = sum(k=0 to n-m) (n-m choose k) (-1)^k p^(k+m) integral = sum(k=0 to n-m) ((-1)^(k) (n-m choose k)) / (k+m+1) * p^(k+m+1) let's retry my older numbers:
I throw the coin 10 times and get 9 tails (0) and 1 heads (1) x_m = 0.1 sigma_m = sqrt( ( 9*0.1^2 + 1*0.9^2) / 10*11 ) = 0.09045
int(0 -> 1) P10,1(p) = 0.0090909090909084 int(0.01 -> 0.19) P10,1(p) = 0.0058386180381549 64.41% chance of P(X=heads) being in that interval, while your formula says 68.27% for one stddev. That's close enough to believe that I don't have an error in my formula, but far enough to believe that your suggested approach isn't too useful for low n.
Now I do this again, 100 times, getting 10 heads. x_m still 0.1 sigma_m = sqrt( ( 90*0.1^2 + 10*0.9^2) / 100*101) = 0.02985
I'm getting 77.6% instead of 68.27, though with summands like (90 choose 45)/56 * x^56 rounding errors are bound to be problematic. I'll try again tomorrow with a proper math library. Any hope of having this as a neat formula in OOCalc went out the window, anyway. :/ I could solve the die-case by independently examining 6 different random variables: Xi = 1 when the die says i, 0 otherwise. Would my confidence interval for throwing a 1 be any different if 12 dice throws are either each side twice, or one twice and six ten times? My guess for P(X=1) is 1/6 in both cases, but would a high amount of sixes make me any more or less confident about that guess? I don't think so, but as always I may be wrong. (I'm not interested in a dice's average value, which I understand to be a standard case for the approach you suggested. I want to know the distribution of X, the probabilities for each side.)
m00
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Tub wrote:
I could solve the die-case by independently examining 6 different random variables: Xi = 1 when the die says i, 0 otherwise. Would my confidence interval for throwing a 1 be any different if 12 dice throws are either each side twice, or one twice and six ten times? My guess for P(X=1) is 1/6 in both cases, but would a high amount of sixes make me any more or less confident about that guess? I don't think so, but as always I may be wrong.
It's just that we're generally more concerned about the entire probability distribution than one value itself. In higher dimensions, the notion of confidence intervals can be generalized to the entire probability function because it gives a better idea of how good your data is than simply evaluate the uncertainty for each variable, which makes it look worse than it actually is. The main difference is that the gaussian function has radial symmetry and can be reduced to a univariate integral, while the polynomial one can't.
Tub wrote:
Quote: Now I do this again, 100 times, getting 10 heads. x_m still 0.1 sigma_m = sqrt( ( 90*0.1^2 + 10*0.9^2) / 100*101) = 0.02985 I'm getting 77.6% instead of 68.27, though with summands like (90 choose 45)/56 * x^56 rounding errors are bound to be problematic. I'll try again tomorrow with a proper math library. Any hope of having this as a neat formula in OOCalc went out the window, anyway. :/
I figured this could happen, floating point hates polynomials of high degrees. I'm getting 67,93% for 1 SD and 94,02% for 2 SD's in Mathematica 7. Maybe you could calibrate your program with those values. Good luck.
Player (80)
Joined: 8/5/2007
Posts: 865
I've only skimmed this conversation, but what Tub has brought up is a very important (and mildly controversial) topic in science. I don't know how much this overlaps what has already been said, but I'd like to offer some Wikipedia articles that perhaps strike more to the point. Tub seems to be interested in the Bayesian probability, the likelihood that a coin is fair given the data shown. I would like to warn you: Bayesian probability, and in particular, prior probability is controversial in sciences. (Personally, I would not use the word "controversial", but instead "garbage".) The central problem with prior probabilities comes from what is known as the principle of indifference, which roughly states that if we don't have reason to believe one hypothesis is true over another (mutually exclusive) hypothesis, we assign them equal probabilities of being true. Many otherwise great minds subscribe to the principle of indifference, but it should be unsettling to you right down to your bones that we use a lack of information to assign a probability. I first came across the principle of indifference in Martin Gardner's outstanding book "Aha! Gotcha", in which he rips it to shreds with numerous absurdities "proven" by the principle. Laplace once used the principle to show that the probability of the sun rising tomorrow is 1,826,214 to 1 against! Gardner offers other examples in which the principle of indifference is absurd and contradictory and I'll be happy to cover them if anyone is interested, but it is too far abreast of this topic. Bayesians have dug themselves into quite a hole with their willingness to assign a probability to any statement. For example, what is the probability that Newton's second law is correct? Is it 0.999999999999? This is a law of nature we're talking about, not some random variable! Therefore, the answer must be either 0 (the law is surely incorrect) or 1 (the law is surely correct). (The true answer appears to be 0, based on quantum mechanics.) In contrast with the Bayesian camp is the frequentist viewpoint, which holds that probability is just a reflection of the number of "successful" trials divided by the total number of trials. From this viewpoint, the scientifically popular statistical hypothesis testing takes shape. In this method, a null hypothesis is chosen and this hypothesis is tested to a previously specified significance level. In the case of flipping a coin, we might want to know with a confidence of at least 95% that the coin is not fair (please note that this doesn't mean there is a 95% probability that the coin is not fair-- the coin either is or is not fair). At the heart of statistical hypothesis testing is the calculation of the p-value, which is compared with the significance level in order to decide whether to reject the null hypothesis. In my opinion, statistical hypothesis testing is not perfect, but used properly, it is by far the best tool we have. The clash of the two schools of thought is clearest via the Jeffreys-Lindley paradox, which considers situations in which the two philosophies offer different conclusions about the supposed falsehood of the null hypothesis. If you read no other link in this post, I encourage you to study the Jeffreys-Lindley paradox. The frequentist approach requires the introduction of an arbitrary significance level, but the Bayesian approach requires the introduction of a (in my opinion) far more troubling prior probability, founded on the principle of indifference. Note from the example that this prior probability assigns equal likelihood to the possibilities that the probability of having a boy is 0.5036 and the probability that having a boy is 0. We know the probability of having a boy is not zero, so this is absurd. You are more than welcome to come to your own conclusion about these philosophies of probability, but I encourage you (Tub) to re-examine your coin flipping problem with a null hypothesis (that the coin is fair) and an alternative hypothesis, calculating the p-value. I am also happy to share my deeper thoughts on the principle of indifference, thought experiments that poke holes in the Bayesian viewpoint, and my own thoughts on probability, if anyone is interested.
Tub
Joined: 6/25/2005
Posts: 1377
Thanks for your insights bobo, that was an interesting read. Though I'm not interested in determining whether the coin is fair, I know it's unfair and I wish to determine it's actual chances. This was just an example for another problem I listed: monster drop rates. There can be no assumption that "the drops are fair" (p=0.5), so it's difficult to formulate a null hypothesis. So - if working with a prior probability - I don't see any better approach than equal likelihood for 0 < p < 1. I could say "it's surely below 50%" and model equal probabilities 0 < p < 0.5. But how would I justify that constraint? In other words, I don't pick indifference out of principle, but because it's the closest thing I have given my prior knowledge. Of course any prior probability is an uglyness, but the other approach isn't free of ugly assumptions, either. :/ The article on lindley's paradox also mentioned another interesting bit:
Because the sample size is very large, and the observed proportion is far from 0 and 1, we can use a normal approximation for the distribution
I don't have large sample sizes (10 to 500, depending on the monster), and since I'm only interested in drop rates for rare (=interesting) items, my initial estimates are somewhere around 1-10%, close to 0. So shouldn't I avoid modeling by normal distribution?
m00
Player (80)
Joined: 8/5/2007
Posts: 865
Let me summarize my viewpoints (the first three are interconnected): 1) The frequentist school of thought trumps the Bayesian school of thought. 2) As a corollary, always seek a p-value. Disregard any Bayesian analysis with uninformed priors. (Of course, Bayes' theorem holds, it's just that it often is underdetermined.) 3) Never speak of the probability of something that is not somehow randomized. If there is randomization, you must know what is being randomized and how. For a valuable illustration of this, see the Bertrand paradox (this is perhaps my favorite subject on the treachery of probability when the problem is not carefully defined). 4) All probability is ultimately quantum mechanical in nature. (I do not know if anyone else subscribes to this philosophy, but it makes sense to me. A thorough explanation of my belief would be too lengthy for this forum post.) So you're fighting battles and looking for monster drop rates. Suppose you fight 100 battles against a particular monster and it drops the item you want 48 times. You would like to know P(p=0.4) (or something), where p is the probability that a monster drops an item, given that you got 43 out of 100 drops. In standard notation, you're really looking for P(p=0.4 | 48 out of 100 drops). Hence the allure of the Bayesian analysis. Seems simple enough, right? No can do. That drop rate was not randomized-- it was chosen by a game designer-- and it therefore fails criterion number 3 listed above. Any discussion of the probability that p=0.4 is meaningless because it either is or it isn't according to the programming of the game. We can, however, analyze the problem with p-values. Let the null hypothesis be H0: p=0.4 and the alternative hypothesis Ha: p=/=0.4. Supposing the null hypothesis to be true, we would like to know the probability of obtaining a result at least as far out as 8 from the expected mean (40). Therefore, it is a two-tailed test. The p-value could almost certainly be obtained by application of the central limit theorem and estimation of the pdf as a normal distribution, but I'm just not feeling up to it right now, so I'll instead use the binomial distribution directly. We want P(X>47 or X<33 | p=0.4) where X is the number of successful drops and p is the probability of a successful drop. Now it's simply a matter of finding b(48; 100, 0.4), b(49; 100, 0.4), b(50; 100, 0.4)... as well as b(32; 100, 0.4), b(31; 100, 0.4), b(30; 100, 0.4)... and so on, where b is the binomial distribution function, and adding them all up. Doing so, I obtain a p-value of about 0.12, which is generally not low enough to reject the null hypothesis at a reasonable significance level. Take note of what happened here. I suggested that you fought 100 battles (a lot!) and even gave you a success rate close to 50% (which would be ideal) and yet you still couldn't reject the null hypothesis that the actual probability of a drop is 0.4. That sucks. What it means is that you have to fight a lot of battles-- maybe 1,000 or 10,000-- before you can start pinning down the probability with any reasonable certainty. I might have started this exercise with the null hypothesis that p=0.5 and although it would have given a larger p-value, it would by no means be conclusive over other theories. What should you do? You have a few options: 1) Just assume that p = (number of successes)/(number of trials) and be done with it. 2) Make a lua script that fights battles for you and run the game at a high speed overnight to dramatically increase your sample size. 3) Attempt to find and/or deconstruct the RNG so that you can pinpoint exactly what the drop rate is. This could be an hour's work or several months' work, depending on the game. 4) Attempt to characterize the drop rates. It's likely that the drop rates are not completely arbitrary (if they are, you are screwed!), but instead some integer fraction of 10 or some integer fraction of 256 or the reciprocal of an integer, etc. If you can characterize how they chose the drop rates based on your limited number of samples (beware of errors arising from small sample sizes), you may be able to pare down your null and alternative hypotheses to give you more definitive p-values. 5) Similar to option 2, find a few dozen close friends to run the game and report their drop rates, then take the aggregate statistics. Option 1 is useless for low drop rates. Options 2 and 3 depend on the game and system being emulated. Option 4 is nice, but would likely rely on option 2 being used in conjunction with it. I consider option 5 a last resort, but I think TASVideos would be happy to help if it seemed worthwhile. If I were running the game, I'd first try option 3, then option 2 and option 4, finally begging for option 5 before giving up and settling on option 1.
Editor, Expert player (2079)
Joined: 6/15/2005
Posts: 3282
Interesting. All this talk about statistical probability and philosophy for a practical problem! Anyway, here's the upshot. From a practical (TAS, I suppose) standpoint, concerning yourself with finding the exact probability of a rare drop, or debating about it, is useless because it doesn't tell you how to control the game to give you that rare drop. The only thing that tells you how is RNG analysis. Statistics won't help you here. Strangely enough, analyzing the RNG most likely tells you the exact probability! Failing that, you could just run a script to go through millions of battles. But that is neither fast nor easy. It is not insightful in the least, and is only of use for those who want to construct online battle simulators.
Player (80)
Joined: 8/5/2007
Posts: 865
You are basically correct on all counts, FractalFusion, but there is the possibility that Tub wants to find the drop rate in a Wii, PS3, or X-Box 360 game (none of which have reliable emulators) so that he can make a guide, not a TAS. If that is the case, he is limited to options 1 and 5 and possibly option 4. I also re-evaluated the problem using the central limit theorem and assuming a normal distribution. The expected value for p=0.4 and 100 samples is 40 and the standard deviation is sqrt(100*0.4*0.6) = 4.899. Obtaining 48 successes is therefore (48-40)/4.899 = 1.633 standard deviations away from the expected value. We then integrate the standard normal distribution from 1.633 to infinity and multiply it by two (it's a two-tailed test) to obtain a p-value of 0.10, in decent agreement with my (more accurate) p-value of 0.12 obtained directly from the binomial distribution. I guess it wasn't as hard as I thought.
Tub
Joined: 6/25/2005
Posts: 1377
just a small aside, because I need to get to work: the game in question is an online-game, so I can neither add lua scripts, nor disassemble, nor observe the RNG. Conversely, I'm not interested in manipulating these drops (I wish I could!), but simply in having knowledge of the game; not for a guide but for a wiki. Tested drop rates are all I got. (Well, not just for knowledge per se. You could base item or gold gathering decisions upon the drop rates. Monster A takes ta seconds to kill and has a pa drop rate, Monster B takes tb seconds and has pb. Which one do I hunt? That's why said wiki often lists drop rates as #drops/#kills, which I feel is inadequate.)
[..]central limit theorem[/..]
Wouldn't that again require large amounts of samples? Reading your post, it occurred to me that I could just formulate an infinite number of H0's and define my confidence range as "all possible drop rates I cannot exclude with p<5%". That does indeed get rid of the prior probabilities, I'll have to see how the math turns out and which values I get. Though the result wouldn't be a confidence interval any more, so it's a completely different statement I'm going to make.
m00
Player (80)
Joined: 8/5/2007
Posts: 865
Tub wrote:
just a small aside, because I need to get to work: the game in question is an online-game, so I can neither add lua scripts, nor disassemble, nor observe the RNG. Conversely, I'm not interested in manipulating these drops (I wish I could!), but simply in having knowledge of the game; not for a guide but for a wiki. Tested drop rates are all I got.
Take option 5, then do your best to incorporate option 4 if you think you see a pattern emerging. If the game is even mildly popular, I'm sure there's a forum out there that would be willing to enlist their help.
Tub wrote:
[..]central limit theorem[/..]
Wouldn't that again require large amounts of samples?
Yep. My understanding of the central limit theorem is that it tends to apply to almost any distribution after 30 or more successes or failures (whichever is more rare). There may be pathological counterexamples, but those tend to be rare and uninteresting/unrealistic. I assure you, however, that if your sample size is small, you're SOL. That's why you'll need to enlist the help of some "friends".
Tub wrote:
Reading your post, it occurred to me that I could just formulate an infinite number of H0's and define my confidence range as "all possible drop rates I cannot exclude with p<5%". That does indeed get rid of the prior probabilities, I'll have to see how the math turns out and which values I get. Though the result wouldn't be a confidence interval any more, so it's a completely different statement I'm going to make.
Yeah... Although that isn't the most scientifically sound method, I believe it's technically valid as long as you don't say anything like, "There is a 90 percent chance that p is between 48 and 52." If nothing else, it's good that you specified the p-value you're looking for in advance. Once you start "moving the goalposts", your analysis loses much of its heft. Sounds like a fun project! Good luck!
Active player (287)
Joined: 3/4/2006
Posts: 341
Tub wrote:
Reading your post, it occurred to me that I could just formulate an infinite number of H0's and define my confidence range as "all possible drop rates I cannot exclude with p<5%". That does indeed get rid of the prior probabilities, I'll have to see how the math turns out and which values I get. Though the result wouldn't be a confidence interval any more, so it's a completely different statement I'm going to make.
This would indeed be a confidence interval.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Ok, time for a Portal 2 reference: Does the set of all sets contain itself?
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
I'll prove that the universal set doesn't exist (as long as ZFC is considered) by reductio ad absurdum. Suppose the universal set U exists. Therefore, by the axiom of specification, the following set exists: S = {x E U | x is not an element of x } Since S E U, we can conclude that S is an element of S iff S is not an element of S, which is absurd. Therefore, the universal set doesn't exist. Since the question assumes that a universal set exists (a false proposition), everything can be proved and both yes/no answers will be correct.
Tub
Joined: 6/25/2005
Posts: 1377
Alright, I don't have friends, and most gamers would rather just play than maintain spreadsheets. Counting drops is trivial (look at your inventory), counting how many foes you killed on your way there is not; it requires some listkeeping which will slow down your farming. I've tried asking, there aren't many who contribute numbers. I've tried the H0-approach. Your 48 drops of 100 kills yield: 95% confidence: 38.13% - 58.00% 99% confidence: 35.50% - 61.00%
Tub wrote:
I throw the coin 10 times and get 9 tails (0) and 1 heads (1) x_m = 0.1 sigma_m = sqrt( ( 9*0.1^2 + 1*0.9^2) / 10*11 ) = 0.09045
old method (95%): 0% - 27.73% H0-method (95%): 0.51% - 45% H0-method (99%): 0.10% - 51.23% and to have a comparison with my prior-probability-attempt: bayes (64.41%): 1% - 19% H0-method (64.41%): 4.30% - 25%
Tub wrote:
Now I do this again, 100 times, getting 10 heads. x_m still 0.1 sigma_m = sqrt( ( 90*0.1^2 + 10*0.9^2) / 100*101) = 0.02985
old method (95%): 4.15% - 15.85% H0-method (95%): 5.45% - 17.50% H0-method (99%): 4.24% - 20.50% These numbers look a lot better. The first approach doesn't always exclude 0%, and I'm 100% confident it's not 0%. so.. should I just pick the numbers that look best? o_O Unfortunately, I have no formula to get the interval, I'm using a binary search until it's narrowed down sufficiently. Which sucks, because I see no way to implement it in oocalc. Simple formulas don't support loops, and touching the macro-functions has lead to a surprising amount of oocalc-crashes. :/
Nitrodon wrote:
Tub wrote:
Though the result wouldn't be a confidence interval any more, so it's a completely different statement I'm going to make.
This would indeed be a confidence interval.
According to everything said in this thread, there are two wildly different methods to generate those intervals, both yield vastly different numbers - yet both are considered perfectly fine confidence intervals? How is that possible? Isn't there a strict formal definition for that term?
m00
Joined: 7/16/2006
Posts: 635
Warp wrote:
Ok, time for a Portal 2 reference: Does the set of all sets contain itself?
All sets contain themselves, so yes. Of course, one can point out that the set of all sets doesn't exist. But then it's still true that it contains itself, as all statements are true of nonexistent objects. Portal 2 badly misquoted Russel's Paradox there.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
petrie911 wrote:
All sets contain themselves, so yes.
According to the Wikipedia page about Russell's paradox, not all sets contain themselves. The example of the set of all squares is given (because the set itself is not square).
Tub
Joined: 6/25/2005
Posts: 1377
I figured it out. Although I doubt anyone else needs it, here's the open office macro code drop. JavaScript used to crash, so I had to use basic. Ugh. Usage: DROPRATE(kills, drops, confidence) e.g. =DROPRATE(100, 48, 95) Syntax highlighting is slightly off because the forum doesn't seem to know vbasic syntax.
Language: basic

Dim fun as Object Function DropRate_PValue(p, n, m) Dim expected, offset as double Dim high, low as double Dim pval as double Dim args(1 to 4) as Variant Dim rargs(1 to 2) as Variant expected = p*n offset = abs(m - expected) pval = 0 high = expected + offset if (high <= n) then rargs(1) = high rargs(2) = 1 high = fun.CallFunction("ceiling", rargs() ) args(1) = n args(2) = p args(3) = high args(4) = n pval = pval + fun.CallFunction( "B", args() ) end if low = expected - offset if (low >= 0) then rargs(1) = low rargs(2) = 1 low = fun.CallFunction("floor", rargs() ) args(1) = n args(2) = p args(3) = 0 args(4) = low pval = pval + fun.CallFunction( "B", args() ) end if DropRate_PValue = pval End Function Function DropRate_BinarySearch(dir, low, high, n, m, target, iter) Dim test, pval as double test = (high+low)/2.0 if (high - low < 0.00001) then DropRate_BinarySearch = test Exit Function end if if (iter > 20) then DropRate_BinarySearch = -1 Exit Function end if pval = DropRate_PValue(test, n, m) if (dir * pval > dir * target) then DropRate_BinarySearch = DropRate_BinarySearch(dir, test, high, n, m, target, iter+1) else DropRate_BinarySearch = DropRate_BinarySearch(dir, low, test, n, m, target, iter+1) end if End Function Function DropRate(n, m, confidence) Dim expected as double Dim a, b as double fun = createUnoService( "com.sun.star.sheet.FunctionAccess" ) if (m > n) then DropRate = "#ERR n > m" Exit Function end if expected = m / n confidence = (100-confidence) / 100 a = DropRate_BinarySearch(-1, 0.0, expected, n, m, confidence, 0) b = DropRate_BinarySearch( 1, expected, 1.0, n, m, confidence, 0) DropRate = Format(a*100, "0.00") & "% - " & Format(b*100, "0.00") & "%" End Function
Thanks for your help, everyone!
m00
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Since we are two pages after and it's highly unlikely that anyone will attempt my problem, I'll do a part of it.
p4wn3r wrote:
Suggestion: Use a change of variables that rotates the axes by an angle of 45º
Hey, that's useful! Let's use two new axes u and v that are rotated 45º counterclockwise to x and y. We can do this algebraically by using a rotation matrix: However, to use a change of variables, we need to know x and y in terms of u and v. Fortunately, any rotation matrix is orthonormal and its inverse is simply its transpose: In order to do the variable change, we need to evaluate the absolute value of the determinant of the Jacobian matrix and multiply it by integrand: The function to be integrated, in this new coordinate system becomes: Now, for the hardest part when working with multiple integrals, finding its bounds. For this, we use a geometric argument. In the xy-system, the domain of integration is the square [0,1] x [0,1]. In the uv-system, it's still a square, but it's rotated so that the u-axis cuts its diagonal, having positive orientation from u=0 to u=sqrt(2) (the length of the diagonal). Using analytic geometry, we can see that the square's sides are determined by the lines of equations: v = u v = -u v = sqrt(2) - u v = -sqrt(2) + u Now, the order of integration, we need to specify it so that we can apply Fubini's theorem and iterate the integral. Integrating on u first allows us to express the entire region in one integral, but the integrand won't have an elementary primitive, so we're screwed. Then, let's try integrating on v first. For this, we separate the rotated square into two regions, one from 0<u<sqrt(2)/2 and the other from sqrt(2)/2<u<sqrt(2). In the first one, keeping u fixed, we see that the smallest v is on the line v = -u and the largest on v=u. For the second one, still keeping u fixed, the smallest v = -sqrt(2) + u and the largest v = sqrt(2) - u. Thus, we sum the integrals on those two regions to obtain: Anyone up for it now?
Joined: 7/16/2006
Posts: 635
Warp wrote:
petrie911 wrote:
All sets contain themselves, so yes.
According to the Wikipedia page about Russell's paradox, not all sets contain themselves. The example of the set of all squares is given (because the set itself is not square).
Not all sets are elements of themselves, but all sets contain themselves. A contains B if all elements of B are also elements of A, which is distinct from B being an element of A.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
petrie911 wrote:
Warp wrote:
petrie911 wrote:
All sets contain themselves, so yes.
According to the Wikipedia page about Russell's paradox, not all sets contain themselves. The example of the set of all squares is given (because the set itself is not square).
Not all sets are elements of themselves, but all sets contain themselves. A contains B if all elements of B are also elements of A, which is distinct from B being an element of A.
I think the original "does the set of all sets contain itself" meant that the set contained itself as an element. The question wouldn't make sense otherwise. Like that, it makes sense: If it's the set of all sets, and it itself is a set, then one of the elements should be the set itself. However, if that element is also a set of all sets, it's one that does not contain its parent set, which is contradictory.
arflech
He/Him
Joined: 5/3/2008
Posts: 1120
It is possible to have an infinite chain of elemental self-containment (or even an uncountably-large branching structure, like a set A={A,A}, which can be expanded as {{A,A},{A,A}} and so on); the paradox that you may have thought of is considering "the set of all sets that are not elements of themselves" because it is an element of itself if and only if it is not an element of itself, and this consideration is what leads out of naïve set theory into such concepts as "proper classes." Now I just thought of an interesting computational exercise, which I shall attempt to solve because although it is interesting, it's not that hard for someone with a Calculus II background... Find all linear real-valued functions of real variables with the property that the uniform lamina bounded by the graphs of that function and y=x^2 has a center of mass on the y-axis; then for any c>0, find all such functions for which the center of mass of this lamina is (0,c). These functions are of the form ax+b, and the points of intersection are where x^2-ax-b=0, or A=(a-sqrt(a^2+4b))/2 and B=(a+sqrt(a^2+4b))/2 (so b>-a^2/4); then having the center of mass on the y-axis means that the x-coordinate is 0, so the numerator of the center-of-mass expression must be 0, so Int(bx+ax^2-x^3,x,A,B)=0 The antiderivative is bx^2/2+ax^3/3-x^4/4, so the integral (thanks to Wolfram Alpha) is a*(a^2+4b)^(3/2)/12, which is 0 when a=0 or b=-a^2/4; however only the former case is tenable, because the latter (as intimated above) would lead to a line tangent to the graph of x^2 at (a/2,a^2/4) (leading to an area of 0 and an x-coordinate of 0/0), so all of these functions are constant. Then we can re-parameterize the boundaries (y=x^2 and y=b) in terms of functions of y, as -sqrt(y) and sqrt(y), ranging from 0 to b, and then the equation for the y-coordinate of the center of mass can be rearranged into Int(2y^(3/2),y,0,b)=c*Int(2sqrt(y),y,0,b) which becomes (4/5)b^(5/2)=c*(4/3)b^(3/2) so b=(5/3)c. As an extension, let's consider the set of linear functions for which the center of mass lies on the same vertical line as the midpoint of the linear boundary of this lamina; it turns out that the center of mass *always* lies on the same vertical line as the midpoint of the boundary of the lamina. For the next part, using an alternate formula for the center of mass, we have c=(1/2)Int(b^2+2abx+a^2*x^2-x^4,x,A,B)/Int(b+ax-x^2,x,A,B)=2a^2/5+3b/5, or equivalently, b=5c/3-2a^2/3; because b>-a^2/4, this means 5c/3>(2/3-1/4)a^2, so 5c/3>5a^2/12, so c>a^2/4, which because a may be any real number means c can be any positive real. Then the linear functions are of the form ax-2a^2/3+5c/3; in terms of any desired center of mass (C,c), C=a/2, so a=2C and the functions are the form 2Cx-8C^2/3+5c/3. Interestingly this expression still makes sense if c<0, so let's, as an example, try to find the center of mass of the infinite lamina bounded by x^2 and x-1; in this case, C=1/2 and c=-1/5. However, integrating from -r to r in the expression for x-coordinate and letting r approach infinity yields -1, while instead using the limits -r+1/2 and r+1/2 yields 1/2 (even without letting r approach infinity), so this is obviously inconsistent; even worse, the expression for y-coordinate approaches positive infinity.
i imgur com/QiCaaH8 png
Banned User
Joined: 6/18/2010
Posts: 183
Let a1 through an be real numbers such that: What is the maximum possible value of a1a2 + a2a3 + ... + ana1?