Wikipedia:Reference desk/Archives/Mathematics/2017 March 26
Mathematics desk | ||
---|---|---|
< March 25 | << Feb | March | Apr >> | March 27 > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
March 26
editCross product derivative
editHow to prove
without any guessing and checking both sides, because doing that sounds to me like assuming the equation is already true? יהודה שמחה ולדמן (talk) 18:45, 26 March 2017 (UTC)
- You can just write x and y (vector valued functions) componentwise, and then apply the definition of the cross product, and use the product rule for the derivative. No guessing required (or assuming anything you shouldn't). --Deacon Vorbis (talk) 19:14, 26 March 2017 (UTC)
- The same as with any other product of functions – using the derivative's definition and properties of limits:
- Ruslik_Zero 19:42, 26 March 2017 (UTC)
- The same as with any other product of functions – using the derivative's definition and properties of limits:
OK, almost done. But how do you prove distribution ? And is it distributive also over subtraction? יהודה שמחה ולדמן (talk) 21:11, 26 March 2017 (UTC)
- Fine, I had to find it myself:
Statistics in the REAL WORLD with cupcakes
editThis is NOT a homework problem but I want to know how to do statistics in the REAL WORLD. Say I sell cupcakes in my store and everyday I baked 100 cupcakes before I open my store for business. My customers buy cupcakes from me and sometimes I have to turn away customers because I have sold out all my cupcakes. If the cupcakes are very costly to make and I cannot afford to make lots and lots of cupcakes because any cupcakes not sold is costing me money.
I have reason to believe the number of cupcakes my customers want to buy in a day is a normal distribution. But how can I calculate its value (aka mean and variance) when my data is something like this. Note: 100+ means I sold 100 cupcakes and had to turn away customers due to lack of cupcakes.
Data is {88,98,88,100+,96,100+,71,98,92,98,83,99,91,95,96,100+,100+,81,100+,91,98,76,100,90,96,98,96,95,96,96}
148.182.26.69 (talk) 23:40, 26 March 2017 (UTC)
- If this is the data you have available, what you want is Maximum likelihood estimation. The normal distribution has two parameters, mean and standard deviation . Given the parameters, you can calculate the probability density of your data . Each datapoint contributed a multiplicative term to the density - for the exact numbers you use the PDF and for ranges you use the CDF. Once you have this expression, you need to find the values of the parameters that maximize it.
- In practice you will generally maximize the logarithm of the density rather than the density itself. It is equivalent but easier to work with.
- For the data you gave, for example, the result is . -- Meni Rosenfeld (talk) 23:55, 26 March 2017 (UTC)
I got mean=94.5 and stdev=8.55 using the Maxima source code below.
data: [88,98,88,-101,96,-101,71,98,92,98,83,99,91,95,96,
-101,-101,81,-101,91,98,76,100,90,96,98,96,95,96,96];
datapdf:sublist(data,lambda([x],x>=0));
(datapdf)[88,98,88,96,71,98,92,98,83,99,91,95,96,81,91,98,76,100,90,96,
98,96,95,96,96]
datacdf:-1*sublist(data,lambda([x],x<0));
(datacdf)[101,101,101,101,101]
log10(x):=log(x)/log(10);
scoreindpdf(x,mean,std):=float(log10(pdf_normal(x,mean,std)));
scorevectorpdf(vector,mean,std):=apply("+",map(lambda([x],scoreindpdf(x,mean,std)),vector));
scoreindcdf(x,mean,std):=float(log10(1-cdf_normal(x,mean,std)));
scorevectorcdf(vector,mean,std):=apply("+",map(lambda([x],scoreindcdf(x,mean,std)),vector));
score(mean,std):=scorevectorpdf(datapdf,mean,std)+scorevectorcdf(datacdf,mean,std);
result:create_list([score(mean,std),mean,std],
mean,makelist(mean,mean,80,110,1),
std,makelist(std,std,5,10,(10.0-5.0)/20.0)
)$
resultsorted:sort( result,lambda([a, b], a[1] > b[1]) )$
resultsorted[1];
[-40.91674328487642,95,8.75]
result:create_list([score(mean,std),mean,std],
mean,makelist(mean,mean,90,100,(100.0-90.0)/20.0),
std,makelist(std,std,5,10,(10.0-5.0)/20.0)
)$
resultsorted:sort( result,lambda([a, b], a[1] > b[1]) )$
resultsorted[1];
[-40.89760668032743,94.5,8.5]
result:create_list([score(mean,std),mean,std],
mean,makelist(mean,mean,93,96,(96.0-93.0)/20.0),
std,makelist(std,std,6,9,(9.0-6.0)/20.0)
)$
resultsorted:sort( result,lambda([a, b], a[1] > b[1]) )$
resultsorted[1];
[-40.89675859882708,94.5,8.55]
148.182.26.69 (talk) 01:28, 28 March 2017 (UTC)
- "I have reason to believe the number of cupcakes my customers want to buy in a day is a normal distribution."
- In a real world situation you would not make that assumption as you would end up severely underestimating the effects outliers. The normal distribution breaks down a few standard deviations away from the mean, beyond this region it will give astronomically low probabilities while in the real world such events will have a low, but not astronomically low probability. Count Iblis (talk) 22:09, 28 March 2017 (UTC)
As the number of cupcakes sold is a non-negative integer, the distribution is not a normal distribution, which assumes both negative and non-integer values. It is more reasonable to assume a Poisson distribution. Note that the Poisson distribution has mean value L and standard deviation √L, so there is only one parameter to estimate. Replacing 100+ with 101, your 30 data values have mean value 93.7 and standard deviation 9.7. Now the problem is to find a number L such that the Poisson distribution with parameter L, truncated such that outcomes greater than 101 are replaced by 101, have mean value 93.7 and standard deviation 9.7. I haven't got the time to do it right now. Bo Jacoby (talk) 10:53, 29 March 2017 (UTC).
- If there are N potential customers in town who each day decide independently from each other and from their past decisions to buy a cupcake or not with probability p each, the resulting binomial distribution is close to a Gaussian with mean pN and variance Np(1-p). That sounds to me like a reasonable model, at least compared to the simplest Poisson-yielding alternative of a constant stream of many possible customers that decide or not to go through the door. TigraanClick here to contact me 11:11, 29 March 2017 (UTC)
- It has mean pN and variance Np(1-p), but it is not necessarily close to a Gaussian. If N is big and p is small, then it is close to a Poisson distribution. Bo Jacoby (talk) 23:20, 29 March 2017 (UTC).
- ...but also to a Gaussian near the mean. Going by the original post, the cupcake-maker wants to optimize for the average day, and does not really care if he made tons of additional cupcakes or refuses tons of customers once every zillion years. So the shape of the tails does not really matter here; and then, if N is small, Gaussian is better, and if N is large both Gaussian and Poisson are equivalent.
- Yes, the problem would be quite different if (say) customers are irritable mafiosi and the cupcake maker puts the highest priority on being able to serve all customers no matter the cupcake waste; but even then, I doubt it would be wise to use the Poisson approximation for the tails, even if it is better than the Gaussian. TigraanClick here to contact me 11:18, 30 March 2017 (UTC)
- If Np=1 and N is big, then the binomial distribution does not at all look like a Gaussian, but very much like a Poisson with L=1. Bo Jacoby (talk) 21:23, 30 March 2017 (UTC).
- But Np is much greater than 1 (by the dataset presented, a reasonable estimate would be around 90-100), and a Poisson with L>>1 is very similar to a Gaussian near the center (which, again, is the area of interest). TigraanClick here to contact me 15:15, 31 March 2017 (UTC)
- It has mean pN and variance Np(1-p), but it is not necessarily close to a Gaussian. If N is big and p is small, then it is close to a Poisson distribution. Bo Jacoby (talk) 23:20, 29 March 2017 (UTC).
A Poisson distribution with parameter 95.5, truncated such that outcomes greater than 100 are replaced by 101, has mean value 93.7 and standard deviation 7.3. The following J code did the brute force calculation.
n=.i.150 f =. 3 : '({.,%:&({:-*:&{.))}.(%{.)+/((101<.n)^/i.3)*(y^n)%!n'"0 5j1":f 95 95.5 96 93.4 7.5 93.7 7.3 94.1 7.2