# Tag Info

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 ... 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 & @@@ ... 9 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 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 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 /. {_?(# < ... 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]] (* ... 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 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] 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 ... 3 First, let's find a in functional form: Probability[Abs[x] < a, x \[Distributed] NormalDistribution[]] which shows that f[a_] := Erf[a/Sqrt[2]] Now you want to solve for the a that has some probability, say 0.1. Then Solve[f[a] == 0.1, a] {{a -> 0.125661}} A little more generally: Solve[f[a] == p, a] {{a -> Sqrt[2] InverseErf[p]}} ... 2 Using assumptions on the aList, namely, that all a[i]s are in the unit interval, we get symbolic results for Expectation: aList = Array[a, {6}]; errors = Array[er, 6]; answers = (Min[1, Max[#, 0]]) & /@ (aList + errors); dlist = {answers[[5]], answers[[6]], answers[[3]]/answers[[1]], answers[[4]]/answers[[2]]}; deltasbetas = Expectation[dlist, errors ... 2 If there is no way to use a "list variable" for the random vector, an explicit list of scalars can be filled in with the right distribution, thanks to @Silvia: underlying := {0.8, 0.7, 0.5, 0.4, 0.8, 0.7} answers := (Min[1, Max[# , 0]]) & /@ (underlying + {e1, e2, e3, e4, e5, e6}) dlist := {answers[[5]], answers[[6]], answers[[3]]/answers[[1]], ... 2 The terms in the total variation distance need to be probability distributions. Here's one way to do it: take any starting vector$m_0$(with nonzero entries that sum to$1$). You can interpret$m_0$as the initial distribution of the states. Then$m_1=m_0\cdot P$is the distribution of the states after one time step,$m_2=m_0\cdot P\cdot P\$ is the ...