Mathematical expectation and variance of a random variable

Table of contents:

Mathematical expectation and variance of a random variable
Mathematical expectation and variance of a random variable
Anonim

Probability theory is a special branch of mathematics, which is studied only by students of higher educational institutions. Do you love calculations and formulas? Are you not afraid of the prospects of acquaintance with the normal distribution, the entropy of the ensemble, the mathematical expectation and the variance of a discrete random variable? Then this subject will be of great interest to you. Let's get acquainted with some of the most important basic concepts of this section of science.

Recall the basics

Even if you remember the simplest concepts of probability theory, do not neglect the first paragraphs of the article. The fact is that without a clear understanding of the basics, you will not be able to work with the formulas discussed below.

Image
Image

So, there is some random event, some experiment. As a result of the actions performed, we can get several outcomes - some of them are more common, others less common. The probability of an event is the ratio of the number of actually received outcomes of one type to the total number of possible ones. Only knowing the classical definition of this concept, you can begin to study the mathematical expectation and variance of continuousrandom variables.

Arithmetic mean

Even at school, in mathematics lessons, you started working with the arithmetic mean. This concept is widely used in probability theory, and therefore it cannot be ignored. The main thing for us at the moment is that we will encounter it in the formulas for the mathematical expectation and variance of a random variable.

Image
Image

We have a sequence of numbers and want to find the arithmetic mean. All that is required of us is to sum everything available and divide by the number of elements in the sequence. Let we have numbers from 1 to 9. The sum of the elements will be 45, and we will divide this value by 9. Answer: - 5.

Dispersion

Scientifically speaking, variance is the average square of the deviations of the obtained feature values from the arithmetic mean. One is denoted by a capital Latin letter D. What is needed to calculate it? For each element of the sequence, we calculate the difference between the available number and the arithmetic mean and square it. There will be exactly as many values as there can be outcomes for the event we are considering. Next, we summarize everything received and divide by the number of elements in the sequence. If we have five possible outcomes, then divide by five.

Image
Image

Dispersion also has properties that you need to remember in order to apply it when solving problems. For example, if the random variable is increased by X times, the variance increases by X times the square (i.e., XX). It is never less than zero and does not depend onshifting values by an equal value up or down. Also, for independent trials, the variance of the sum is equal to the sum of the variances.

Now we definitely need to consider examples of the variance of a discrete random variable and the mathematical expectation.

Suppose we ran 21 experiments and got 7 different outcomes. We observed each of them, respectively, 1, 2, 2, 3, 4, 4 and 5 times. What will be the variance?

First, let's calculate the arithmetic mean: the sum of the elements, of course, is 21. Divide it by 7, getting 3. Now subtract 3 from each number in the original sequence, square each value, and add the results together. It will turn out 12. Now it remains for us to divide the number by the number of elements, and, it would seem, that's all. But there is a catch! Let's discuss it.

Dependence on the number of experiments

It turns out that when calculating the variance, the denominator can be one of two numbers: either N or N-1. Here N is the number of experiments performed or the number of elements in the sequence (which, in fact, is the same). What does it depend on?

Image
Image

If the number of tests is measured in hundreds, then we must put N in the denominator. If in units, then N-1. The scientists decided to draw the border quite symbolically: today it runs along the number 30. If we conducted less than 30 experiments, then we will divide the amount by N-1, and if more, then by N.

Task

Let's go back to our example of solving the variance and expectation problem. Wereceived an intermediate number of 12, which had to be divided by N or N-1. Since we conducted 21 experiments, which is less than 30, we will choose the second option. So the answer is: the variance is 12 / 2=2.

Expectation

Let's move on to the second concept, which we must consider in this article. The mathematical expectation is the result of adding all possible outcomes multiplied by the corresponding probabilities. It is important to understand that the resulting value, as well as the result of calculating the variance, is obtained only once for the whole task, no matter how many outcomes it considers.

Image
Image

The expectation formula is quite simple: we take an outcome, multiply it by its probability, add the same for the second, third result, etc. Everything related to this concept is easy to calculate. For example, the sum of mathematical expectations is equal to the mathematical expectation of the sum. The same is true for the work. Not every quantity in probability theory allows such simple operations to be performed. Let's take a task and calculate the value of two concepts we have studied at once. In addition, we were distracted by theory - it's time to practice.

Another example

We ran 50 trials and got 10 kinds of outcomes - numbers from 0 to 9 - appearing in different percentages. These are, respectively: 2%, 10%, 4%, 14%, 2%, 18%, 6%, 16%, 10%, 18%. Recall that to get the probabilities, you need to divide the percentage values by 100. Thus, we get 0.02; 0, 1, etc. Let us represent for the variance of a randomvalue and mathematical expectation example of solving the problem.

Calculate the arithmetic mean using the formula we remember from elementary school: 50/10=5.

Now let's translate the probabilities into the number of outcomes "in pieces" to make it easier to count. We get 1, 5, 2, 7, 1, 9, 3, 8, 5 and 9. Subtract the arithmetic mean from each value obtained, after which we square each of the results obtained. See how to do this using the first element as an example: 1 - 5=(-4). Further: (-4)(-4)=16. For other values, do these operations yourself. If you did everything right, then after adding all the intermediate results you will get 90.

Image
Image

Continue calculating variance and mean by dividing 90 by N. Why do we choose N and not N-1? That's right, because the number of experiments performed exceeds 30. So: 90/10=9. We got the dispersion. If you get a different number, don't despair. Most likely, you made a banal error in the calculations. Double-check what you have written, and everything will surely fall into place.

Finally, let's remember the expectation formula. We will not give all the calculations, we will only write the answer with which you can check after completing all the required procedures. The expectation will be equal to 5, 48. We only recall how to carry out operations, using the example of the first elements: 00, 02 + 10, 1… and so on. As you can see, we simply multiply the value of the outcome by its probability.

Deviation

Another concept closely related to variance and expected value isstandard deviation. It is denoted either by the Latin letters sd, or by the Greek lowercase "sigma". This concept shows how, on average, values deviate from the central feature. To find its value, you need to calculate the square root of the variance.

Image
Image

If you build a graph of a normal distribution and want to see the value of the standard deviation directly on it, this can be done in several stages. Take half of the image to the left or right of the mode (central value), draw a perpendicular to the horizontal axis so that the areas of the resulting figures are equal. The value of the segment between the middle of the distribution and the resulting projection on the horizontal axis will be the standard deviation.

Software

As you can see from the descriptions of the formulas and the presented examples, calculating the variance and mathematical expectation is not the easiest procedure from an arithmetic point of view. In order not to waste time, it makes sense to use the program used in higher education - it is called "R". It has functions that allow you to calculate values for many concepts from statistics and probability theory.

For example, you define a vector of values. This is done as follows: vector <-c(1, 5, 2…). Now, when you need to calculate some values for this vector, you write a function and give it as an argument. To find the variance, you will need to use the var. An example of herusage: var(vector). Then you just press "enter" and get the result.

In closing

Variance and mathematical expectation are the basic concepts of probability theory, without which it is difficult to calculate anything in the future. In the main course of lectures at universities, they are considered already in the first months of studying the subject. It is precisely because of the lack of understanding of these simple concepts and the inability to calculate them that many students immediately begin to fall behind in the program and later receive poor grades at the end of the session, which deprives them of scholarships.

Practice at least one week for half an hour a day, solving tasks similar to those presented in this article. Then on any probability theory test you will cope with examples without extraneous tips and cheat sheets.

Recommended: