SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Stat310
         Discrete random variables


                           Hadley Wickham
Tuesday, 26 January 2010
Homework
                    • Don’t forget to pledge!
                    • Model answers up v. soon, and on track
                      to get your homeworks back on
                      Thursday.
                    • Homework help session Tuesday &
                      Wednesday 4-5pm. Details on webpage.
                    • Will be other extra credit opportunities


Tuesday, 26 January 2010
Data visualisation
                             mini course
                    Feb 13 (Saturday). 10am - 3pm.
                    http://www.ece.rice.edu/ece/
                    datavis2010.html
                    The applied side of statistics - getting
                    data and figuring out what is going on.
                    No maths, lots of graphics and
                    programming


Tuesday, 26 January 2010
1. Independence example
                2. Random variables
                      1. Bernoulli
                      2. Binomial
                3. Mean and variance



Tuesday, 26 January 2010
Tuesday, 26 January 2010
Are the wearing glasses and
 wearing hat events independent?




 21 Dennis Washingtons in total
Tuesday, 26 January 2010
Calculations
                    P(glasses) = 9 / 21
                    P(hat) = 9 / 21
                    P(glasses and hat) = 3 / 21 = 0.14
                    P(glasses) P(hat) = 9 / 49 = 0.18
                    Wearing a glasses and hat together is
                    (slightly) less likely than we’d expect if they
                    were independent.


Tuesday, 26 January 2010
Definitions
                    A random variable is a random experiment
                    with a numeric sample space. Usually given
                    a capital letter like X, Y or Z.
                    (More formally a random variable is a function
                    that converts outcomes from a random
                    experiment into numbers)
                    The space (or support) of a random variable
                    is the range of the function (cf. sample space)


Tuesday, 26 January 2010
Definitions

                    If the size of the support is finite or
                    countably infinite, then the random
                    variable is discrete.
                    If the size of the support is uncountably
                    infinite, then the random variable is
                    continuous.



Tuesday, 26 January 2010
pmf/pdf
                    Every random experiment has a probability
                    function.
                    Every discrete random variable as
                    probability mass function (pmf).
                    Every continuous random variable has
                    probability density function (pdf).
                    Different ways of defining the function that
                    says how likely each outcome is.


Tuesday, 26 January 2010
This week: discrete
                Next week: continuous
                           This diverges from the book, but I think
                              it’s easier to work with one set of
                                  mathematical tools at a time




Tuesday, 26 January 2010
Notation
                    Normally call pmf f
                    If we have multiple rv’s and want to make
                    clear which pmf belongs to which rv, we
                    write:
                    fX(x) fY(y) fZ(z) for X, Y, Z
                    f1(x) f2(x) f3(3) for X1, X2, X3


Tuesday, 26 January 2010
P (X = xi ) = f (xi )
                                         
              P (a  X  b) =                    f (xi )
                                     xi ∈(a,b)



      To be a pmf, f must satisfy:
            
                           f (xi ) = 1
          xi ∈S
          f (xi ) ≥ 0, ∀ xi ∈ S

Tuesday, 26 January 2010
x   f(x)   x   f(x)   x   f(x)
                           -1 0.3     10 -0.1    1 0.35
                           0   0.3    20 0.9     2 0.25
                           2   0.3    30 0.2     3    0.2
                                                 4    0.1
                           x   f(x)   x   f(x)
                                                 5    0.1
                           5    1     10 0.1
                                      20 0.9
                                      30 0.2
Tuesday, 26 January 2010
Notation
                    Can give pmf in two ways:
                    •      List of numbers (for small n)
                    •      Function (for large n)
                    These are equivalent!
                    Also useful to display visually.



Tuesday, 26 January 2010
a)                                              b)
       0.8
                                                              1.0

       0.6                                                    0.8

                                                              0.6
       0.4
f(x)




                                                       f(x)
                                                              0.4
       0.2
                                                              0.2

       0.0                                                    0.0
             1.0           1.5       2.0   2.5   3.0                 1.0   1.5       2.0   2.5   3.0
                                 x                                               x


                                                 c)                                              d)
                                                               0.5
       0.4
                                                               0.4

       0.3                                                     0.3

                                                               0.2
f(x)




                                                       f(x)
       0.2
                                                               0.1
       0.1
                                                               0.0

       0.0                                                    −0.1
             1             2         3      4     5                   1     2         3     4     5
                                 x                                               x
