Playing a discrete random variable. Approximate play of a normal random variable

Subscribe
Join the “koon.ru” community!
In contact with:

Definition 24.1.Random numbers name possible values r continuous random variable R, distributed uniformly in the interval (0; 1).

1. Playing a discrete random variable.

Suppose we want to play a discrete random variable X, that is, obtain a sequence of its possible values, knowing the distribution law X:

X x 1 X 2 … x n

r r 1 R 2 … r p .

Consider a random variable uniformly distributed in (0, 1) R and divide the interval (0, 1) with points with coordinates R 1, R 1 + R 2 , …, R 1 + R 2 +… +r p-1 on P partial intervals whose lengths are equal to the probabilities with the same indices.

Theorem 24.1. If each random number that falls into the interval is assigned a possible value, then the value being played will have a given distribution law:

X x 1 X 2 … x n

r r 1 R 2 … r p .

Proof.

Possible values ​​of the resulting random variable coincide with the set X 1 , X 2 ,… x n, since the number of intervals is equal P, and when hit r j in an interval, a random variable can take only one of the values X 1 , X 2 ,… x n.

Because R is distributed uniformly, then the probability of it falling into each interval is equal to its length, which means that each value corresponds to a probability p i. Thus, the random variable being played has a given distribution law.

Example. Play 10 values ​​of a discrete random variable X, the distribution law of which has the form: X 2 3 6 8

R 0,1 0,3 0,5 0,1

Solution. Let's divide the interval (0, 1) into partial intervals: D 1 - (0; 0.1), D 2 - (0.1; 0.4), D 3 - (0.4; 0.9), D 4 – (0.9; 1). Let's write out 10 numbers from the random number table: 0.09; 0.73; 0.25; 0.33; 0.76; 0.52; 0.01; 0.35; 0.86; 0.34. The first and seventh numbers lie on the interval D 1, therefore, in these cases, the random variable played took on the value X 1 = 2; the third, fourth, eighth and tenth numbers fell into the interval D 2, which corresponds to X 2 = 3; the second, fifth, sixth and ninth numbers were in the interval D 3 - in this case X = x 3 = 6; There were no numbers in the last interval. So, the possible values ​​played out X are: 2, 6, 3, 3, 6, 6, 2, 3, 6, 3.

2. Acting out opposite events.

Let it be required to play out tests, in each of which an event A appears with a known probability R. Consider a discrete random variable X, taking the value 1 (if the event A happened) with probability R and 0 (if A did not happen) with probability q = 1 – p. Then we will play this random variable as suggested in the previous paragraph.

Example. Play 10 challenges, each with an event A appears with probability 0.3.


Solution. For a random variable X with the law of distribution X 1 0

R 0,3 0,7

we obtain the intervals D 1 – (0; 0.3) and D 2 – (0.3; 1). We use the same sample of random numbers as in the previous example, for which the numbers No. 1, 3 and 7 fall into the interval D 1, and the rest - into the interval D 2. Therefore, we can assume that the event A occurred in the first, third, and seventh trials, but did not occur in the remaining trials.

3. Playing out a complete group of events.

If events A 1 , A 2 , …, A p, whose probabilities are equal R 1 , R 2 ,… r p, form a complete group, then for play (that is, modeling the sequence of their appearances in a series of tests), you can play a discrete random variable X with the law of distribution X 1 2 … P, having done this in the same way as in point 1. At the same time, we believe that

r r 1 R 2 … r p

If X takes on the value x i = i, then in this test the event occurred A i.

4. Playing a continuous random variable.

a) Method of inverse functions.

Suppose we want to play a continuous random variable X, that is, get a sequence of its possible values x i (i = 1, 2, …, n), knowing the distribution function F(x).

Theorem 24.2. If r i is a random number, then the possible value x i played continuous random variable X with a given distribution function F(x), corresponding r i, is the root of the equation

F(x i) = r i. (24.1)

Proof.

Because F(x) monotonically increases in the interval from 0 to 1, then there is a (and unique) value of the argument x i, at which the distribution function takes the value r i. This means that equation (24.1) has a unique solution: x i= F -1 (r i), Where F-1 - function inverse to F. Let us prove that the root of equation (24.1) is a possible value of the random variable under consideration X. Let us first assume that x i is the possible value of some random variable x, and we prove that the probability of x falling into the interval ( s, d) is equal to F(d) – F(c). Indeed, due to monotonicity F(x) and that F(x i) = r i. Then

