Upgrade to Pro — share decks privately, control downloads, hide ads and more …

L02 Statistical Rethinking Winter 2019

L02 Statistical Rethinking Winter 2019

Lecture 02 of the Dec 2018 through March 2019 edition of Statistical Rethinking.

A0f2f64b2e58f3bfa48296fb9ed73853?s=128

Richard McElreath

December 07, 2018
Tweet

Transcript

  1. The Garden of Forking Data Statistical Rethinking Winter 2019 Lecture

    2 / Week 1
  2. Building a model • How to use probability to do

    typical statistical modeling? 1. Design the model (data story) 2. Condition on the data (update) 3. Evaluate the model (critique)
  3. Nine tosses of the globe: W L W W W

    L W L W
  4. Design > Condition > Evaluate • Data story motivates the

    model • How do the data arise? • For W L W W W L W L W: • Some true proportion of water, p • Toss globe, probability p of observing W, 1–p of L • Each toss therefore independent of other tosses • Translate data story into probability statements
  5. Design > Condition > Evaluate • Bayesian updating defines optimal

    learning in small world, converts prior into posterior • Give your golem an information state, before the data: Here, an initial confidence in each possible value of p between zero and one • Condition on data to update information state: New confidence in each value of p, conditional on data
  6. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W W n = 4 W L W W W L W L W confidence n = 5 W L W W W L W L W W prior p, proportion W plausibility
  7. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W W n = 4 W L W W W L W L W confidence n = 5 W L W W W L W L W W prior posterior p, proportion W plausibility
  8. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W probability of water 0 0.5 1 n = 3 W L W W W L W L W probability of water 0 0.5 1 n = 4 W L W W W L W L W confidence probability of water 0 0.5 1 n = 5 W L W W W L W L W probability of water 0 0.5 1 n = 6 W L W W W L W L W probability of water 0 0.5 1 n = 7 W L W W W L W L W confidence probability of water 0 0.5 1 n = 8 W L W W W L W L W probability of water 0 0.5 1 n = 9 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W
  9. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W probability of water 0 0.5 1 n = 3 W L W W W L W L W probability of water 0 0.5 1 n = 4 W L W W W L W L W confidence probability of water 0 0.5 1 n = 5 W L W W W L W L W probability of water 0 0.5 1 n = 6 W L W W W L W L W probability of water 0 0.5 1 n = 7 W L W W W L W L W confidence probability of water 0 0.5 1 n = 8 W L W W W L W L W probability of water 0 0.5 1 n = 9 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W
  10. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W probability of water 0 0.5 1 n = 3 W L W W W L W L W probability of water 0 0.5 1 n = 4 W L W W W L W L W confidence probability of water 0 0.5 1 n = 5 W L W W W L W L W probability of water 0 0.5 1 n = 6 W L W W W L W L W probability of water 0 0.5 1 n = 7 W L W W W L W L W confidence probability of water 0 0.5 1 n = 8 W L W W W L W L W probability of water 0 0.5 1 n = 9 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W
  11. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W probability of water 0 0.5 1 n = 3 W L W W W L W L W probability of water 0 0.5 1 n = 4 W L W W W L W L W confidence probability of water 0 0.5 1 n = 5 W L W W W L W L W probability of water 0 0.5 1 n = 6 W L W W W L W L W probability of water 0 0.5 1 n = 7 W L W W W L W L W confidence probability of water 0 0.5 1 n = 8 W L W W W L W L W probability of water 0 0.5 1 n = 9 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W
  12. probability of water 0 0.5 1 n = 1 W

    L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W probability of water 0 0.5 1 n = 3 W L W W W L W L W probability of water 0 0.5 1 n = 4 W L W W W L W L W confidence probability of water 0 0.5 1 n = 5 W L W W W L W L W probability of water 0 0.5 1 n = 6 W L W W W L W L W probability of water 0 0.5 1 n = 7 W L W W W L W L W confidence probability of water 0 0.5 1 n = 8 W L W W W L W L W probability of water 0 0.5 1 n = 9 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W
  13. Design > Condition > Evaluate • Data order irrelevant, because

    golem assumes order irrelevant • All-at-once, one-at-a-time, shuffled order all give same posterior • Every posterior is a prior for next observation • Every prior is posterior of some other inference • Sample size automatically embodied in posterior   4."-- 803-%4 "/% -"3(& 803-%4 probability of water 0 0.5 1 n = 1 W L W W W L W L W confidence probability of water 0 0.5 1 n = 2 W L W W W L W L W probability of water 0 0.5 1 n = 3 W L W W W L W L W probability of water 0 0.5 1 n = 4 W L W W W L W L W confidence probability of water 0 0.5 1 n = 5 W L W W W L W L W probability of water 0 0.5 1 n = 6 W L W W W L W L W probability of water 0 0.5 1 n = 7 W L W W W L W L W confidence probability of water 0 0.5 1 n = 8 W L W W W L W L W probability of water 0 0.5 1 n = 9 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W proportion water 0 0.5 1 plausibility n = 0 W L W W W L W L W 'ĶĴłĿIJ Ɗƍ )PX B #BZFTJBO NPEFM MFBSOT &BDI UPTT PG UIF HMPCF QSPEVDFT BO PCTFSWBUJPO PG XBUFS 8 PS MBOE -  ćF NPEFMT FTUJNBUF PG UIF QSP QPSUJPO PG XBUFS PO UIF HMPCF JT B QMBVTJCJMJUZ GPS FWFSZ QPTTJCMF WBMVF ćF MJOFT BOE DVSWFT JO UIJT ĕHVSF BSF UIFTF DPMMFDUJPOT PG QMBVTJCJMJUJFT *O FBDI QMPU B QSFWJPVT QMBVTJCJMJUJFT EBTIFE DVSWF BSF VQEBUFE JO MJHIU PG UIF MBUFTU
  14. Design > Condition > Evaluate • Bayesian inference: Logical answer

    to a question in the form of a model “How plausible is each proportion of water, given these data?” • Golem must be supervised • Did the golem malfunction? • Does the golem’s answer make sense? • Does the question make sense? • Check sensitivity of answer to changes in assumptions
  15. Construction perspective • Build joint model: (1) List variables (2)

    Define generative relations (3) ??? (4) Profit • Input: Joint prior • Deduce: Joint posterior
  16. N W p

  17. N W p Observed Unobserved Observed

  18. Definition of W • Relative number of ways to see

    W, given N and p? • Goal: Mathematical function to answer this question. • The answer is a probability distribution.
  19. Definition of W • Relative number of ways to see

    W, given N and p? p × (1–p) × p = p2(1–p)1
  20. Definition of W • Relative number of ways to see

    W, given N and p? p × (1–p) × p = p2(1–p)1
  21. Definition of W • Relative number of ways to see

    W, given N and p? Pr(2|3,p) = 3p2(1–p)1
  22. W distribution (Likelihood) count W number tosses probability W The

    count of W’s is distributed binomially, with probability p of a W on each toss and N tosses total. Pr(W|N, p) = N! W!(N W)! pW (1 p)N W
  23. BSF OP PUIFS FWFOUT ćF HMPCF OFWFS HFUT TUVDL UP

    UIF DFJMJOH GPS FYBNQMF 8IFO XF PCTFSWF B TBNQMF PG 8T BOE -T PG MFOHUI /  JO UIF BDUVBM TBNQMF XF OFFE UP TBZ IPX MJLFMZ UIBU FYBDU TBNQMF JT PVU PG UIF VOJWFSTF PG QPUFOUJBM TBNQMFT PG UIF TBNF MFOHUI ćBU NJHIU TPVOE DIBMMFOHJOH CVU JUT UIF LJOE PG UIJOH ZPV HFU HPPE BU WFSZ RVJDLMZ PODF ZPV TUBSU QSBDUJDJOH *O UIJT DBTF PODF XF BEE PVS BTTVNQUJPOT UIBU  FWFSZ UPTT JT JOEFQFOEFOU PG UIF PUIFS UPTTFT BOE  UIF QSPCBCJMJUZ PG 8 JT UIF TBNF PO FWFSZ UPTT QSPCBCJMJUZ UIFPSZ QSPWJEFT B VOJRVF BOTXFS LOPXO BT UIF CJOPNJBM EJTUSJCVUJPO ćJT JT UIF DPNNPO iDPJO UPTTJOHw EJTUSJCVUJPO "OE TP UIF QSPCBCJMJUZ PG PCTFSWJOH X 8T JO O UPTTFT XJUI B QSPCBCJMJUZ Q PG 8 JT 1S(X|O, Q) = O! X!(O − X)! QX ( − Q)O−X . 3FBE UIF BCPWF BT ćF DPVOU PG iXBUFSw PCTFSWBUJPOT X JT EJTUSJCVUFE CJOPNJBMMZ XJUI QSPCB CJMJUZ Q PG iXBUFSw PO FBDI UPTT BOE O UPTTFT JO UPUBM "OE UIF CJOPNJBM EJTUSJCVUJPO GPSNVMB JT CVJMU JOUP 3 TP ZPV DBO FBTJMZ DPNQVUF UIF MJLFMJ IPPE PG UIF EBUB‰ 8T JO  UPTTFT‰VOEFS BOZ WBMVF PG Q XJUI 3 DPEF  $)*(ǭ ǁ ǐ .$5 ʃDŽ ǐ +-*ʃƻǏǀ Ǯ ǯƼǰ ƻǏƼǁƿƻǁƽǀ ćBU OVNCFS JT UIF SFMBUJWF OVNCFS PG XBZT UP HFU  8T IPMEJOH Q BU  BOE O BU  4P JU EPFT UIF KPC PG DPVOUJOH SFMBUJWF OVNCFS PG QBUIT UISPVHI UIF HBSEFO $IBOHF UIF ƻǏǀ UP BOZ PUIFS WBMVF UP TFF IPX UIF WBMVF DIBOHFT 4PNFUJNFT MJLFMJIPPET BSF XSJUUFO -(Q|X, O) UIF MJLFMJIPPE PG Q DPOEJUJPOBM PO X BOE O /PUF IPXFWFS UIBU UIJT OPUBUJPO SFWFSTFT XIBU JT PO UIF MFę TJEF PG UIF | TZNCPM +VTU LFFQ JO NJOE UIBU UIF KPC PG UIF MJLFMJIPPE JT UP UFMM VT UIF SFMBUJWF OVNCFS PG XBZT UP TFF UIF EBUB X HJWFO WBMVFT GPS Q BOE O W distribution (Likelihood) Pr(W|N, p) = N! W!(N W)! pW (1 p)N W
  24. Prior probability p • What the golem believes before the

    data arrive • In this case, equal prior probability 0–1 • Pr(W) & Pr(p) define prior predictive distribution • More on this later – it helps us build priors that make sense   4."-- 8 probability of water 0 0.5 1 n = 1 W L W W W L W L W confidence n = 4 W L W W W L W L W dence prior p, proportion W plausibility
  25. Prior literature • Huge literature on choice of prior •

    Flat prior conventional & bad • Always know something (before data) that can improve inference • Are zero and one plausible values for p? Is p < 0.5 as plausible as p > 0.5? • There is no “true” prior • Just need to do better than flat • All above equally true of likelihood Late Cretaceous (90Mya)
  26. The Joint Model α α ρσβ σβ σ α ρσα

    σβ ρσα σβ σ β 8 ∼ #JOPNJBM(/, Q) Q ∼ 6OJGPSN(, )
  27. Posterior probability • Bayesian “estimate” is always posterior distribution over

    parameters, Pr(parameters|data) • Here: Pr(p|W,N) • Compute using Bayes’ theorem: σα ρσα ρσβ σβ σ α ρσα σβ ρσα σβ σ β 8 ∼ #JOPNJBM(/, Q) Q ∼ 6OJGPSN(, ) 1S(Q|8, /) = 1S(8|/, Q) 1S(Q) 1S(8|/, Q) 1S(Q) GPS BMM Q 1PTUFSJPS = 1SPC PCTFSWFE WBSJBCMFT × 1SJPS /PSNBMJ[JOH DPOTUBOU
  28. posterior 0 0.5 1 likelihood 0 0.5 1 prior 0

    0.5 1 ⇥ / posterior 0 0.5 1 prior 0 0.5 1 ⇥ / ⇥ / likelihood 0 0.5 1 prior 0 0.5 1 likelihood 0 0.5 1 posterior 0 0.5 1
  29. posterior 0 0.5 1 likelihood 0 0.5 1 prior 0

    0.5 1 ⇥ / posterior 0 0.5 1 prior 0 0.5 1 ⇥ / ⇥ / likelihood 0 0.5 1 prior 0 0.5 1 likelihood 0 0.5 1 posterior 0 0.5 1
  30. posterior 0 0.5 1 likelihood 0 0.5 1 prior 0

    0.5 1 ⇥ / posterior 0 0.5 1 prior 0 0.5 1 ⇥ / ⇥ / likelihood 0 0.5 1 prior 0 0.5 1 likelihood 0 0.5 1 posterior 0 0.5 1
  31. Computing the posterior 1. Analytical approach (often impossible) 2. Grid

    approximation (very intensive) 3. Quadratic approximation (limited) 4. Markov chain Monte Carlo (intensive)
  32. Grid approximation • The posterior probability is: standardized product of

    (1) probability of the data (2) prior probability • “Standardized” means: Add up all the products and divide each by this sum • Grid approximation uses finite grid of parameter values instead of continuous space • Too expensive with more than a few parameters
  33. 0.0 0.2 0.4 0.6 0.8 1.0 proportion of water posterior

    probability 0 0.5 1
  34. 0.0 0.2 0.4 0.6 0.8 1.0 proportion of water posterior

    probability 0 0.5 1 3 values
  35. 0.0 0.2 0.4 proportion of water posterior probability 0 0.25

    0.5 0.75 1 5 values
  36. 10 values 0.00 0.10 0.20 0.30 proportion of water posterior

    probability 0 0.22 0.44 0.67 0.89
  37. 0.00 0.04 0.08 0.12 proportion of water posterior probability 0

    0.21 0.47 0.74 1 20 values
  38. 0.0000 0.0010 0.0020 proportion of water posterior probability 0 0.17

    0.39 0.6 0.8 1 1000 values
  39. Compute posterior • Grid approximation Bę 1MVH JO UIF BQQSPQSJBUF

    WBMVFT BOE UIF BOTXFS JT BQQSPYJNBUFMZ 1S(USVF|QPT) = . 4P B QPTJUJWF ĕOEJOH DPSSFTQPOET UP B  DIBODF UIBU UIF IZQPUIFTJT JT USVF ćJT JT UIF TBNF MPX CBTFSBUF QIF OPNFOPO UIBU BQQMJFT JO NFEJDBM BOE WBNQJSF UFTUJOH :PV DBO TISJOL UIF GBMTFQPTJUJWF SBUF UP  BOE HFU UIJT QPTUFSJPS QSPCBCJMJUZ VQ UP  POMZ BT HPPE BT B DPJO ĘJQ ćF NPTU JNQPSUBOU UIJOH UP EP JT UP JNQSPWF UIF CBTF SBUF 1S(USVF) BOE UIBU SFRVJSFT UIJOLJOH OPU UFTUJOH  4BNQMJOH GSPN B HSJEBQQSPYJNBUF QPTUFSJPS #FGPSF CFHJOOJOH UP XPSL XJUI TBNQMFT XF OFFE UP HFOFSBUF UIFN )FSFT B SFNJOEFS GPS IPX UP DPNQVUF UIF QPTUFSJPS GPS UIF HMPCF UPTTJOH NPEFM VTJOH HSJE BQQSPYJNBUJPO 3FNFNCFS UIF QPTUFSJPS IFSF NFBOT UIF QSPCBCJMJUZ PG Q DPOEJUJPOBM PO UIF EBUB 3 DPEF  +Ǿ"-$ ʚǶ . ,ǿ !-*(ʙǍ Ǣ /*ʙǎ Ǣ ' )"/#ǡ*0/ʙǎǍǍǍ Ȁ +-*Ǿ+ ʚǶ - +ǿ ǎ Ǣ ǎǍǍǍ Ȁ +-*Ǿ/ ʚǶ $)*(ǿ Ǔ Ǣ .$5 ʙǖ Ǣ +-*ʙ+Ǿ"-$ Ȁ +*./ -$*- ʚǶ +-*Ǿ/ ȉ +-*Ǿ+ +*./ -$*- ʚǶ +*./ -$*- ȅ .0(ǿ+*./ -$*-Ȁ /PX XF XJTI UP ESBX   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Ǿ+ +*./ -$*- ʚǶ +*./ -$*- ȅ .0(ǿ+*./ -$*-Ȁ /PX XF XJTI UP ESBX   TBNQMFT GSPN UIJT QPTUFSJPS GVMM PG QBSBNFUFS WBMVFT OVNCFST TVDI BT     FYJTUT JO QSPQPSUJPO UP JUT QPTUFSJPS QSPCBCJMJUZ TVDI UIBU W DPNNPO UIBO UIPTF JO UIF UBJMT 8FSF HPJOH UP TDPPQ P 1SPWJEFE UIF CVDLFU JT XFMM NJYFE UIF SFTVMUJOH TBNQMFT UIF FYBDU QPTUFSJPS EFOTJUZ ćFSFGPSF UIF JOEJWJEVBM WBMV JO QSPQPSUJPO UP UIF QPTUFSJPS QMBVTJCJMJUZ PG FBDI WBMVF )FSFT IPX ZPV DBO EP UIJT JO 3 XJUI POF MJOF PG DPE 3 DPEF  .(+' . ʚǶ .(+' ǿ +Ǿ"-$ Ǣ +-*ʙ+*./ -$*- Ǣ .$5 ćF XPSLIPSTF IFSF JT .(+' XIJDI SBOEPNMZ QVMMT WB UIJT DBTF JT +Ǿ"-$ UIF HSJE PG QBSBNFUFS WBMVFT ćF QS +*./ -$*- XIJDI ZPV DPNQVUFE KVTU BCPWF ćF SFTVMUJOH TBNQMFT BSF EJTQMBZFE JO 'ĶĴłĿIJ ƋƉ 0 TBNQMFT BSF TIPXO TFRVFOUJBMMZ 3 DPEF  +'*/ǿ .(+' . Ȁ *O UIJT QMPU JUT BT JG ZPV BSF ĘZJOH PWFS UIF QPTUFSJPS EJTUS 0 200 600 1000 0.0 0.4 0.8 Index p
  42. ESB GPS IPX UP DPNQVUF UIF QPTUFSJPS GPS UIF HMPCF

    UPTTJOH 3FNFNCFS UIF QPTUFSJPS IFSF NFBOT UIF QSPCBCJMJUZ PG Q 3 DPEF  +Ǿ"-$ ʚǶ . ,ǿ !-*(ʙǍ Ǣ /*ʙǎ Ǣ ' )"/#ǡ*0/ʙǎǍǍǍ Ȁ +-*Ǿ+ ʚǶ - +ǿ ǎ Ǣ ǎǍǍǍ Ȁ +-*Ǿ/ ʚǶ $)*(ǿ Ǔ Ǣ .$5 ʙǖ Ǣ +-*ʙ+Ǿ"-$ Ȁ +*./ -$*- ʚǶ +-*Ǿ/ ȉ +-*Ǿ+ +*./ -$*- ʚǶ +*./ -$*- ȅ .0(ǿ+*./ -$*-Ȁ /PX XF XJTI UP ESBX   TBNQMFT GSPN UIJT QPTUFSJPS GVMM PG QBSBNFUFS WBMVFT OVNCFST TVDI BT     FYJTUT JO QSPQPSUJPO UP JUT QPTUFSJPS QSPCBCJMJUZ TVDI UIBU W DPNNPO UIBO UIPTF JO UIF UBJMT 8FSF HPJOH UP TDPPQ P 1SPWJEFE UIF CVDLFU JT XFMM NJYFE UIF SFTVMUJOH TBNQMFT UIF FYBDU QPTUFSJPS EFOTJUZ ćFSFGPSF UIF JOEJWJEVBM WBMV JO QSPQPSUJPO UP UIF QPTUFSJPS QMBVTJCJMJUZ PG FBDI WBMVF )FSFT IPX ZPV DBO EP UIJT JO 3 XJUI POF MJOF PG DPE 3 DPEF  .(+' . ʚǶ .(+' ǿ +Ǿ"-$ Ǣ +-*ʙ+*./ -$*- Ǣ .$5 ćF XPSLIPSTF IFSF JT .(+' XIJDI SBOEPNMZ QVMMT WB UIJT DBTF JT +Ǿ"-$ UIF HSJE PG QBSBNFUFS WBMVFT ćF QS +*./ -$*- XIJDI ZPV DPNQVUFE KVTU BCPWF ćF SFTVMUJOH TBNQMFT BSF EJTQMBZFE JO 'ĶĴłĿIJ ƋƉ 0 TBNQMFT BSF TIPXO TFRVFOUJBMMZ 3 DPEF  +'*/ǿ .(+' . Ȁ *O UIJT QMPU JUT BT JG ZPV BSF ĘZJOH PWFS UIF QPTUFSJPS EJTUS 0 200 600 1000 0.0 0.4 0.8 Index p 0 200 600 1000 0.6 0.8 1.0 1.2 1.4 Index prior
  43. ESB GPS IPX UP DPNQVUF UIF QPTUFSJPS GPS UIF HMPCF

    UPTTJOH 3FNFNCFS UIF QPTUFSJPS IFSF NFBOT UIF QSP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WF ćF SFTVMUJOH TBNQMFT BSF EJTQMBZFE JO 'ĶĴłĿIJ ƋƉ 0 TBNQMFT BSF TIPXO TFRVFOUJBMMZ 3 DPEF  +'*/ǿ .(+' . Ȁ *O UIJT QMPU JUT BT JG ZPV BSF ĘZJOH PWFS UIF QPTUFSJPS EJTUS 0 200 600 1000 0.0 0.4 0.8 Index p 0 200 600 1000 0.6 0.8 1.0 1.2 1.4 Index prior 0 200 600 1000 0.00 0.10 0.20 Index likelihood 0 200 600 1000 0.0000 0.0015 Index posterior
  45. None
  46. Sampling from the posterior • Incredibly useful to sample randomly

    from the posterior • Visualize uncertainty • Compute confidence intervals • Simulate observations • MCMC produces only samples • Above all, easier to think with samples • Transforms a hard calculus problem into an easy data summary problem
  47. Sampling from the posterior • Recipe: 1. Compute or approximate

    posterior 2. Sample with replacement from posterior 3. Compute stuff from samples
  48. Sample from posterior UFSJPS JT B CVDLFU GVMM PG QBSBNFUFS

    WBMVFT OVNCFST TVDI BT     FUD 8JUIJO UIF CVDLFU FBDI WBMVF FYJTUT JO QSPQPSUJPO UP JUT QPTUFSJPS QSPCBCJMJUZ TVDI UIBU WBMVFT OFBS UIF QFBL BSF NVDI NPSF DPNNPO UIBO UIPTF JO UIF UBJMT 8FSF HPJOH UP TDPPQ PVU UIPVTBOE WBMVFT GSPN UIF CVDLFU 1SPWJEFE UIF CVDLFU JT XFMM NJYFE UIF SFTVMUJOH TBNQMFT XJMM IBWF UIF TBNF QSPQPSUJPOT BT UIF FYBDU QPT UFSJPS EFOTJUZ )FSFT IPX ZPV DBO EP UIJT JO 3 XJUI POF MJOF PG DPEF 3 DPEF  .(+' . ʄǤ .(+' ǭ + ǐ +-*ʃ+*./ -$*- ǐ .$5 ʃƼ ƿ ǐ - +' ʃ Ǯ ćF XPSLIPSTF IFSF JT .(+' XIJDI SBOEPNMZ QVMMT WBMVFT GSPN B WFDUPS ćF WFDUPS JO UIJT DBTF JT (* '. UIF HSJE PG QBSBNFUFS WBMVFT ćF SFTVMUJOH TBNQMFT BSF EJTQMBZFE JO 'ĶĴłĿIJ ƋƉ 0O UIF MFę BMM UIPVTBOE Ƽ ƿ SBOEPN TBNQMFT BSF TIPXO TFRVFOUJBMMZ 3 DPEF  +'*/ǭ .(+' . Ǯ Figure 3.1  4".1-*/( 50 46.."3*;&  0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.5 1.0 1.5 2.0 2.5 proportion water (p) Density 'ĶĴłĿIJ ƋƉ 4BNQMJOH QBSBNFUFS WBMVFT GSPN UIF QPTUFSJPS EJTUSJCVUJPO -Fę UIPVTBOE TBNQMFT GSPN UIF QPTUFSJPS JNQMJFE CZ UIF HMPCF UPTTJOH EBUB BOE NPEFM 3JHIU ćF EFOTJUZ PG TBNQMFT WFSUJDBM BU FBDI QBSBNFUFS
  49. Compute stuff • Summary tasks • How much posterior probability

    below/above/between specified parameter values? • Which parameter values contain 50%/80%/95% of posterior probability? “Confidence” intervals • Which parameter value maximizes posterior probability? Minimizes posterior loss? Point estimates • You decide the question
  50. Figure 3.2 Intervals of defined boundary ask how much mass?

    Intervals of defined mass ask which values? 0.00 0.25 0.50 0.75 1.00 0.0000 0.0010 0.0020 proportion water (p) Density 0.00 0.25 0.50 0.75 1.00 0.0000 0.0010 0.0020 proportion water (p) Density 0.00 0.25 0.50 0.75 1.00 0.0000 0.0010 0.0020 proportion water (p) Density lower 80% 0.00 0.25 0.50 0.75 1.00 0.0000 0.0010 0.0020 proportion water (p) Density middle 80% 'ĶĴłĿIJ ƋƊ 5XP LJOET PG DPOĕEFODF JOUFSWBM 5PQ SPX JOUFSWBMT PG EFĕOFE
  51. • Percentile intervals (PI): equal area in each tail •

    Highest posterior density intervals (HPDI): narrowest interval containing mass Figure 3.3 0.00 0.25 0.50 0.75 1.00 0.000 0.001 0.002 0.003 0.004 proportion water (p) Density 50% Percentile Interval 0.00 0.25 0.50 0.75 1.00 0.000 0.001 0.002 0.003 0.004 proportion water (p) Density 50% HPDI 'ĶĴłĿIJ ƋƋ ćF EJČFSFODF CFUXFFO QFSDFOUJMF BOE IJHIFTU QPTUFSJPS EFO TJUZ DPOĕEFODF JOUFSWBMT ćF QPTUFSJPS EFOTJUZ IFSF DPSSFTQPOET UP B ĘBU QSJPS BOE PCTFSWJOH UISFF XBUFS TBNQMFT JO UISFF UPUBM UPTTFT PG UIF HMPCF -Fę  QFSDFOUJMF JOUFSWBM ćJT JOUFSWBM BTTJHOT FRVBM NBTT  UP CPUI UIF MFę BOE SJHIU UBJM "T B SFTVMU JU PNJUT UIF NPTU QSPCBCMF QBSBNFUFS WBMVF Q =  3JHIU  IJHIFTU QPTUFSJPS EFOTJUZ JOUFSWBM )1%* ćJT JOUFSWBM ĕOET UIF OBSSPXFTU SFHJPO XJUI  PG UIF QPTUFSJPS QSPCBCJMJUZ 4VDI B SFHJPO BMXBZT JODMVEFT UIF NPTU QSPCBCMF QBSBNFUFS WBMVF
  52. Figure 3.3 0.00 0.25 0.50 0.75 1.00 0.000 0.001 0.002

    0.003 0.004 proportion water (p) Density 50% Percentile Interval 0.00 0.25 0.50 0.75 1.00 0.000 0.001 0.002 0.003 0.004 proportion water (p) Density 50% HPDI 'ĶĴłĿIJ ƋƋ ćF EJČFSFODF CFUXFFO QFSDFOUJMF BOE IJHIFTU QPTUFSJPS EFO TJUZ DPOĕEFODF JOUFSWBMT ćF QPTUFSJPS EFOTJUZ IFSF DPSSFTQPOET UP B ĘBU QSJPS BOE PCTFSWJOH UISFF XBUFS TBNQMFT JO UISFF UPUBM UPTTFT PG UIF HMPCF -Fę  QFSDFOUJMF JOUFSWBM ćJT JOUFSWBM BTTJHOT FRVBM NBTT  UP CPUI UIF MFę BOE SJHIU UBJM "T B SFTVMU JU PNJUT UIF NPTU QSPCBCMF QBSBNFUFS WBMVF Q =  3JHIU  IJHIFTU QPTUFSJPS EFOTJUZ JOUFSWBM )1%* ćJT JOUFSWBM ĕOET UIF OBSSPXFTU SFHJPO XJUI  PG UIF QPTUFSJPS QSPCBCJMJUZ 4VDI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FYBNQMF JU FOET VQ FYDMVEJOH UIF NPTU BCMF QBSBNFUFS WBMVFT OFBS Q =  4P JO UFSNT PG EFTDSJCJOH UIF TIBQF PG UIF QPT TBNQMFT XJUI  QBSU PG - /#$)&$)"  3 DPEF   ǭ .(+' . ǐ +-*ʃƻǏǀ Ǯ ƽǀɳ ǂǀɳ ƻǏǂƻƾǂƻƾǂ ƻǏDŽƾƽDŽƾƽDŽ ćJT JOUFSWBM BTTJHOT  PG UIF QSPCBCJ WJEFT UIF DFOUSBM  QSPCBCJMJUZ #VU JO BCMF QBSBNFUFS WBMVFT OFBS Q =  4P EJTUSJCVUJPO‰XIJDI JT SFBMMZ BMM UIFTF JO CF NJTMFBEJOH *O DPOUSBTU UIF SJHIUIBOE QMPU JO ' ıIJĻŀĶŁņ ĶĻŁIJĿŃĮĹ )1%*  ćF )1% QSPCBCJMJUZ NBTT *G ZPV UIJOL BCPVU JU UI XJUI UIF TBNF NBTT #VU JG ZPV XBOU BO NPTU DPOTJTUFOU XJUI UIF EBUB UIFO ZPV )1%* JT $PNQVUF JU GSPN UIF TBNQMFT X 3 DPEF   ǭ .(+' . ǐ +-*ʃƻǏǀ Ǯ '*2 - ƻǏǀ 0++ - ƻǏǀ ƻǏǃƿƼǃƿƼǃ ƼǏƻƻƻƻƻƻƻ ćJT JOUFSWBM DBQUVSFT UIF QBSBNFUFST XJU UJDFBCMZ OBSSPXFS  JO XJEUI SBUIFS U 4P UIF )1%* IBT TPNF BEWBOUBHFT JOUFSWBM BSF WFSZ TJNJMBS ćFZ POMZ MPP
  53. Point estimates not the point • Don’t usually want point

    estimates • Entire posterior contains more information • “Best” point depends upon purpose • Mean nearly always more sensible than mode  4".1-*/( 0.00 0.25 0.50 0.75 1.00 0.000 0.001 0.002 0.003 0.004 proportion water (p) Density 50% Percentile Interval 'ĶĴłĿIJ ƋƋ ćF EJČFSFODF CFUXFFO TJUZ DPOĕEFODF JOUFSWBMT ćF QPTUFS QSJPS BOE PCTFSWJOH UISFF XBUFS TBN -Fę  QFSDFOUJMF JOUFSWBM ćJT JOU UIF MFę BOE SJHIU UBJM "T B SFTVMU JU PN Q =  3JHIU  IJHIFTU QPTUFSJPS ĕOET UIF OBSSPXFTU SFHJPO XJUI 
  54. Talking about intervals • “Confidence interval” • A non-Bayesian term

    that doesn’t even mean what it says • “Credible interval” • The values are not “credible” unless you trust the model & data • How about: Compatibility interval • Interval contains values compatible with model and data as provided • Small World interval https://xkcd.com/2048/
  55. Predictive checks • Posterior probability never enough • Even the

    best model might make terrible predictions • Also want to check model assumptions • Predictive checks: Can use samples from posterior to simulate observations • NB: Assumption about sampling is assumption
  56. 0 1000 3000 number of water samples Frequency 0 3

    6 9 0.89 0 1000 3000 number of water samples Frequency 0 3 6 9 0.38 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (A) p = 0.38 (B) p = 0.64 (C) p = 0.89 A B C Merged Figure 3.4
  57. 0 1000 3000 number of water samples Frequency 0 3

    6 9 0.89 0 1000 3000 number of water samples Frequency 0 3 6 9 0.38 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (A) p = 0.38 (B) p = 0.64 (C) p = 0.89 A B C Merged Figure 3.4
  58. 0 1000 3000 number of water samples Frequency 0 3

    6 9 0.89 0 1000 3000 number of water samples Frequency 0 3 6 9 0.38 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (A) p = 0.38 (B) p = 0.64 (C) p = 0.89 A B C Merged Figure 3.4
  59. 0 1000 3000 number of water samples Frequency 0 3

    6 9 0.89 0 1000 3000 number of water samples Frequency 0 3 6 9 0.38 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (A) p = 0.38 (B) p = 0.64 (C) p = 0.89 A B C Merged Figure 3.4
  60. 0 1000 3000 number of water samples Frequency 0 3

    6 9 0.89 0 1000 3000 number of water samples Frequency 0 3 6 9 0.38 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (A) p = 0.38 (B) p = 0.64 (C) p = 0.89 A B C Merged Figure 3.4 0 1000 3000 Frequency 0 3 6 9 0.89 0 1000 3000 number of water samples Frequency 0 3 6 9 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (B) p = 0.64 (C) p = 0.89 A B C Merged
  61. Posterior predictions • One line of code • Will get

    harder, later. But strategy remains the same. 0 1000 3000 number of water samples Frequency 0 3 6 9 0.89 number of water samples 0 3 6 9 0 1000 3000 number of water samples Frequency 0 3 6 9 0.64 0 1000 3000 number of water samples Frequency 0 3 6 9 0.000 0.010 0.020 probability of water probability 0 0.5 1 (B) p = 0.64 (C) p = 0.89 A B C Merged 'ĶĴłĿIJ Ƌƌ 4JNVMBUJOH QSFEJDUJPOT GSPN UIF UPUBM QPTUFSJPS -Fę ćF GBNJMJBS QPTUFSJPS EFOTJUZ GPS UIF HMPCFUPTTJOH EBUB ćSFF FYBNQMF QBSBNFUFS WBMVFT    BSF NBSLFE CZ UIF number of water samples 'ĶĴłĿIJ Ƌƌ 4JNVMBUJOH QSFEJDUJPOT GSPN UIF UPUBM QPTUFSJPS -Fę ćF GBNJMJBS QPTUFSJPS EFOTJUZ GPS UIF HMPCFUPTTJOH EBUB ćSFF FYBNQMF QBSBNFUFS WBMVFT    BSF NBSLFE CZ UIF WFSUJDBM MJOFT .JEEMF DPMVNO &BDI PG UIF UISFF QBSBNFUFS WBM VFT JT VTFE UP TJNVMBUF PCTFSWBUJPOT 3JHIU $PNCJOJOH TJNV MBUFE PCTFSWBUJPO EJTUSJCVUJPOT GPS BMM QBSBNFUFS WBMVFT OPU KVTU   BOE  FBDI XFJHIUFE CZ JUT QPTUFSJPS QSPCBCJMJUZ QSPEVDFT UIF QPTUFSJPS QSFEJDUJWF EFOTJUZ ćJT EFOTJUZ QSPQB HBUFT VODFSUBJOUZ BCPVU QBSBNFUFS UP VODFSUBJOUZ BCPVU QSFEJD UJPO 0CTFSWFE WBMVF  IJHIMJHIUFE 3 DPEF  )2 ʄǤ -$)*(ǭ Ƽ ƿ ǐ .$5 ʃDŽ ǐ +-*ʃ.(+' . Ǯ ćF TZNCPM .(+' . BCPWF JT UIF TBNF MJTU PG SBOEPN TBNQMFT GSPN UIF QPTUFSJPS EFOTJUZ UIBU ZPVWF VTFE JO QSFWJPVT TFDUJPOT 'PS FBDI TBNQMFE WBMVF B SBOEPN CJOPNJBM PCTFSWBUJPO JT HFOFSBUFE 4JODF UIF TBNQMFE WBMVFT BQQFBS JO QSPQPS UJPO UP UIFJS QPTUFSJPS QSPCBCJMJUJFT UIF SFTVMUJOH TJNVMBUFE PCTFSWBUJPOT BSF BW FSBHFE PWFS UIF QPTUFSJPS :PV DBO NBOJQVMBUF UIFTF TJNVMBUFE PCTFSWBUJPOT KVTU MJLF ZPV NBOJQVMBUF TBNQMFT GSPN UIF QPTUFSJPS‰ZPV DBO DPNQVUF JOUFSWBMT BOE
  62. None
  63. Predictive checks • Something like a significance test, but not

    • No universally best way to evaluate adequacy of model-based predictions • No way to justify always using a threshold like 5% • Good predictive checks always depend upon purpose and imagination “It would be very nice to have a formal apparatus that gives us some ‘optimal’ way of recognizing unusual phenomena and inventing new classes of hypotheses [...]; but this remains an art for the creative human mind.” —E.T. Jaynes (1922–1998)
  64. Homework • Week 01 homework on the course website •

    Due Friday December 14 • Next week: Geocentric Models (Chapter 4) • Be sure to update your book PDF! Typos have been fixed, more commits coming for later chapters. Password: tempest https://github.com/rmcelreath/statrethinking_winter2019 homework/week01.pdf