Tuesday, 26 January 2010
Distributions
                    In practice, many real problems can be
                    approximated with just a few different
                    families of pmf/pdfs. These are called
                    distributions.
                    A distribution has parameters which control
                    how it acts. If a random variable has a
                    named distribution, then we write it as:
                    X ~ DistributionName(parameters)


Tuesday, 26 January 2010
Bernoulli distribution
                    Single binary event: either happens (with
                    probability p) or doesn’t happen.
                    Let X be a random variable that takes the
                    value 1 if the event happens, 0 otherwise.
                    Then X ~ Bernoulli(p)
                    f(1) = P(X = 1) = p
                    f(0) = ?


Tuesday, 26 January 2010
Wait, is that a pmf?



Tuesday, 26 January 2010
Binomial distribution

                    n independent Bernoulli trials with the
                    same probability of success. Let X be the
                    number of successes.
                    Then we say X ~ Binomial(n, p)
                    P(X = x) = f(x) = ??



Tuesday, 26 January 2010
Wait, is that a pmf?
                    Random mathematical fact.
                    Need to check the two conditions.
                    First easy, second a bit harder.


                    (If I ever give you a random mathematical
                    fact you can expect to use it. Main
                    challenge is recognising where it is needed)


Tuesday, 26 January 2010
Example
                    Let X be the number of babies that a
                    woman has in the next 5 years. Assume
                    the chance of having a baby in a given year
                    is a constant 10%.
                    What additional assumption do we need to
                    use the binomial distribution? Is it
                    reasonable?
                    What is f(0)? What is f(1)? What is P(X  0)?


Tuesday, 26 January 2010
Mean  variance
                    Mean summarises the “middle” of the
                    distribution. Variance summarise the
                    “spread” of the distribution.
                    Mean = E(X) = “Sum” of all outcomes,
                    weighted by their probability.
                    Variance = Var(X) = E[ (X - E[X])2) ] =
                    expected squared distance from mean


Tuesday, 26 January 2010
Intuition for mean


                    Imagine the number line as a beam with
                    weights of f(x) at position x. The balance
                    point is the mean.




Tuesday, 26 January 2010
Example


                    Assume 95% of you have 0 stds. 4% of
                    you have 1 std. 1% have 2 stds. What is
                    the expected number of stds?




http://www.cdc.gov/mmwr/preview/mmwrhtml/ss5806a1.htm
Tuesday, 26 January 2010
Mean of a binomial
                            random variable
                    For named distributions we can usually
                    work out the mean (and variance) as
                    functions of the parameters.
                    This is typically a little tricky, but once
                    we’ve done it, we can use a simple
                    formula every time we see that
                    distribution.


Tuesday, 26 January 2010
Another way


                    http://www.wolframalpha.com/input/?
                    i=sum_(x%3D0)^(n)+(x+n!+/+(x!+(n-x)!)
                    +p^x+(1-p)^(n-x))




Tuesday, 26 January 2010

Más contenido relacionado

La actualidad más candente

A current perspectives of corrected operator splitting (os) for systems
A current perspectives of corrected operator splitting (os) for systemsA current perspectives of corrected operator splitting (os) for systems
A current perspectives of corrected operator splitting (os) for systemsAlexander Decker
 
Lesson 23: Antiderivatives (Section 041 slides)
Lesson 23: Antiderivatives (Section 041 slides)Lesson 23: Antiderivatives (Section 041 slides)
Lesson 23: Antiderivatives (Section 041 slides)Matthew Leingang
 
Lesson 14: Derivatives of Logarithmic and Exponential Functions
Lesson 14: Derivatives of Logarithmic and Exponential FunctionsLesson 14: Derivatives of Logarithmic and Exponential Functions
Lesson 14: Derivatives of Logarithmic and Exponential FunctionsMatthew Leingang
 
Lesson 23: Antiderivatives
Lesson 23: AntiderivativesLesson 23: Antiderivatives
Lesson 23: AntiderivativesMatthew Leingang
 
signal homework
signal homeworksignal homework
signal homeworksokok22867
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabkrishna_093
 
Lesson 8: Basic Differentiation Rules (Section 21 handout)
Lesson 8: Basic Differentiation Rules (Section 21 handout)Lesson 8: Basic Differentiation Rules (Section 21 handout)
Lesson 8: Basic Differentiation Rules (Section 21 handout)Matthew Leingang
 
Lesson 12: Linear Approximation (Section 41 handout)
Lesson 12: Linear Approximation (Section 41 handout)Lesson 12: Linear Approximation (Section 41 handout)
Lesson 12: Linear Approximation (Section 41 handout)Matthew Leingang
 
