9 votes

How can I define a distribution and get the expectation in Mathematica?

There are many ways. Here's one: dist = TransformedDistribution[x aH + (1 - x) aL, x \[Distributed] BernoulliDistribution[λ]] Mean[dist] (* aL+aH λ-aL λ *)
user avatar
  • 34.1k
7 votes

How can I define a distribution and get the expectation in Mathematica?

As JimB notes, there are many ways. Here's another: ...
user avatar
  • 1,397
7 votes
Accepted

How can I efficiently calculate exact probability distributions for D&D dice like "4d8"?

Based on eyorble's comment here's how to do it with generating functions. The main idea: with some probability distribution $p_n: P(X=n)=p_n$ you can associate a polynomial called the generating ...
user avatar
7 votes

How can I efficiently calculate exact probability distributions for D&D dice like "4d8"?

Implementing @eyorble's idea in the comments: problist[n_, d_] := Rest[CoefficientList[(1/d Sum[x^i, {i, 1, d}])^n, x]] This returns a list of length $nd$ ...
user avatar
5 votes

How can I efficiently calculate exact probability distributions for D&D dice like "4d8"?

Define two helper functions. One for the generator function of NdS expressed as a polynomial in terms of $x$: dg[x_, n_, s_] := (x (x^s - 1)/(x - 1))^n; And ...
user avatar
  • 8,523
4 votes

Choosing The Best Fitted Probability Distribution Model

Using AIC you can rank the goodness-of-fit for each probability distribution but that doesn't mean any of the fits are good or bad. Just a relative ranking. But you don't want to use regression (i.e.,...
user avatar
  • 34.1k
3 votes

PDF of double truncated exponential function

You can obtain it as follows: ...
user avatar
  • 60.1k
2 votes

Estimating Parameters of a Custom Distribution

Estimates of parameters deserve estimates of precision. Unfortunately, FindDistributionParameters doesn't provide that. However, it is relatively easy to do in ...
user avatar
  • 34.1k
1 vote

Spanning Subgraphs of random sizes with probabilities on edges

If you want to retain each edge in a graph g with probability p, you can use: ...
user avatar
  • 225k

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