Tag Info

7

Mathematica seems to split the integrand component, E^(-((-m + Log[x])^2/(2 s^2))) into E^(-((m^2 + Log[x]^2)/(2 s^2))) times the sort-of "coefficient" E^((m Log[x])/s^2) (* == x^(m/s^2) *) in order to calculate the integral in terms of Meijer $G$. For reasons that are obscure to me, it seems to want the coefficient of m in the exponent to be ...

1

This deserves a little explanation since I found that the behavior is sometimes inconsistent. Take some very simple data and create a function bound that illustrates how we suspect the bounded method is working (by reflecting the data about the bound, computing the estimate with the given bandwidth, and then truncating at the bound). data = {1, 2, 3}; ...

4

Simulate data data = RandomVariate[PowerDistribution[1, 2.5], 10^3]; dist = SmoothKernelDistribution[data]; Plot[CDF[dist, x], {x, 0, 1}] Export Data Export["cdf.xls", Table[{x, CDF[dist, x]}, {x, 0, 1, .01}]];

2

This is my attempt at Probabilistic Bisection Algorithm, as described in the thesis linked by @Szabolcs in the comments. ClearAll[pbaFindRoot]; Module[{initialDistribution, modifyDistribution, outputDistribution, bernoulliTestPowerOneFilter}, initialDistribution[rangemin_, rangemax_] := N@{(rangemin + rangemax)/ 2, {{{0, rangemin}, ...

2

This is a hack to create a function which interoperates at least on some level with FindRoot. Still, it's very much only a starting point. Primary goal of regularize is to attempt keeping values below and above sought root not jumping on the other side. ClearAll@regularize; regularize[f_Function, rootval_, minsigmas_, minsamples_Integer, ...

1

Here's an alternative take. pdf[n_Integer] := Tally@Flatten@Array[Plus, ConstantArray[6, n]] Manipulate[ListPlot[pdf[n]], {n, 1, 5, 1}] Performance is significantly improved (10 dice is bearable). To get the cdf add memoization (because bruteforce computation is costly, but end result is simple) and have this: pdf[n_Integer] := (pdf[n] = ...

2

I figured out a way to do what I was trying to do. Turns out the graph is not that interesting b/c the scale explodes so quickly. In anycase, I believe what I have made use of here (the xx[n] construct) is an "indexed object". Manipulate[ formals = Table[xx[n], {n, 1, a}]; data = {#, 1, 6} & /@ formals; t = Table @@ Prepend[data, formals]; pdf ...

1

If a model with a common variance is appropriate and you are able to (rather than just willing to) ignore any examination of goodness-of-fit, then the following can give you the basic ANOVA elements: (* Give data *) n = {10, 7, 11}; xbar = {2.8, 2.6, 3.1}; s2 = {3.2, 2.9, 3.3}; (* Calculate ANOVA terms *) errorSS = N[Total[s2 (n - 1)]] (* 79.2 *) errorMS ...

2

You can check the next link: https://sites.google.com/site/efialto/lhc_mathematica I check the algorithm against the original source, it works!

8

We can encode one chemist's need of fume cupboards with $0.6 + 0.3 c + 0.1 c^2$. Since they work independently, we may find their simultaneous needs via multiplication: ExpandAll[(0.6 + 0.3 c + 0.1 c^2)^4] (* Output: 0.1296 + 0.2592 c + 0.2808 c^2 + 0.1944 c^3 + 0.0945 c^4 + 0.0324 c^5 + 0.0078 c^6 + 0.0012 c^7 + 0.0001 c^8 *) from which we ...

2

As @Sjoerd C. de Vries states: one really wants to use the raw data. However, your data is binned with (I assume) the bin midpoints along with the associated relative frequency. And ideally you should account for the binning (although in this case it doesn't make much difference in the estimates and because as stated by others the fit is not hot anyway). ...

2

I think there is a problem with your fit expression: you have the argument of Sum wrapped in a list {}, which makes for an awkward output format. I don't see any reason for that. I modified your fit function to remove that extraneous list and I'll use the modified version here (see it at the end of the post). I then imported your data and saved it into a ...

5

This is a perfect place to use WeightedData. dist = EstimatedDistribution[WeightedData @@ Transpose[data], WeibullDistribution[a, b]] Show[ListPlot[data], Plot[PDF[dist, x], {x, 0, 30}]] It is worth noting that observations with zero weights are ignored because they do not contribute to the likelihood.

4

Just a simulation...not as nice as any of the given answers (which I have upvoted...I liked @ciao (rashers) MultinomialDistribution transformed {0,1,2}.{a,b,c}. p[n_, s_] := With[{t = Total /@ RandomChoice[{0.6, 0.3, 0.1} -> {0, 1, 2}, {s, 4}]}, N@Total@Boole[Thread[t <= n]]/s] Calculation of probabilities of success with n fume cabinets: ...

6

Your problem is that you are not fitting raw data to a distribution, you are fitting the emperical PDF of that distribution (probably in terms of values, percentages pairs). That won't work as the functions you are using (I guess EstimatedDistributionor FindDistributionParameters) expect the raw measurement data, not frequencies. To deal with your specific ...

21

dist = TransformedDistribution[b + 2 c, {a, b, c} \[Distributed] MultinomialDistribution[4, {.6, .3, .1}]]; Reduce[CDF[dist, x] >= .95, x] (* x>=4 *) Check: CDF[dist, 4] (* .9585 *) The PMF: DiscretePlot[PDF[dist, x], {x, 0, 8}, ExtentSize -> All, PlotRange -> All] Explanation: ...

12

I think this is one way to approach the problem but I am by no means an expert in this area. dd = MixtureDistribution[{60, 30, 10}, DiscreteUniformDistribution[{#, #}] & /@ {0, 1, 2}]; N @ Probability[w + x + y + z <= n, # \[Distributed] dd & /@ {w, x, y, z}] \$\begin{array}{cc} \{ & \begin{array}{cc} 0.1296 & 0.\leq n<1. \\ ...

6

It is a matter of definition, of course. Mathematica defines DirichletDistribution[{a1, a2, a3, a4}] to be a 3D distribution, compatible with 3D Lebesgue measure. The definition you have in mind is DirichletDistribution2[avec_List] := Block[{x, n = Length[avec] - 1}, TransformedDistribution[Append[Array[x, n], 1 - Total[Array[x, n]]], ...

1

As was noted by Sjoerd C. de Vries in the comments, DirichletDistribution[{a, b, c, d}] is a three-dimensional distribution: DistributionDomain@DirichletDistribution[{a, b, c, d}] (* {Interval[{0, 1}], Interval[{0, 1}], Interval[{0, 1}]} *) and therefore asking for the fourth marginal isn't defined.

1

Belisarius was almost there but he forgot a constraint (m[n]==0). The following should work: P[n_] := SparseArray[ { {i_, j_} /;j == i + 1 -> (n - i - 1)/n (1 - α), {i_, j_} /;j == i - 1 -> q }, {n, n} ] mu[n_] := Array[m, n] Block[{n = 3}, Solve[{mu[n] == 1 + P[n].mu[n], m[n] == 0}, ...

1

Perhaps P[n_] := SparseArray[{{i_, j_} /; j == i + 1 -> (n - i - 1)/ n, {i_, j_} /; j == i - 1 -> q}, {n, n}] mu[n_] := Array[m, n] Solve[mu[3] == 1 + P[3].mu[3], mu[3]]

1

Let's estimate the parameters for the following model. sample = RandomFunction[ ARProcess[{{{.2, -.4}, {-.2, 0}}}, {{.1, -0.05}, {-0.05, .15}}], {1, 1000}] Next, use the function EstimatedProcess to perform the estimation: α = {{α1, α2}, {α3, α4}}; Σ = {{σ11, σ12}, {σ21, σ22}}; EstimatedProcess[sample, ARProcess[{α}, Σ]] Note that when ...

4

As per comments, this should fit the bill: dist = EmpiricalDistribution[ PDF[TransformedDistribution[ x + y, {x \[Distributed] DiscreteUniformDistribution[{1, 6}], y \[Distributed] DiscreteUniformDistribution[{1, 6}]}], Range[1, 12]] -> {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5}]; {Mean[dist], Quantile[dist, .5], RandomVariate[dist, 5]} ...

1

Median itself doesn't work on associations of vectors: In[9]:= Median[{<|"a" -> 1, "b" -> 2|>, <|"a" -> 3, "b" -> 4|>}] During evaluation of In[9]:= Median::rectn: Rectangular array of real numbers is expected at position 1 in Median[{<|a->1,b->2|>,<|a->3,b->4|>}]. >> Out[9]= Median[{<|"a" -> 1, ...

13

Starting with a corrected version of your ProbabilityDistribution f[a_, b_, g_, c_, k_] := ProbabilityDistribution[ a b c k x^(c - 1) (1 + x^c)^(k - 1) ((1 + x^c)^k - 1)^(-b - 1) (1 + g ((1 + x^c)^k - 1)^-b)^(-(a/g) - 1), {x, 0, Infinity}, Assumptions -> a > 0 && b > 0 && g > 0 && c > 0 && k > ...

Top 50 recent answers are included