Lesson 8: Basic Differentiation Rules (Section 41 handout)
Lesson 8: Basic Differentiation Rules (Section 41 handout)Lesson 8: Basic Differentiation Rules (Section 41 handout)
Lesson 8: Basic Differentiation Rules (Section 41 handout)Matthew Leingang
 
Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)anithabalaprabhu
 
Lesson 16: Inverse Trigonometric Functions
Lesson 16: Inverse Trigonometric FunctionsLesson 16: Inverse Trigonometric Functions
Lesson 16: Inverse Trigonometric FunctionsMatthew Leingang
 
Lesson15 -exponential_growth_and_decay_021_slides
Lesson15  -exponential_growth_and_decay_021_slidesLesson15  -exponential_growth_and_decay_021_slides
Lesson15 -exponential_growth_and_decay_021_slidesMatthew Leingang
 
Systems Of Differential Equations
Systems Of Differential EquationsSystems Of Differential Equations
Systems Of Differential EquationsJDagenais
 
Senior Seminar: Systems of Differential Equations
Senior Seminar:  Systems of Differential EquationsSenior Seminar:  Systems of Differential Equations
Senior Seminar: Systems of Differential EquationsJDagenais
 
Doe02 statistics
Doe02 statisticsDoe02 statistics
Doe02 statisticsArif Rahman
 

La actualidad más candente (18)

A current perspectives of corrected operator splitting (os) for systems
A current perspectives of corrected operator splitting (os) for systemsA current perspectives of corrected operator splitting (os) for systems
A current perspectives of corrected operator splitting (os) for systems
 
Lesson 23: Antiderivatives (Section 041 slides)
Lesson 23: Antiderivatives (Section 041 slides)Lesson 23: Antiderivatives (Section 041 slides)
Lesson 23: Antiderivatives (Section 041 slides)
 
06 Mean Var
06 Mean Var06 Mean Var
06 Mean Var
 
Lesson 14: Derivatives of Logarithmic and Exponential Functions
Lesson 14: Derivatives of Logarithmic and Exponential FunctionsLesson 14: Derivatives of Logarithmic and Exponential Functions
Lesson 14: Derivatives of Logarithmic and Exponential Functions
 
Lesson 23: Antiderivatives
Lesson 23: AntiderivativesLesson 23: Antiderivatives
Lesson 23: Antiderivatives
 
Lesson 3: Limit Laws
Lesson 3: Limit LawsLesson 3: Limit Laws
Lesson 3: Limit Laws
 
signal homework
signal homeworksignal homework
signal homework
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Lesson 8: Basic Differentiation Rules (Section 21 handout)
Lesson 8: Basic Differentiation Rules (Section 21 handout)Lesson 8: Basic Differentiation Rules (Section 21 handout)
Lesson 8: Basic Differentiation Rules (Section 21 handout)
 
Lesson 12: Linear Approximation (Section 41 handout)
Lesson 12: Linear Approximation (Section 41 handout)Lesson 12: Linear Approximation (Section 41 handout)
Lesson 12: Linear Approximation (Section 41 handout)
 
Lesson 8: Basic Differentiation Rules (Section 41 handout)
Lesson 8: Basic Differentiation Rules (Section 41 handout)Lesson 8: Basic Differentiation Rules (Section 41 handout)
Lesson 8: Basic Differentiation Rules (Section 41 handout)
 
Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)
 
Lesson 16: Inverse Trigonometric Functions
Lesson 16: Inverse Trigonometric FunctionsLesson 16: Inverse Trigonometric Functions
Lesson 16: Inverse Trigonometric Functions
 
06 Arithmetic 1
06 Arithmetic 106 Arithmetic 1
06 Arithmetic 1
 
Lesson15 -exponential_growth_and_decay_021_slides
Lesson15  -exponential_growth_and_decay_021_slidesLesson15  -exponential_growth_and_decay_021_slides
Lesson15 -exponential_growth_and_decay_021_slides
 
Systems Of Differential Equations
Systems Of Differential EquationsSystems Of Differential Equations
Systems Of Differential Equations
 
Senior Seminar: Systems of Differential Equations
Senior Seminar:  Systems of Differential EquationsSenior Seminar:  Systems of Differential Equations
Senior Seminar: Systems of Differential Equations
 
Doe02 statistics
Doe02 statisticsDoe02 statistics
Doe02 statistics
 

Destacado (9)

25 fin
25 fin25 fin
25 fin
 
26 Development
26 Development26 Development
26 Development
 
13 Bivariate
13 Bivariate13 Bivariate
13 Bivariate
 
01 Introduction
01 Introduction01 Introduction
01 Introduction
 
18 Normal Cont
18 Normal Cont18 Normal Cont
18 Normal Cont
 
14 Bivariate Transformations
14 Bivariate Transformations14 Bivariate Transformations
14 Bivariate Transformations
 
07 Discrete
07 Discrete07 Discrete
07 Discrete
 
15 Bivariate Change Of Variables
15 Bivariate Change Of Variables15 Bivariate Change Of Variables
15 Bivariate Change Of Variables
 
24 Spam
24 Spam24 Spam
24 Spam
 

Similar a 05 Random Variables

Lesson 12: Linear Approximation
Lesson 12: Linear ApproximationLesson 12: Linear Approximation
Lesson 12: Linear ApproximationMatthew Leingang
 
Lesson 12: Linear Approximation
Lesson 12: Linear ApproximationLesson 12: Linear Approximation
Lesson 12: Linear ApproximationMel Anthony Pepito
 
Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides) Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides) Mel Anthony Pepito
 
Applied Business Statistics ,ken black , ch 5
Applied Business Statistics ,ken black , ch 5Applied Business Statistics ,ken black , ch 5
Applied Business Statistics ,ken black , ch 5AbdelmonsifFadl
 
Lesson 23: Antiderivatives (Section 021 slides)
Lesson 23: Antiderivatives (Section 021 slides)Lesson 23: Antiderivatives (Section 021 slides)
Lesson 23: Antiderivatives (Section 021 slides)Mel Anthony Pepito
 
Lesson 28: Integration by Subsitution
Lesson 28: Integration by SubsitutionLesson 28: Integration by Subsitution
Lesson 28: Integration by SubsitutionMel Anthony Pepito
 
Lesson 28: Integration by Subsitution
Lesson 28: Integration by SubsitutionLesson 28: Integration by Subsitution
Lesson 28: Integration by SubsitutionMatthew Leingang
 
Lesson 18: Derivatives and the Shapes of Curves
Lesson 18: Derivatives and the Shapes of CurvesLesson 18: Derivatives and the Shapes of Curves
Lesson 18: Derivatives and the Shapes of CurvesMatthew Leingang
 
Introduction to Artificial Intelligence
Introduction to Artificial IntelligenceIntroduction to Artificial Intelligence
Introduction to Artificial IntelligenceManoj Harsule
 
Lesson 21: Curve Sketching
Lesson 21: Curve SketchingLesson 21: Curve Sketching
Lesson 21: Curve SketchingMatthew Leingang
 
Lesson 19: The Mean Value Theorem (Section 021 handout)
Lesson 19: The Mean Value Theorem (Section 021 handout)Lesson 19: The Mean Value Theorem (Section 021 handout)
Lesson 19: The Mean Value Theorem (Section 021 handout)Matthew Leingang
 

Similar a 05 Random Variables (20)

12 Bivariate
12 Bivariate12 Bivariate
12 Bivariate
 
Lesson 4: Continuity
Lesson 4: ContinuityLesson 4: Continuity
Lesson 4: Continuity
 
Lesson 12: Linear Approximation
Lesson 12: Linear ApproximationLesson 12: Linear Approximation
Lesson 12: Linear Approximation
 
Lesson 12: Linear Approximation
Lesson 12: Linear ApproximationLesson 12: Linear Approximation
Lesson 12: Linear Approximation
 
08 Continuous
08 Continuous08 Continuous
08 Continuous
 
06 Moments
06 Moments06 Moments
06 Moments
 
Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides) Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides)
 
Lesson 23: Antiderivatives
Lesson 23: AntiderivativesLesson 23: Antiderivatives
Lesson 23: Antiderivatives
 
Applied Business Statistics ,ken black , ch 5
Applied Business Statistics ,ken black , ch 5Applied Business Statistics ,ken black , ch 5
Applied Business Statistics ,ken black , ch 5
 
Lesson 23: Antiderivatives (Section 021 slides)
Lesson 23: Antiderivatives (Section 021 slides)Lesson 23: Antiderivatives (Section 021 slides)
Lesson 23: Antiderivatives (Section 021 slides)
 
Lesson 28: Integration by Subsitution
Lesson 28: Integration by SubsitutionLesson 28: Integration by Subsitution
Lesson 28: Integration by Subsitution
 
