tanszek:oktatas:techcomm:statistical_properties
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tanszek:oktatas:techcomm:statistical_properties [2024/09/30 07:33] – knehez | tanszek:oktatas:techcomm:statistical_properties [2024/10/04 19:17] (current) – knehez | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Statistical properties ====== | ====== Statistical properties ====== | ||
- | The outcome of // | + | ==== Event Space ==== |
- | These events may form sets. Because they can be sets, we may perform set operations on them. When these operations | + | The outcome of // |
- | From everyday experience the news value of these events can be very different. | + | These events |
- | For example, if someone tells me that five of my numbers were drawn in the lottery, that information would be much more valuable | + | The __value of information__ related to these events can vary significantly based on everyday experience. |
- | While observing | + | For example, if someone tells me that five of his numbers were drawn in the lottery, that information would be much more valuable than if they said only one number was drawn. |
+ | |||
+ | As we observe | ||
+ | |||
+ | ==== Frequency of Events ==== | ||
In the \( E_i \) event space, an event happened \(k_i\) times then the frequency of that given event may be calculated with the following formula: | In the \( E_i \) event space, an event happened \(k_i\) times then the frequency of that given event may be calculated with the following formula: | ||
- | \(g_i=\frac{k_i}{k} \) | + | \(freq_i=\frac{k_i}{k} \) |
This means that we divide the number of all events by the number (frequency) of that given event. In case of a large number of experiments this number will show us the probability of that event. | This means that we divide the number of all events by the number (frequency) of that given event. In case of a large number of experiments this number will show us the probability of that event. | ||
- | $$ \lim_{k \to \infty} | + | $$ \lim_{k \to \infty} |
* if \(k_i = k \), then the occurrence will be **certain** \(P(E) = 1 \) | * if \(k_i = k \), then the occurrence will be **certain** \(P(E) = 1 \) | ||
Line 29: | Line 33: | ||
{{: | {{: | ||
- | The probability of every event will be 1/6 which can be calculated with the following formula. The rolls (of the dice) will form a so-called //full event system//. In the case of a //full event system// the sum of the probabilities (of each event) is 1 by definition. | + | The probability of every event will be 1/6 which can be calculated with the following formula. The rolls (of the dice) will form a so-called //full event system//. In the case of a //full event system// the sum of the probabilities (of each event) is 1 (by definition). |
- | If one the events | + | If one of the events |
$$ \sum_{i=1}^{n} p(E_i) = 1 \text{ where } E_i \cap E_j = 0 \text{ and } i \not = j $$ | $$ \sum_{i=1}^{n} p(E_i) = 1 \text{ where } E_i \cap E_j = 0 \text{ and } i \not = j $$ | ||
- | This formula applies to a set of //mutually exclusive// events. Since these events are disjoint (no overlap between any two different events) and together | + | This formula applies to a set of //mutually exclusive// events. Since these events are disjoint (no overlap between any two different events) and they together |
=== Sum of events === | === Sum of events === | ||
Line 41: | Line 45: | ||
What is the sum of two different events' | What is the sum of two different events' | ||
- | **Example 1**: what is the probability that we throw an odd number (with a dice) (Event A) and a number less then 4 (Event B)? | + | **Example 1**: what is the probability that we roll an odd number (with a dice) (Event A) and a number less then 4 (Event B)? |
{{: | {{: | ||
Line 49: | Line 53: | ||
We can only form a general formula, if we extract the probability of the intersection of both sets from the total sum: | We can only form a general formula, if we extract the probability of the intersection of both sets from the total sum: | ||
- | $$ p(A \cap B) = p(A) + p(B) - p(A \cup B) $$ | + | $$ p(A \cup B) = p(A) + p(B) - p(A \cap B) $$ |
So we can say that (according to this formula) the total probability for both events is 4/6. | So we can say that (according to this formula) the total probability for both events is 4/6. | ||
Line 55: | Line 59: | ||
**Example 2**: What is the probability that we roll the dice twice and the results will be 6 in both cases? | **Example 2**: What is the probability that we roll the dice twice and the results will be 6 in both cases? | ||
- | The probability | + | The probability |
+ | |||
+ | $$ p(A) \times p(B) = \frac{1}{6} \times \frac{1}{6} = \frac{1}{36} $$ | ||
+ | |||
+ | **Example 3**: What is the probability of getting at least one 5 when rolling two dice? | ||
+ | |||
+ | Let //Event A// represent rolling a 5 on the first die and //Event B// represent rolling a 5 on the second die. These are independent events. | ||
+ | |||
+ | * The probability of rolling a 5 on the first die is: \( p(A) = \frac{1}{6} \) | ||
+ | * The probability of rolling a 5 on the second die is \( p(B) = \frac{1}{6} \) | ||
+ | * The probability of both dice showing a 5 (i.e, \( A \cap B \) is \( p(A \cap B) = \frac{1}{6} \times \frac{1}{6} = \frac{1}{36} \) | ||
+ | |||
+ | |||
+ | $$ p(A \cup B) = p(A) + p(B) - p(A \cap B) $$ | ||
+ | $$ p(A \cup B) = \frac{1}{6} + \frac{1}{6} - \frac{1}{36} = \frac{2}{6} - \frac{1}{36} = \frac{12}{36} - \frac{1}{36} = \frac{11}{36} $$ | ||
+ | |||
+ | **Example 4:**: Woman is expecting twins, what is the probability that one of the children will be a girl? | ||
+ | |||
+ | Create sets containing all the possibilities. | ||
+ | |||
+ | Try the following c code here: https:// | ||
+ | |||
+ | <sxh c> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | #define SIMULATIONS 1000 | ||
+ | |||
+ | // Function to simulate the birth of twins | ||
+ | int simulate_twins() { | ||
+ | // Randomly determine the gender of the twins (0 = boy, 1 = girl) | ||
+ | int first_child = rand() % 2; | ||
+ | int second_child = rand() % 2; | ||
+ | |||
+ | // Return 1 if there is at least one girl, otherwise 0 | ||
+ | return (first_child == 1 || second_child == 1); | ||
+ | } | ||
+ | |||
+ | int main() { | ||
+ | int at_least_one_girl = 0; | ||
+ | |||
+ | // Initialize the random number generator | ||
+ | srand(time(0)); | ||
+ | |||
+ | // Simulate 1000 pairs of twins | ||
+ | for (int i = 0; i < SIMULATIONS; | ||
+ | if (simulate_twins()) { | ||
+ | at_least_one_girl++; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Calculate and print the result | ||
+ | double probability = (double)at_least_one_girl / SIMULATIONS * 100; | ||
+ | printf(" | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
- | $$ p(A) p(B) = \frac{1}{6} \frac{1}{6} = \frac{1}{36} $$ | + | **Example 5:**: https:// |
tanszek/oktatas/techcomm/statistical_properties.1727681630.txt.gz · Last modified: 2024/09/30 07:33 by knehez