probability-continuous.rst
changeset 4 5d6cec5fe095
child 6 9b4e31a03161
equal deleted inserted replaced
3:3b9b5823948c 4:5d6cec5fe095
       
     1 
       
     2 =============================
       
     3  Continuous random variables
       
     4 =============================
       
     5 .. contents::
       
     6    :local:
       
     7 
       
     8 Probability density function
       
     9 ============================
       
    10 
       
    11 .. role:: def
       
    12    :class: def
       
    13 
       
    14 :def:`Probability density function` (PDF) for continuous random variable
       
    15 :math:`x` is function:
       
    16 
       
    17 .. math::
       
    18 
       
    19    PDF(a ≤ X ≤ b) = P(a ≤ X ≤ b) = ∫_{a, b} f_X(x) dx
       
    20 
       
    21    f_X(x) ≥ 0
       
    22 
       
    23    ∫_{-∞, +∞} f_X(x) dx = 1
       
    24 
       
    25 :math:`f_X(x)` funtion maps values :math:`x` from sample space to real numbers.
       
    26 
       
    27 For continuous random variable:
       
    28 
       
    29 .. math:: P(X = a) = 0
       
    30 
       
    31 Expectation
       
    32 ===========
       
    33 
       
    34 :def:`Expectation` of continuous random variable is:
       
    35 
       
    36 .. math:: μ = E[X] = ∫_{-∞, +∞} x·f_X(x)·dx
       
    37 
       
    38 Properties:
       
    39 
       
    40 .. math::
       
    41 
       
    42    E[X + Y] = E[X] + E[Y]
       
    43 
       
    44    E[a·X] = a·E[X]
       
    45 
       
    46    E[a·X + b] = a·E[X] + b
       
    47 
       
    48 Variance
       
    49 ========
       
    50 
       
    51 :def:`Variance` of continuous random variable is:
       
    52 
       
    53 .. math:: var[X] = ∫_{-∞, +∞} (x-μ)²·f_X(x)·dx
       
    54 
       
    55 Properties:
       
    56 
       
    57 .. math::
       
    58 
       
    59    var[a·X + b] = a²·var[X]
       
    60 
       
    61    var[X] = E[X²] - E²[X]
       
    62 
       
    63 Standard deviation
       
    64 ==================
       
    65 
       
    66 :def:`Standard deviation` of continuous random variable is:
       
    67 
       
    68 .. math:: σ_Χ = sqrt(var[X])
       
    69 
       
    70 
       
    71 Continuous uniform random variable
       
    72 ==================================
       
    73 
       
    74 :def:`Continuous uniform random variable` is :math:`f_X(x)` that is non-zero
       
    75 only on :math:`[a, b]` with :math:`f_X(x) = `1/(b-a)`.
       
    76 
       
    77 .. math::
       
    78 
       
    79    E[unif(a, b)] = (b+a)/2
       
    80 
       
    81    var[unif(a, b)] = (b-a)²/12
       
    82 
       
    83    σ = (b-a)/sqrt(12)
       
    84 
       
    85 Proofs:
       
    86 
       
    87 .. math::
       
    88 
       
    89    E[unif(a, b)] = ∫_{a, b} x·1/(b-a)·dx = x²/2/(b-a) |_{a, b} = (b²-a²)/(b-a)/2 = (b+a)/2
       
    90 
       
    91    E[unif²(a, b)] = ∫_{a, b} x²·1/(b-a)·dx = x³/3/(b-a) |_{a, b} = (b³-a³)/(b-a)/3 = (b²+b·a+a²)/3
       
    92 
       
    93    var[unif(a, b)] = E[unif²(a, b)] - E²[unif(a, b)] = (b²+b·a+a²)/3 - (b+a)²/4 = (b-a)²/12
       
    94 
       
    95 .. note::
       
    96 
       
    97    In maxima::
       
    98 
       
    99      (%i4) factor((b^2+b*a+a^2)/3 - (a+b)^2/4);
       
   100                  2
       
   101           (b - a)
       
   102           --------
       
   103              12
       
   104 
       
   105 Exponential random variables
       
   106 ============================
       
   107 
       
   108 :def:`Exponential random variables` with parameter :math:`λ` is:
       
   109 
       
   110 .. math:: f_X(x) = λ·exp(-λ·x)
       
   111 
       
   112 for :math:`x ≥ 0`, and zero otherwise.
       
   113 
       
   114 Properties:
       
   115 
       
   116 .. math::
       
   117 
       
   118    E[exp(λ)] = 1/λ
       
   119 
       
   120    var[exp(λ)] = 1/λ²
       
   121 
       
   122 Proof:
       
   123 
       
   124 .. math::
       
   125 
       
   126   ∫_{-∞, +∞} f_X(x)·dx = ∫_{0, +∞} λ·exp(-λ·x)·dx = -exp(-λ·x) |_{0, +∞} = 1
       
   127 
       
   128   E[exp(λ)] = ∫_{0, +∞} x·λ·exp(-λ·x)·dx = 1/λ
       
   129 
       
   130   E[exp²(λ)] = ∫_{0, +∞} x²·λ·exp(-λ·x)·dx = 1/λ²
       
   131 
       
   132 .. note::
       
   133 
       
   134    From maxima::
       
   135 
       
   136     (%i15) assume(lambda>0);
       
   137     (%o15)                           [lambda > 0]
       
   138 
       
   139     (%i16) integrate(lambda*%e^(-lambda*x),x,0,inf);
       
   140     (%o16)                                 1
       
   141 
       
   142     (%i17) integrate(x*lambda*%e^(-lambda*x),x,0,inf);
       
   143                                           1
       
   144     (%o17)                              ------
       
   145                                         lambda
       
   146 
       
   147     (%i18) integrate(x^2*lambda*%e^(-lambda*x),x,0,inf);
       
   148                                            2
       
   149     (%o18)                              -------
       
   150                                               2
       
   151                                         lambda
       
   152 
       
   153 Cumulative distribution functions
       
   154 =================================
       
   155 
       
   156 :def:`Cumulative distribution functions` of random variable :math:`X` is:
       
   157 
       
   158 .. math:: F_X(x) = P(X ≤ x) = ∫_{-∞, x} f_X(t)·dt