Lesson 28: Integration by Subsitution
Lesson 28: Integration by SubsitutionLesson 28: Integration by Subsitution
Lesson 28: Integration by Subsitution
 
Lesson 18: Derivatives and the Shapes of Curves
Lesson 18: Derivatives and the Shapes of CurvesLesson 18: Derivatives and the Shapes of Curves
Lesson 18: Derivatives and the Shapes of Curves
 
Introduction to Artificial Intelligence
Introduction to Artificial IntelligenceIntroduction to Artificial Intelligence
Introduction to Artificial Intelligence
 
04 Bayes Rule
04 Bayes Rule04 Bayes Rule
04 Bayes Rule
 
Lesson 21: Curve Sketching
Lesson 21: Curve SketchingLesson 21: Curve Sketching
Lesson 21: Curve Sketching
 
Lesson 21: Curve Sketching
Lesson 21: Curve SketchingLesson 21: Curve Sketching
Lesson 21: Curve Sketching
 
Lesson 1: Functions
Lesson 1: FunctionsLesson 1: Functions
Lesson 1: Functions
 
Lesson 1: Functions
Lesson 1: FunctionsLesson 1: Functions
Lesson 1: Functions
 
Lesson 19: The Mean Value Theorem (Section 021 handout)
Lesson 19: The Mean Value Theorem (Section 021 handout)Lesson 19: The Mean Value Theorem (Section 021 handout)
Lesson 19: The Mean Value Theorem (Section 021 handout)
 

Más de Hadley Wickham (20)

27 development
27 development27 development
27 development
 
27 development
27 development27 development
27 development
 
24 modelling
24 modelling24 modelling
24 modelling
 
23 data-structures
23 data-structures23 data-structures
23 data-structures
 
Graphical inference
Graphical inferenceGraphical inference
Graphical inference
 
R packages
R packagesR packages
R packages
 
22 spam
22 spam22 spam
22 spam
 
21 spam
21 spam21 spam
21 spam
 
20 date-times
20 date-times20 date-times
20 date-times
 
19 tables
19 tables19 tables
19 tables
 
18 cleaning
18 cleaning18 cleaning
18 cleaning
 
17 polishing
17 polishing17 polishing
17 polishing
 
16 critique
16 critique16 critique
16 critique
 
15 time-space
15 time-space15 time-space
15 time-space
 
14 case-study
14 case-study14 case-study
14 case-study
 
13 case-study
13 case-study13 case-study
13 case-study
 
12 adv-manip
12 adv-manip12 adv-manip
12 adv-manip
 
11 adv-manip
11 adv-manip11 adv-manip
11 adv-manip
 
11 adv-manip
11 adv-manip11 adv-manip
11 adv-manip
 
10 simulation
10 simulation10 simulation
10 simulation
 

Último

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