Therefore, So, the probability of x falling into the interval ( c, d) is equal to the increment of the distribution function F(x) on this interval, therefore, x = X.

Play 3 possible values ​​of a continuous random variable X, distributed uniformly in the interval (5; 8).

F(x) = , that is, it is necessary to solve the equation. Let's choose 3 random numbers: 0.23; 0.09 and 0.56 and substitute them into this equation. Let's get the corresponding possible values X:

b) Superposition method.

If the distribution function of the random variable being played can be represented as a linear combination of two distribution functions:

then, since when X®¥ F(x) ® 1.

Let us introduce an auxiliary discrete random variable Z with the law of distribution

Z 12 . Let's choose 2 independent random numbers r 1 and r 2 and play the possible

p C 1 C 2

meaning Z by number r 1 (see point 1). If Z= 1, then we look for the desired possible value X from the equation, and if Z= 2, then we solve the equation .

It can be proven that in this case the distribution function of the random variable being played is equal to the given distribution function.

c) Approximate play of a normal random variable.

Since for R, uniformly distributed in (0, 1), then for the sum P independent, uniformly distributed random variables in the interval (0,1). Then, by virtue of the central limit theorem, the normalized random variable at P® ¥ will have a distribution close to normal, with the parameters A= 0 and s =1. In particular, a fairly good approximation is obtained when P = 12:

So, to play out the possible value of the normalized normal random variable X, you need to add 12 independent random numbers and subtract 6 from the sum.

The essence of the Monte Carlo method is as follows: you need to find the value A some studied quantity. For this purpose, choose a random variable X whose mathematical expectation is equal to a: M(X) = a.

In practice, they do this: they calculate (play out) n possible values ​​x i of the random variable X, find their arithmetic mean

And they take a* of the desired number a as an estimate (approximate value). Thus, to use the Monte Carlo method, you must be able to play a random variable.

Let it be necessary to play a discrete random variable X, i.e. calculate the sequence of its possible values ​​x i (i=1,2, ...), knowing the distribution law of X. Let us introduce the notation: R is a continuous random variable distributed uniformly in the interval (0,1); r i (j=1,2,...) – random numbers (possible values ​​of R).

Rule: In order to play a discrete random variable X specified by the distribution law

X x 1 x 2 ... x n

P p 1 p 2 … p n

1. Divide the interval (0,1) of the or axis into n partial intervals:

Δ 1 =(0;р 1), Δ 2 =(р 1; р 1+ р 2), …, Δ n = (р 1 +р 2 +…+р n -1; 1).

2. Choose a random number r j . If r j fell into the partial interval Δ i, then the value being played took on a possible value x i. .

Playing out a complete group of events

It is required to play out tests, in each of which one of the events of the full group occurs, the probabilities of which are known. Playing out a complete group of events comes down to playing a discrete random variable.

Rule: In order to play tests, in each of which one of the events A 1, A 2, ..., A n of the complete group occurs, the probabilities of which p 1, p 2, ..., p n are known, it is enough to play a discrete value X with the following distribution law :

P p 1 p 2 … p n

If in the test the value X took on a possible value x i =i, then the event A i occurred.

Playing a Continuous Random Variable

The distribution function F of a continuous random variable X is known. It is required to play X, i.e. calculate the sequence of possible values ​​x i (i=1,2, ...).

A. Method of inverse functions. Rule 1. x i of a continuous random variable X, knowing its distribution function F, you need to choose a random number r i, equate its distribution function and solve the resulting equation F(x i) = r i for x i.



If the probability density f(x) is known, then rule 2 is used.

Rule 2. To play out the possible value x i of a continuous random variable X, knowing its probability density f, you need to choose a random number r i and solve the equation for x i

or equation

where a is the smallest final possible value of X.

B. Superposition method. Rule 3. In order to play the possible value of a random variable X, the distribution function of which

F(x) = C 1 F 1 (x)+C 2 F 2 (x)+…+C n F n (x),

where F k (x) – distribution functions (k=1, 2, …, n), С k >0, С i +С 2 +…+С n =1, you need to choose two independent random numbers r 1 and r 2 and using the random number r 1, play the possible value of the auxiliary discrete random variable Z (according to rule 1):

p C 1 C 2 … C n

If it turns out that Z=k, then solve the equation F k (x) = r 2 for x.

Remark 1. If the probability density of a continuous random variable X is given in the form

