Statistics
A comprehensive guide to performing meta-analysis in Python
Probability Basics
- Probability of an Event:
-
Example: Probability of heads in a coin flip =
-
Independent Events: Probability of the second event isn't affected by the first.
- Sampling with replacement = events are independent.
-
Dependent Events: Probability of the second event is affected by the first.
- Sampling without replacement = events are dependent.
Sampling in Python
- Random Sampling:
DataFrame.sample()
- Setting a Seed: Ensures reproducibility.
Discrete Distributions
- Probability Distribution: Describes probability of each outcome.
- Expected value of a fair die roll:
- Discrete Uniform Distribution:
- Fair Die: Equal probability for each outcome.
- Uneven Die: Different probabilities for each outcome.
Continuous Distributions
-
Continuous Uniform Distribution: Equal probability across a continuous range.
- Example: Waiting time for a bus between 0 and 12 minutes.
-
Area Under Curve = Probability:
Using Scipy for Distributions
-
Uniform Distribution:
- Probability of a value less than or equal to 7:
uniform.cdf(7, 0, 12)
- Probability of a value less than or equal to 7:
-
Binomial Distribution:
- Binary Outcomes: Success (1) or Failure (0)
- Single Flip:
- Many Flips, One Time:
- Probability of k Successes:
Key Terms
- Expected Value (Binomial):
- Law of Large Numbers: As sample size grows, the sample mean approaches the expected value.
Example Code
- Generating Random Numbers (Uniform Distribution):
- Rolling a Die with Probability:
Last updated on