05 Random Variables

  • 1. Stat310 Discrete random variables Hadley Wickham Tuesday, 26 January 2010
  • 2. Homework • Don’t forget to pledge! • Model answers up v. soon, and on track to get your homeworks back on Thursday. • Homework help session Tuesday & Wednesday 4-5pm. Details on webpage. • Will be other extra credit opportunities Tuesday, 26 January 2010
  • 3. Data visualisation mini course Feb 13 (Saturday). 10am - 3pm. http://www.ece.rice.edu/ece/ datavis2010.html The applied side of statistics - getting data and figuring out what is going on. No maths, lots of graphics and programming Tuesday, 26 January 2010
  • 4. 1. Independence example 2. Random variables 1. Bernoulli 2. Binomial 3. Mean and variance Tuesday, 26 January 2010
  • 6. Are the wearing glasses and wearing hat events independent? 21 Dennis Washingtons in total Tuesday, 26 January 2010
  • 7. Calculations P(glasses) = 9 / 21 P(hat) = 9 / 21 P(glasses and hat) = 3 / 21 = 0.14 P(glasses) P(hat) = 9 / 49 = 0.18 Wearing a glasses and hat together is (slightly) less likely than we’d expect if they were independent. Tuesday, 26 January 2010
  • 8. Definitions A random variable is a random experiment with a numeric sample space. Usually given a capital letter like X, Y or Z. (More formally a random variable is a function that converts outcomes from a random experiment into numbers) The space (or support) of a random variable is the range of the function (cf. sample space) Tuesday, 26 January 2010
  • 9. Definitions If the size of the support is finite or countably infinite, then the random variable is discrete. If the size of the support is uncountably infinite, then the random variable is continuous. Tuesday, 26 January 2010
  • 10. pmf/pdf Every random experiment has a probability function. Every discrete random variable as probability mass function (pmf). Every continuous random variable has probability density function (pdf). Different ways of defining the function that says how likely each outcome is. Tuesday, 26 January 2010
  • 11. This week: discrete Next week: continuous This diverges from the book, but I think it’s easier to work with one set of mathematical tools at a time Tuesday, 26 January 2010
  • 12. Notation Normally call pmf f If we have multiple rv’s and want to make clear which pmf belongs to which rv, we write: fX(x) fY(y) fZ(z) for X, Y, Z f1(x) f2(x) f3(3) for X1, X2, X3 Tuesday, 26 January 2010
  • 13. P (X = xi ) = f (xi ) P (a X b) = f (xi ) xi ∈(a,b) To be a pmf, f must satisfy: f (xi ) = 1 xi ∈S f (xi ) ≥ 0, ∀ xi ∈ S Tuesday, 26 January 2010
  • 14. x f(x) x f(x) x f(x) -1 0.3 10 -0.1 1 0.35 0 0.3 20 0.9 2 0.25 2 0.3 30 0.2 3 0.2 4 0.1 x f(x) x f(x) 5 0.1 5 1 10 0.1 20 0.9 30 0.2 Tuesday, 26 January 2010
  • 15. Notation Can give pmf in two ways: • List of numbers (for small n) • Function (for large n) These are equivalent! Also useful to display visually. Tuesday, 26 January 2010
  • 16. a) b) 0.8 1.0 0.6 0.8 0.6 0.4 f(x) f(x) 0.4 0.2 0.2 0.0 0.0 1.0 1.5 2.0 2.5 3.0 1.0 1.5 2.0 2.5 3.0 x x c) d) 0.5 0.4 0.4 0.3 0.3 0.2 f(x) f(x) 0.2 0.1 0.1 0.0 0.0 −0.1 1 2 3 4 5 1 2 3 4 5 x x Tuesday, 26 January 2010
  • 17. Distributions In practice, many real problems can be approximated with just a few different families of pmf/pdfs. These are called distributions. A distribution has parameters which control how it acts. If a random variable has a named distribution, then we write it as: X ~ DistributionName(parameters) Tuesday, 26 January 2010
  • 18. Bernoulli distribution Single binary event: either happens (with probability p) or doesn’t happen. Let X be a random variable that takes the value 1 if the event happens, 0 otherwise. Then X ~ Bernoulli(p) f(1) = P(X = 1) = p f(0) = ? Tuesday, 26 January 2010
  • 19. Wait, is that a pmf? Tuesday, 26 January 2010
  • 20. Binomial distribution n independent Bernoulli trials with the same probability of success. Let X be the number of successes. Then we say X ~ Binomial(n, p) P(X = x) = f(x) = ?? Tuesday, 26 January 2010
  • 21. Wait, is that a pmf? Random mathematical fact. Need to check the two conditions. First easy, second a bit harder. (If I ever give you a random mathematical fact you can expect to use it. Main challenge is recognising where it is needed) Tuesday, 26 January 2010
  • 22. Example Let X be the number of babies that a woman has in the next 5 years. Assume the chance of having a baby in a given year is a constant 10%. What additional assumption do we need to use the binomial distribution? Is it reasonable? What is f(0)? What is f(1)? What is P(X 0)? Tuesday, 26 January 2010
  • 23. Mean variance Mean summarises the “middle” of the distribution. Variance summarise the “spread” of the distribution. Mean = E(X) = “Sum” of all outcomes, weighted by their probability. Variance = Var(X) = E[ (X - E[X])2) ] = expected squared distance from mean Tuesday, 26 January 2010
  • 24. Intuition for mean Imagine the number line as a beam with weights of f(x) at position x. The balance point is the mean. Tuesday, 26 January 2010
  • 25. Example Assume 95% of you have 0 stds. 4% of you have 1 std. 1% have 2 stds. What is the expected number of stds? http://www.cdc.gov/mmwr/preview/mmwrhtml/ss5806a1.htm Tuesday, 26 January 2010
  • 26. Mean of a binomial random variable For named distributions we can usually work out the mean (and variance) as functions of the parameters. This is typically a little tricky, but once we’ve done it, we can use a simple formula every time we see that distribution. Tuesday, 26 January 2010
  • 27. Another way http://www.wolframalpha.com/input/? i=sum_(x%3D0)^(n)+(x+n!+/+(x!+(n-x)!) +p^x+(1-p)^(n-x)) Tuesday, 26 January 2010