New answers tagged

3

This is a naive approach, so I wonder if I am overlooking some complication here; I would have thought that, given the description of your distribution, you could consider the "solid of revolution" generated by rotating the PDF of a normal distribution with the required parameters around the vertical $z$ axis, so something like the following: ...


7

An alternative, and faster, way to generate samples with the desired distribution using TransformedDistribution: ClearAll[distF] distF[r_, σ_] := TransformedDistribution[{(r + d ) Sin[θ], (r + d ) Cos[θ]}, {Distributed[d, NormalDistribution[0, σ]], Distributed[θ, UniformDistribution[{0, 2 Pi}]]}] ListPlot[RandomVariate[distF[5, .5] , ...


4

Sorry for the trouble - I have found a way: data = Table[fTorusRand[5, 0.5], {i, 1, 100000}]; empD1 = SmoothKernelDistribution[data]; ContourPlot[PDF[empD1, {x, y}], {x, -8, 8}, {y, -8, 8}] Gives me what I want: Edit: So using the Jacobian here, I can get an exact PDF. Still messing around with the algebra though: $x = (r+d) sin(\theta)$ and $y = (r+d) ...


3

response = {{"N","D","S","C","C"},{"N","D","S","C","C"}, {"Y","R","C","T","T"},{"N","D","S","C","C"}, {"Y","D","C","C","C"},{"Y","R","C","K","T"}, {"Y","R","C","T","T"},{"Y","D","S","C","C"}, {"Y","R","C","T","T"},{"Y","R","C","T","T"}, {"N","D","S","C","T"},{"Y","D","C","K","T"}}; In order for ...


2

A PDF is not a distribution. To convert a PDF to its associated distribution use ProbabilityDistribution Clear[λ, pb, Ps, μ] f[h_] := 1/Gamma[m]*(m/P)^m*h^(m - 1)*Exp[-(m*h)/P]; m = 1; P = 1; α = 4; δ = 2/α; int = Assuming[{A > 0, r > 0, λ > 0}, Integrate[(1 - Exp[-x*h*r^(-1/δ)])*pb*λ*π, {r, A, Infinity}, GenerateConditions -> False]] ...


2

This is an extended comment. f[h] as defined while clearly a probability density function is not of the type of function that Expectation expects. Consider the difference between the two functions f and g below: f[h_] := 1/Gamma[m]*(m/P)^m*h^(m - 1)*Exp[-(m*h)/P] (* Head *) Head[f] (* Symbol *) (* PDF *) f[h] (* (E^(-((h m)/P)) h^(-1 + m) ...


2

@wolfies essentially gave you the answer in your original question where he wrote PDF[TransformedDistribution[x^2, x \[Distributed] RiceDistribution[v, Sqrt[α/2]]], y] Just change PDF to CDF (and avoid the use of I as @MarcoB recommended): CDF[TransformedDistribution[x^2, x \[Distributed] RiceDistribution[v, Sqrt[α/2]]], y]


1

The discrepancy had to do with the way the walkers were subsequently moved. You have to either move synchronously (on separate threads perhaps) or you have to make it check for a specific case where the walkers are exactly one step away and their next step is towards each other. In other words, if they swap positions then there was a collision. Thanks ...


1

Here is my code for a single walker: singleWalker[] := Module[{ stepTypes = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, pos1 = RandomInteger[{0, 4}, 2] }, Return@Rest@NestWhileList[ Mod[# + RandomChoice[stepTypes], 5] &, pos1, # != {2, 2} & ]; ] Doing walks = (singleWalker[] & /@ Range[1000]); and measuring N@Mean[Length /@ ...


1

(1 - 4/52) .. but its a question you should ask on mathematics forum


5

I am a bit late, but here is a short paper of mine with Wolfram Language code. It covers Bayesian regression as well as model selection. Take notice of the books in the references. Excellent for self study. http://djafari.free.fr/MaxEnt2014/papers/04_paper.pdf


6

This is not answer, but an extremely long comment. I find this problem very interesting, but haven't been able to solve it. In my attempts, I developed a tool to visualize the the two-walker random walk. I am posting this tool because I think it might be useful to the OP or anyone else looking this problem for exploring what's going on. steps = {{0, 1}, ...


5

JasonB beat me to it, but for completeness, there's plenty on circle fittings in this post. I thought you wanted to show the second data set had a larger radius, but now I believe what you really want is the average circle of the two data sets. Regardless, here's another function for finding the center and radius of a circle from a list of coordinates: ...


3

If you are assuming that the data is circular, then you can fit the data to a circle and use the radius and center of that circle. Using a modified form of ubpqdn's function posted here, you can find the center and radius, circfit[pts_] := Module[{reg, lm, bf, exp, center, rad}, reg = {2 #1, 2 #2, #2^2 + #1^2} & @@@ pts; lm = LinearModelFit[reg, ...


2

Thanks for the solution, J.M. (* create an example pdf *) f[x_] := Exp[-x^4 + x^2]; normf = NIntegrate[f[x], {x, -Infinity, Infinity}]; p[x_] = f[x]/normf; Plot[p[x], {x, -2, 2}] (* How to generate samples from p[x] *) pd = ProbabilityDistribution[p[x], {x, -Infinity, Infinity}]; d = RandomVariate[pd, 100000]; Histogram[d, 100]


3

Mathematica makes distinction between $X$ and $\{X\}$ by design: dist = MultivariateHypergeometricDistribution[k, Range@5]; {MarginalDistribution[dist, {1}], MarginalDistribution[dist, 1]} { TransformedDistribution[{[FormalX]}, [FormalX] [Distributed] HypergeometricDistribution[k, 1, 15]], HypergeometricDistribution[k, 1, 15]} ...


3

Does this do what you want? stepTypes = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; {pos1, pos2} = RandomInteger[{0, 4}, {2, 2}]; While[pos1 != pos2, {pos1, pos2} = Mod[{pos1, pos2} + RandomChoice[stepTypes, 2], 5]; Print[pos1, pos2];]


6

This answer is a wild stab in the dark, but here it goes... I assume run times of individual runners to follow normal distribution. Product of all PDFs of individual results is maximized (mean run time of runner at vertex 1 is anchored at 0 to choose a reference point), and resulting distributions are used to compute mean, standard deviation and chance of ...


1

Manipulate[Module[{x, y}, mysoln = Solve[{x, y}.Inverse[( { {a[[1]] a[[1]], \[Rho] a[[1]] a[[2]]}, { \[Rho] a[[1]] a[[2]], a[[2]] a[[2]]} } )].{x, y} == 1, x, Reals] // Quiet; Show[{ ParametricPlot3D[{{x /. mysoln[[1]], y, -.2}, {x /. mysoln[[2]], y, -.2}}, {y, -5, 5}, PlotRange -> {{-5, 5}, {-5, 5}, ...


3

d1 as defined does not evaluate as the distribution is univariate and you are asking it to be bivariate. You could use TransformedDistribution[ x + y, {x, y} \[Distributed] DiscreteUniformDistribution[{{1, 6}, {1, 6}}]]


4

This is an unusual and interesting question. This is a bit obscured by the many parameters that make it difficult to see the wood for the trees. Short Answer Your first pdf, which has the DiracDelta function, is a mixed discrete / continuous random variable. To make this clear, if say $r = 1$, $t = 1$ and $T = 2$, then your mixed pmf/pdf f1 is: f1 = ...


6

Per my comment. Assume things not defined here were as in your example: myDist = TruncatedDistribution[truncate, MultinormalDistribution[{a, b, c, d, e, f, g, h}, covariancematrix]]; myPDF[{a_, b_, c_, d_, e_, f_, g_, h_}, {i_, j_, k_, l_, m_, n_, o_, p_}] = N@PDF[myDist, {i, j, k, l, m, n, o, p}]; Just call myPDF with the lists of current ...


3

If your real covariance matrix is the identity matrix, then all 8 of the random variables are independent and there's no need for the overhead of dealing with a general structure for a multivariate normal. You can construct the truncated distributions separately, generate a random sample from each, and then multiply the 8 probability densities together. ...


2

I agree with the comments. I am uncertain what the aim is, so I apologize if this is unhelpful. I only post to motivate clarification. If the aim is a marginal of mixture of binormals: m1 = MultinormalDistribution[{3, 3}, {{0.5, 0}, {0, 0.5}}]; m2 = MultinormalDistribution[{6, 6}, {{0.6, -0.5}, {-0.5, 0.6}}]; m3 = MultinormalDistribution[{6, 6}, {{1, 0.5}, ...


10

There is a lot around: See Bayesian Statistics and Econometrics using Mathematica http://library.wolfram.com/search/?query=Bayesian&collection=library&x=0&y=0 Google mathematica Bayesian



Top 50 recent answers are included