140 likes | 258 Views
Basics of probability. Notes from: www.anu.edu.au/nceph/surfstat. A concept of probability. Probability is the study of uncertainty. E.g. A coin comes down heads 50% of the time. In the limit , as # tosses -> infinity . Example - 2 coin tosses.
E N D
Basics of probability Notes from: www.anu.edu.au/nceph/surfstat
A concept of probability • Probability is the study of uncertainty. • E.g.A coin comes down heads 50% of the time. • In the limit, as # tosses -> infinity
Example - 2 coin tosses • Toss a coin twice, record each result : (H) or (T). • List the possible outcomes. • Let A be the event of one or more heads. Which outcomes belong to event A? • Let B be the event that there are no heads. • In this example, events A and B are said to be disjoint or mutually exclusive, as they have no outcomes in common. They are also exhaustive, as they cover all possible outcomes. • Define an event C which is not disjoint from A.
DEFINITIONS • A Sample space is set of all possible outcomes of an experiment. • An event is a set of one or more outcomes in the sample space. • Two events are disjoint or mutually exclusive if they have no outcomes in common. • Random variation occurs when it is impossible to predict with certainty the exact outcome of an individual experiment, but as the experiment is repeated a large number of times a regular distribution of relative frequencies emerges.
Defining probability • Probability of an event can be determined either empirically or theoretically. • Empirical definition: Suppose an eventA occurs f times in nobservations • By analogy with relative frequencies: • P(A) is a value from 0 to 1 inclusive. • P(A) = 0 means A never occurs (corresponding to f = 0) • P(A) = 1 means A always occurs (corresponding to f = n) • The collection S of all possible outcomes has probability 1: P(S) = 1.
Example: age at last birthday • Events: A1 : age < 20 years A2 : age 20 - 24 years and so on. • Age at last birthday (years) <20 20-24 25-29 30-34 >34 A1A2A3A4A5 Chance that a person belongs to A2and A3? Chance that a person belong to A2 or A3?
Probability rules • Above categories cover all possibilities, so they are said to be exhaustive. • In general, if there are K events A1,A2,...,Ak which are disjoint and exhaustive then P(A1) + P(A2) + ... + P(Ak) = 1 • P(not A2) = ? • The complement of Ai is the event that Ai does not occur • P(not Ai) = 1 - P(Ai)
Men Women Total Overseas Irish Total Reducing discrimination in hiring • All current employees overseas born women • Commitment: 30% Irish and 40% men • 35% will still by overseas born women • What % of Irish men are to be hired?
Non-exclusive events • If events X and Y are mutually exclusive, then P(X or Y) = P(X) + P(Y) • A certain kind of fruit is grown in 2 districts, A and B. Both areas sometimes get fruitfly. • P(A) = 1/10, P(B) = 1/20, P(A and B) = 1/50 • P(A or B)= ? • If events X and Y are not mutually exclusive then • P(X or Y) = P(X) + P(Y) - P(X and Y).
Random Variables • A random variable (r.v.) is a numerical value which is defined on or determined by the outcomes or events of an experiment. Random variables are usually denoted by capital letters, X, Y etc and can be discrete or continuous. • Let the r.v. X be the number of seeds germinating from 100. Possible values for X are 0,1,2,…,100 (discrete) • Let the r.v. X be the maximum daily temperature in Cork. Possible values are -20 - 40 C e.g. 26.1276 (continuous) • Let X be response to question with 'Yes', 'No', 'Don't know'. X is not a r.v. (not numerical). • Let Y be number of 'Yes's. Y is discrete r.v.
Outcome: #spots: Head 1 2 Tail 3 4 5 6 Probability: Probability: 1/6 1/2 1/6 1/2 1/6 1/6 1/6 1/6 Discrete probability distributions List of mutually exclusive and exhaustive outcomes of some process and their probabilities Example - 1 coin toss Example - 1 fair die throw This is an example of a discrete uniform distribution
DISCRETE DISTRIBUTIONS Example - Family of 3 children. Let X = number of girls Possible values: X = 3 GGG X = 2 GGB GBG BGG X = 1 BBG BGB GBB X = 0 BBB Assume the 8 outcomes are equally likely so that x 0 1 2 3 P(X = x) 1/8 3/8 3/8 1/8 P(X x)
Probability Distribution of a Discrete r.v. • The probabilities may be written as: • P(Xi=xi) is also referred to as the density function f(x) • The cumulative distribution function (c.d.f.) is defined as
Example - Bernoulli trials Each trial is an 'experiment' with exactly 2 possible outcomes, "success" and "failure" with probabilities p and 1-p. Let X = 1 if success, 0 if failure Probability distribution is x 0 1 P(X = x) p 1-p • Results for Bernoulli trials can be simulated using S-PLUS • e.g. simulate results of a drug trial drug, success (cure) has probability p = 0.3 for each patient, 100 patients in trial. • result _ rbinom(100, size=1, prob=p) • result is a 100 vector that looks like 1,0,0,1,0,1,…...