f(x)=C 1 f 1 (x)+C 2 f 2 (x)+…+C n f n (x),

where f k are probability densities, coefficients C k are positive, their sum is equal to one, and if it turns out that Z=k, then solve (according to rule 2) with respect to x i with respect to or the equation



Approximate play of a normal random variable

Rule. In order to approximate the possible value x i of a normal random variable X with parameters a=0 and σ=1, you need to add 12 independent random numbers and subtract 6 from the resulting sum:

Comment. If you want to approximately play a normal random variable Z with mathematical expectation A and standard deviation σ, then, having played the possible value of x i according to the above rule, find the desired possible value using the formula: z i =σx i +a.

Let us denote a uniformly distributed SV in the interval (0, 1) by R, and its possible values ​​(random numbers) by r j .

Let's split the interval .

From these inequalities it follows that if a random variable ξ contained in the interval

With< ξ < d, ξ (**)

then the random variable R contained in the interval

F(With)< R< F(d), (***)

and back. Thus, inequalities (**) and (***) are equivalent and, therefore, equally probable:

R(With< ξ< d)=P[F(With)< R< F(d)]. (****)

Since the value R is distributed uniformly in the interval (0,1), then the probability of hitting R into some interval belonging to the interval (0,1) is equal to its length (see Chapter XI, § 6, remark). In particular,

R[F(With)< R< F(d) ] = F(d) - F(With).

Therefore, the relation (****) can be written in the form

R(With< ξ< d)= F(d) - F(With).

So, the probability of hitting ξ in the interval ( With,d) is equal to the increment of the distribution function F(X) on this interval, which means that ξ=X. In other words, the numbers X i, defined by the formula (*), are the possible values ​​of the quantity X s given distribution function F(X), Q.E.D.

Rule 1.X i , continuous random variable X, knowing its distribution function F(X), you need to choose a random number r i equate its distribution functions and solve for X i , the resulting equation

F(X i)= r i .

Remark 1. If it is not possible to solve this equation explicitly, then resort to graphical or numerical methods.

Example I Play 3 possible values ​​of a continuous random variable X, distributed uniformly in the interval (2, 10).

Solution. Let us write the distribution function of the quantity X, distributed uniformly in the interval ( A,b) (see Chapter XI, § 3, example):

F(X)= (Ha)/ (b-A).

By condition, a = 2, b=10, therefore,

F(X)= (X- 2)/ 8.

Using the rule of this paragraph, we will write an equation to find possible values X i , for which we equate the distribution function to a random number:

(X i -2 )/8= r i .

From here X i =8 r i + 2.

Let's choose 3 random numbers, for example, r i =0,11, r i =0,17, r i=0.66. Let's substitute these numbers into the equation, resolved with respect to X i , As a result, we get the corresponding possible values X: X 1 =8·0.11+2==2.88; X 2 =1.36; X 3 = 7,28.

Example 2. Continuous random variable X distributed according to the exponential law specified by the distribution function (the parameter λ > 0 is known)

F(X)= 1 - e - λ X (x>0).

We need to find an explicit formula to play out the possible values X.

Solution. Using the rule of this paragraph, we write the equation

1 - e - λ X i

Let's solve this equation for X i :

e - λ X i = 1 - r i, or - λ X i = ln(1 - r i).

X i =1p(1 r i)/λ .

Random number r i enclosed in the interval (0,1); therefore the number 1 is r i, is also random and belongs to the interval (0,1). In other words, the quantities R and 1 - R equally distributed. Therefore, to find X i You can use a simpler formula:

x i =- ln r i /λ.

Remark 2. It is known that (see Chapter XI, §3)

In particular,

It follows that if the probability density is known f(x), then for playing X it is possible instead of equations F(x i)=r i decide regarding x i the equation

Rule 2. To find the possible value X i (continuous random variable X, knowing its probability density f(x) you need to choose a random number r i and decide regarding X i , the equation

or equation

Where A- smallest final possible value X.

Example 3. The probability density of a continuous random variable is given Xf(X)(1-λx/2) in the interval (0; 2/λ); outside this interval f(X)= 0. We need to find an explicit formula to play out the possible values X.

Solution. In accordance with rule 2, let us write the equation

After performing the integration and solving the resulting quadratic equation for X i, we finally get

Return

×
Join the “koon.ru” community!
In contact with:
I am already subscribed to the community “koon.ru”