Random variables and probability spaces¶
This introduces a class of random variables, with the focus on discrete random variables (i.e. on a discrete probability space). This avoids the problem of defining a measure space and measurable functions.
- class sage.probability.random_variable.DiscreteProbabilitySpace(X, P, codomain=None, check=False)¶
Bases:
sage.probability.random_variable.ProbabilitySpace_generic
,sage.probability.random_variable.DiscreteRandomVariable
The discrete probability space
- entropy()¶
The entropy of the probability space.
- set()¶
The set of values of the probability space taking possibly nonzero probability (a subset of the domain).
- class sage.probability.random_variable.DiscreteRandomVariable(X, f, codomain=None, check=False)¶
Bases:
sage.probability.random_variable.RandomVariable_generic
A random variable on a discrete probability space.
- correlation(other)¶
The correlation of the probability space X = self with Y = other.
- covariance(other)¶
The covariance of the discrete random variable X = self with Y = other.
Let \(S\) be the probability space of \(X\) = self, with probability function \(p\), and \(E(X)\) be the expectation of \(X\). Then the variance of \(X\) is:
\[\text{cov}(X,Y) = E((X-E(X)\cdot (Y-E(Y)) = \sum_{x \in S} p(x) (X(x) - E(X))(Y(x) - E(Y))\]
- expectation()¶
The expectation of the discrete random variable, namely \(\sum_{x \in S} p(x) X[x]\), where \(X\) = self and \(S\) is the probability space of \(X\).
- function()¶
The function defining the random variable.
- standard_deviation()¶
The standard deviation of the discrete random variable.
Let \(S\) be the probability space of \(X\) = self, with probability function \(p\), and \(E(X)\) be the expectation of \(X\). Then the standard deviation of \(X\) is defined to be
\[\sigma(X) = \sqrt{ \sum_{x \in S} p(x) (X(x) - E(x))^2}\]
- translation_correlation(other, map)¶
The correlation of the probability space X = self with image of Y = other under map.
- translation_covariance(other, map)¶
The covariance of the probability space X = self with image of Y = other under the given map of the probability space.
Let \(S\) be the probability space of \(X\) = self, with probability function \(p\), and \(E(X)\) be the expectation of \(X\). Then the variance of \(X\) is:
\[\text{cov}(X,Y) = E((X-E(X)\cdot (Y-E(Y)) = \sum_{x \in S} p(x) (X(x) - E(X))(Y(x) - E(Y))\]
- translation_expectation(map)¶
The expectation of the discrete random variable, namely \(\sum_{x \in S} p(x) X[e(x)]\), where \(X\) = self, \(S\) is the probability space of \(X\), and \(e\) = map.
- translation_standard_deviation(map)¶
The standard deviation of the translated discrete random variable \(X \circ e\), where \(X\) = self and \(e\) = map.
Let \(S\) be the probability space of \(X\) = self, with probability function \(p\), and \(E(X)\) be the expectation of \(X\). Then the standard deviation of \(X\) is defined to be
\[\sigma(X) = \sqrt{ \sum_{x \in S} p(x) (X(x) - E(x))^2}\]
- translation_variance(map)¶
The variance of the discrete random variable \(X \circ e\), where \(X\) = self, and \(e\) = map.
Let \(S\) be the probability space of \(X\) = self, with probability function \(p\), and \(E(X)\) be the expectation of \(X\). Then the variance of \(X\) is:
\[\mathrm{var}(X) = E((X-E(x))^2) = \sum_{x \in S} p(x) (X(x) - E(x))^2\]
- variance()¶
The variance of the discrete random variable.
Let \(S\) be the probability space of \(X\) = self, with probability function \(p\), and \(E(X)\) be the expectation of \(X\). Then the variance of \(X\) is:
\[\mathrm{var}(X) = E((X-E(x))^2) = \sum_{x \in S} p(x) (X(x) - E(x))^2\]
- class sage.probability.random_variable.ProbabilitySpace_generic(domain, RR)¶
Bases:
sage.probability.random_variable.RandomVariable_generic
A probability space.
- domain()¶
- class sage.probability.random_variable.RandomVariable_generic(X, RR)¶
Bases:
sage.structure.parent.Parent
A random variable.
- codomain()¶
- domain()¶
- field()¶
- probability_space()¶
- sage.probability.random_variable.is_DiscreteProbabilitySpace(S)¶
- sage.probability.random_variable.is_DiscreteRandomVariable(X)¶
- sage.probability.random_variable.is_ProbabilitySpace(S)¶
- sage.probability.random_variable.is_RandomVariable(X)¶