# Tag Info

## Hot answers tagged probability-and-stats

18

A nice question. Sampling from tCopula is done in stages. First a sample is generated from the copula with uniform marginal distributions, and then quantiles of appropriate marginal distributions are applied to the respective slots. Most of the time goes into evaluation of these quantiles, and they are expensive to compute. Being interested in $\geqslant ... 15 The biggest issue you are running in to is that you have to recompute the density estimates each time you sample a new point. You need the estimators to be pre-evaluated. data1 = RandomVariate[ MultinormalDistribution[{-1.5, 0}, {{2, 0}, {0, 1}}], {10}]; data2 = RandomVariate[ MultinormalDistribution[{1.5, 0}, {{2, 0}, {0, 1}}], {10}]; I have a ... 12 The executive summary You can use the built-in Ellipsoid function directly with your calculated mean and covariance. For 95% confidence, use: Ellipsoid[mean, 6 cov] That expression returns an Ellipsoid object that you can visualize as an Epilog to a ListPlot, or as an argument to Graphics (further formatting below). Ellipsoids for other common critical ... 11 Following the method on the wikipedia page mentioned in the comments, I came up with this interp[pts_] := Module[{delta, mlst, zeropos, tau, h00, h01, h10, h11}, delta = #2/#1 & @@@ Differences[pts]; mlst = Flatten[{delta[[1]], MovingAverage[delta, 2], delta[[-1]]}]; tau = Min[#, 1] & /@ (3 delta/Sqrt[(Most[mlst]^2 + Rest[mlst]^2)]); tau ... 10 The code in Heike's answer is a bit long, but only because it does not exploit the fact that piecewise Hermite interpolation is already supported by Mathematica as Interpolation[]. Thus, here is a shorter way to implement Fritsch-Carlson monotonic cubic interpolation: fcint[data_] := Module[{del, slopes, tau}, del = #2/#1 & @@@ ... 10 Add the argument "Probability" to the Histogram command. To be precise, if list is your list of data, then Histogram[list,Automatic,"Probability"] should do the trick. The Automatic argument specifies the bin size. 8 Let's make a set of points: pts = Select[RandomReal[{-1, 1}, {1000, 2}], Norm[#] < 1 &]; ListPlot[pts, AspectRatio -> Automatic] Construct the density and plot it, including a contour line at the manually selected value of 0.1, all in one go: g = SmoothDensityHistogram[pts, Mesh -> {{.1}}, PlotRange -> 1.5 {{-1, 1}, {-1, 1}}] Use ... 8 list = {{3, 5}, {7, 6}, {15, 6}, {23, 123}} DeleteCases[list, {x_, _} /; x < 10] DeleteCases[list, {_?(# < 10 &), _}] Cases[list, {x_, _} /; x >= 10] Cases[list, {_?(# >= 10 &), _}] Select[list, First[#] >= 10 &] Pick[list, First[#] >= 10 & /@ list] list /. {x_, _} /; x < 10 :> Sequence[] list /. {_?(# < ... 8 InverseSurvivalFunction[] is the nearest to what you want; for a given confidence level$\alpha$and degree of freedom$\nu$, InverseSurvivalFunction[ChiSquareDistribution[ν], α] gives the result you want. Alternatives include InverseCDF[ChiSquareDistribution[ν], 1 - α] and Quantile[ChiSquareDistribution[ν], 1 - α]. 7 TransformedDistribution contains a collection of identities known to it, like that of sum of normals being equal in distribution to another normal random variable, and a general machinery to work out properties of the functions of random variables. Most of the time the computation will be done by the general machinery, which relies on solvers, like ... 7 Update: The link in the late Jens-Peer Kuska's MathGroup post is no longer working, and it seems there are no other locations on the web to download the package from. So, here I post the contents of the package with gratitute to Jens-Peer Kuska for his continuing service to the Mathematica community. Nonparametric Splines package - Jens-Peer Kuska ... 7 Perhaps use UnitStep and Mean. This should be pretty fast. f[logr_, x_] := Mean[UnitStep[logr - x]] f[logr, 0] (*1597/3018*) Now to plot it. Plot[f[logr, t], {t, -.1, .1}, Exclusions -> None] 7 The natural way is to use RectangleChart since your data is already processed. I will just show how to use Histogram for your purposes, it requires step back to create the data, that's why Mike's solution is better. data = {{{0, 17}, {17, 24}, {24, 44}, {44, 64}, {64, 84}}, {86031, 26671, 91927, 93983, 32232}}; dat = RandomReal[#, ... 7 Based solely on the information provided IMO you need to use RectangleChart. I'm not sure how to create the histogram you desire using Histogram and only the information in your question -- here is the RectangleChart implementation: {widths, totals} = {{17, 7, 20, 20, 20}, {86031, 26671, 91927, 93983, 32232}}; RectangleChart[Transpose@{widths, ... 6 EmpiricalDistribution can assign probabilities to each element in a set of discrete values: Here's an example: In[1]:= d = EmpiricalDistribution[{1/3, 1/2, 1/6} -> {1, 2, 3}]; In[2]:= Mean[d] Out[2]= 11/6 In[3]:= PDF[d, x] Out[3]= 1/3 Boole[1 == x] + 1/2 Boole[2 == x] + 1/6 Boole[3 == x] In[4]:= CDF[d, x] Out[4]= 1/3 Boole[1 <= x] + 1/2 Boole[2 ... 6 Alternatively you can fix both the bin end points and their heights explicitly. I've set 120 as a reasonable endpoint for the last bin. The zero in the input data is just there as a place holder and is effectively ignored. Histogram[{0}, {{0, 18, 25, 45, 65, 120}}, {86031/17, 26671/7, 91927/20, 93983/20, 32232/20} &] I would use the rectangle ... 6 As far as I know there are no test suites that can be invoked directly from Mathematica. One can of course use the traditional ones such as the one you mention or the NIST or the Marsaglia's diehard tests. I implemented some "toy tests" in this Wolfram Demonstration to illustrate Mathematica's various built-in PRNGs, which fail or succeed the toy tests ... 6 With the help of comments on this and other stackexchange pages I managed to solve the problem of how to use custom distributions in things like CopulaDistribution (and other functions like RandomVariate, Expectation, etc), and given that it took me a couple of days’ hard slog I thought I’d share my discoveries with this community. Please excuse the flippant ... 6 Pure GammaDistribution does not seem at all like a good fit even visually. You need probably a MixtureDistribution. You could BTW skip NonlinearModelFit and start playing with FindDistributionParameters. But I think you are better of trying out latest WL function FindDistribution. In automated regime it finds almost what you need: dis = ... 5 If we reformulate your question as: Given a box with 30 balls, of which 10 are red, what is the probability that 4 balls drawn at random (without replacement) don't have any red balls in them you can model it by the HypergeometricDistribution: A hypergeometric distribution gives the distribution of the number of successes in$n$draws from a ... 5 You could set this up in symbolic form as a bivariate distribution with pmf$f(x,y)$: Then, using the mathStatica add-on to Mathematica, the correlation you seek is: Corr[{x, y}, f]$\frac{607}{\sqrt{1467199}}\$ Note that this is slightly different to the solution you posted,as the numerical value is: 0.501123... (not 0.0501). You can make Mma do ...

5

You can use DistributionDomain to find the domain of a distribution, which will also tell you the dimension. I do not know where this is documented, but it does appear in some examples in the documentation. Usage examples: DistributionDomain[NormalDistribution[]] (* Interval[{-∞, ∞}] *) DistributionDomain[ParetoDistribution[xmin, alpha]] (* ...

5

You can use ProbabilityDistribution to define your own probability distribution from a CDF: dist = ProbabilityDistribution[{"CDF", 1/2 Erfc[(0.1 - x)/(Sqrt[2] 1.2)]}, {x, -∞, ∞}] With some data data = RandomVariate[NormalDistribution[], 50]; you can now perform KolmogorovSmirnovTest[data, dist]

4

Assuming you have version 9 you can do the following. data = {{-1, 0}, {0, 0}, {1, 0}, {-2, 1}, {2, 1}, {-1, 3}, {1, 3}}; dist = EmpiricalDistribution[data]; Table[Expectation[y \[Conditioned] x == i, {x, y} \[Distributed] dist], {i, -2, 2}] (*{1, 3/2, 0, 3/2, 1}*) Note: Conditional probabilities and expectations didn't work for EmpiricalDistribution ...

4

The Wolfram Demonstration Project has 13 submissions that use Bayes Theorem: See here More specifically: Probability Of Being Sick After Having Tested Positive For A Disease Bayes's Theorem And Inverse Probability Total Probability And Bayes's Theorem All of these will have downloadable code to help you learn this. Good luck.

4

1) Using QueueingNetworkProcess to define such a queuing process With the customer arrival rate arrivalRate and the service rates at each server being serviceRate1, serviceRate2, and serviceRate3, respectively, you can define this queuing process by g = {arrivalRate, 0, 0}; m = {serviceRate1, serviceRate2, serviceRate3}; r = {{0, 1, 0}, {0, 0, 1}, {0, 0, ...

4

There is a undocumented input form such as: DegreeGraphDistribution[indegree, outdegree] For example: g = RandomGraph[ DegreeGraphDistribution[{1, 3, 3, 1, 2}, {3, 1, 3, 2, 1}]]; VertexInDegree[g] {1, 3, 3, 1, 2} VertexOutDegree[g] {3, 1, 3, 2, 1}

4

Something like this? Show[{Plot[PDF[NormalDistribution[], x], {x, -4, 4}, AxesLabel -> {None, "Z"}], Plot[PDF[NormalDistribution[], x], {x, 2, 4}, AxesLabel -> {None, "Z"}, Filling -> Bottom]}] The easiest for the label is to add them with the drawing tools

3

Here is a way that could give the same answer as FindDistributionParameters, however I further assume that γ>0. Please see the code below: LG[x_] = Log[ G[x]] /. {σ -> Exp[s], γ -> Exp[t]} //. {Log[ Times[x__, y_]] :> Log[x] + Log[y], Log[x_^y_] :> y Log[x]} NMaximize[{Total[LG[data]], μ < Min[data] + Exp[s - ...

3

As I pointed out in the comments I don't believe you will be able to use built-in tests to compute this. The Kolmogorov-Smirnov test requires that you can compute the CDF of the distribution. Unfortunately, ProbabilityDistribution seems to convert to PDF even if you create it with the CDF. Then it reverts back to the definition for CDF when it tries to ...

Only top voted, non community-wiki answers of a minimum length are eligible