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

Statistical Rethinking Fall 2017 Lecture 05

Statistical Rethinking Fall 2017 Lecture 05

Week 3, Lecture 5, Statistical Rethinking: A Bayesian Course with Examples in R and Stan. This lecture covers Chapter 5 of the book.

Richard McElreath

November 08, 2017
Tweet

More Decks by Richard McElreath

Other Decks in Education

Transcript

  1. “If you get there and the Waffle House is closed?

    That's really bad. That's when you go to work.” Craig Fugate, director (2009–2017) USA Federal Emergency Management Agency (FEMA)
  2. GREEN: Full menu – restaurant has power and damage is

    limited. YELLOW: Limited menu – no power or only power from a generator, or food supplies may be low. RED: Restaurant is closed – indicating severe damage.
  3. Does Waffle House cause divorce?   .6-5*7"3 0 10

    20 30 40 50 6 8 10 12 14 Waffle Houses per million Divorce rate AL AR GA ME NJ OK SC UIBO POF UZQF PG JOĘVFODF XF T POF DBVTF DBO IJEF BOPUIFS .VM
  4. Goals this week • Multivariate Gaussian models • The good:

    • Reveal spurious correlation • Uncover masked association • The bad: • Cause spurious correlation • Hide real associations   .6-5*7"3 0 10 20 30 40 50 6 8 10 12 14 Waffle Houses per million Divorce rate AL AR GA ME NJ OK SC ' Q Q B Q  B UIBO POF UZQF PG JOĘVFODF XF T POF DBVTF DBO IJEF BOPUIFS .VM  *OUFSBDUJPOT &WFO XIFO WBSJBCMF FBDI NBZ TUJMM EFQFOE VQPO UIF P
  5. Spurious association • Correlation does not imply causation • Causation

    does not imply correlation • Causation implies association, perhaps complex • Need models • Q: Does marriage cause divorce?  4163*064 -1 0 1 2 6 8 10 12 Marriage.s Divorce 'ĶĴłĿIJ ƍƊ %JWPSDF SBUF JT BTTPDJBUF NFEJBO BHF BU NBSSJBHF SJHIU  #PUI Q UIJT FYBNQMF ćF BWFSBHF NBSSJBHF S NFEJBO BHF BU NBSSJBHF JT 
  6. Spurious association  4163*064 "440$*"5*0/  -1 0 1 2

    6 8 10 12 Marriage.s Divorce -2 -1 0 1 2 3 6 8 10 12 MedianAgeMarriage.s Divorce 'ĶĴłĿIJ ƍƊ %JWPSDF SBUF JT BTTPDJBUFE XJUI CPUI NBSSJBHF SBUF MFę BOE NFEJBO BHF BU NBSSJBHF SJHIU  #PUI QSFEJDUPS WBSJBCMFT BSF TUBOEBSEJ[FE JO UIJT FYBNQMF ćF BWFSBHF NBSSJBHF SBUF BDSPTT 4UBUFT JT  BOE UIF BWFSBHF NFEJBO BHF BU NBSSJBHF JT 
  7. Multivariate divorce • Want to know: what is value of

    a predictor, once we know the other predictors? • What is value of knowing marriage rate, once we already know median age at marriage? • What is value of knowing median age marriage, once we know marriage rate?  .6-5*7"3*"5& -*/&"3 .0%&-4 TTBSZ TP IFSF JT UIF NPEFM UIBU QSFEJDUT EJWPSDF SBUF VTJOH CPUI NBSSJBHF %J ∼ /PSNBM(µJ, σ) >OLNHOLKRRG@ µJ = α + β3 3J + β" "J >OLQHDUPRGHO@ α ∼ /PSNBM(, ) >SULRUIRU α@
  8. divorce rate marriage rate median age marriage “slope” for marriage

    rate “slope” for median age marriage  .6-5*7"3*"5& -*/&"3 .0%&-4 ZT OFDFTTBSZ TP IFSF JT UIF NPEFM UIBU QSFEJDUT EJWPSDF SBUF VTJOH CPUI BHF BU NBSSJBHF %J ∼ /PSNBM(µJ, σ) >OLNHOLKRRG@ µJ = α + β3 3J + β" "J >OLQHDUPRGHO@ α ∼ /PSNBM(, ) >SULRUIRU α@ β3 ∼ /PSNBM(, ) >SULRUIRU β3@ β" ∼ /PSNBM(, ) >SULRUIRU β"@ σ ∼ 6OJGPSN(, ) >SULRUIRU σ@ WFS TZNCPMT ZPV MJLF GPS UIF QBSBNFUFST BOE WBSJBCMFT CVU IFSF *WF DIPTFO F BOE " GPS BHF BU NBSSJBHF SFVTJOH UIFTF TZNCPMT BT TVCTDSJQUT GPS UIF BNFUFST #VU GFFM GSFF UP VTF XIJDIFWFS TZNCPMT SFEVDF UIF MPBE PO ZPVS
  9. TBSZ TP IFSF JT UIF NPEFM UIBU QSFEJDUT EJWPSDF SBUF

    VTJOH CPUI BSSJBHF %J ∼ /PSNBM(µJ, σ) >OLNHOLKRRG@ µJ = α + β3 3J + β" "J >OLQHDUPRGHO@ α ∼ /PSNBM(, ) >SULRUIRU α@ β3 ∼ /PSNBM(, ) >SULRUIRU β3@ β" ∼ /PSNBM(, ) >SULRUIRU β"@ σ ∼ 6OJGPSN(, ) >SULRUIRU σ@ PMT ZPV MJLF GPS UIF QBSBNFUFST BOE WBSJBCMFT CVU IFSF *WF DIPTFO GPS BHF BU NBSSJBHF SFVTJOH UIFTF TZNCPMT BT TVCTDSJQUT GPS UIF #VU GFFM GSFF UP VTF XIJDIFWFS TZNCPMT SFEVDF UIF MPBE PO ZPVS UP BTTVNF µJ = α + β3 3J + β" "J *U NFBOT UIBU UIF FYQFDUFE NBSSJBHF SBUF 3J BOE NFEJBO BHF BU NBSSJBHF "J JT UIF TVN PG UISFF
  10. 'JUUJOH UIF NPEFM 5P ĕU UIJT NPEFM UP UIF EJWPSDF

    EBUB XF KVTU FYQBOE UIF MJOFBS )FSFT UIF NPEFM EFĕOJUJPO BHBJO OPX XJUI UIF DPEF PO UIF SJHIUIBOE TJEF %J ∼ /PSNBM(µJ, σ) &3,/ " ʍ !+,/*ǯ*2ǒ0&$*ǰ µJ = α + β3 3J + β" "J *2 ʆǦ ʀǹ//&$"Ǒ0ʀǹ"!&+$"//&$"Ǒ0 α ∼ /PSNBM(, )  ʍ !+,/*ǯƾƽǒƾƽǰ β3 ∼ /PSNBM(, )  ʍ !+,/*ǯƽǒƾǰ β" ∼ /PSNBM(, )  ʍ !+,/*ǯƽǒƾǰ σ ∼ 6OJGPSN(, ) 0&$* ʍ !2+&#ǯƽǒƾƽǰ SF JT UIF *- ĕUUJOH DPEF Ǧ *-ǯ &01ǯ &3,/ " ʍ !+,/*ǯ *2 ǒ 0&$* ǰ ǒ *2 ʆǦ  ʀ ǹ//&$"Ǒ0 ʀ ǹ"!&+$"//&$"Ǒ0 ǒ  ʍ !+,/*ǯ ƾƽ ǒ ƾƽ ǰ ǒ  ʍ !+,/*ǯ ƽ ǒ ƾ ǰ ǒ  ʍ !+,/*ǯ ƽ ǒ ƾ ǰ ǒ 0&$* ʍ !2+&#ǯ ƽ ǒ ƾƽ ǰ
  11. σ ∼ 6OJGPSN(, ) 0&$* ʍ !2+&#ǯƽǒƾƽǰ "OE IFSF JT

    UIF *- ĕUUJOH DPEF 3 DPEF  *ǂǑǀ ʆǦ *-ǯ )&01ǯ &3,/ " ʍ !+,/*ǯ *2 ǒ 0&$* ǰ ǒ *2 ʆǦ  ʀ ǹ//&$"Ǒ0 ʀ ǹ"!&+$"//&$"Ǒ0 ǒ  ʍ !+,/*ǯ ƾƽ ǒ ƾƽ ǰ ǒ  ʍ !+,/*ǯ ƽ ǒ ƾ ǰ ǒ  ʍ !+,/*ǯ ƽ ǒ ƾ ǰ ǒ 0&$* ʍ !2+&#ǯ ƽ ǒ ƾƽ ǰ ǰ ǒ !1 ʅ ! ǰ -/" &0ǯ *ǂǑǀ ǰ "+ 1!"3 ǂǑǂɵ džǁǑǂɵ  džǑǃdž ƽǑƿƽ džǑǀǃ ƾƽǑƽƾ  ǦƽǑƾǀ ƽǑƿDž ǦƽǑǂDž ƽǑǀƾ  ǦƾǑƾǀ ƽǑƿDž ǦƾǑǂDž ǦƽǑǃdž 0&$* ƾǑǁǁ ƽǑƾǁ ƾǑƿƾ ƾǑǃDŽ ćF QPTUFSJPS NFBO GPS NBSSJBHF SBUF  JT OPX DMPTF UP [FSP XJUI QMFOUZ PG QSPCBCJMJUZ PG CPUI TJEFT PG [FSP ćF QPTUFSJPS NFBO GPS BHF BU NBSSJBHF  IBT BDUVBMMZ HPUUFO TMJHIUMZ GBSUIFS GSPN [FSP CVU JT FTTFOUJBMMZ VODIBOHFE *U XJMM IFMQ UP WJTVBMJ[F UIFTF QPTUFSJPS EJT USJCVUJPO FTUJNBUFT 3 DPEF  -),1ǯ -/" &0ǯ*ǂǑǀǰ ǰ
  12.  ǦƽǑƾǀ ƽǑƿDž ǦƽǑǂDž ƽǑǀƾ  ǦƾǑƾǀ ƽǑƿDž ǦƾǑǂDž ǦƽǑǃdž

    0&$* ƾǑǁǁ ƽǑƾǁ ƾǑƿƾ ƾǑǃDŽ ćF QPTUFSJPS NFBO GPS NBSSJBHF SBUF  JT OPX DMPTF UP [FSP XJUI QMFOUZ PG QSPCBCJMJUZ PG CPUI TJEFT PG [FSP ćF QPTUFSJPS NFBO GPS BHF BU NBSSJBHF  IBT BDUVBMMZ HPUUFO TMJHIUMZ GBSUIFS GSPN [FSP CVU JT FTTFOUJBMMZ VODIBOHFE *U XJMM IFMQ UP WJTVBMJ[F UIFTF QPTUFSJPS EJT USJCVUJPO FTUJNBUFT 3 DPEF  -),1ǯ -/" &0ǯ*ǂǑǀǰ ǰ ćJT JT UIF SFTVMU XJUI ."1 WBMVFT TIPXO CZ UIF QPJOUT BOE UIF QFSDFOUJMF JOUFSWBMT CZ UIF TPMJE IPSJ[POUBM MJOFT sigma bA bR a -2 0 2 4 6 8 10 Value :PV DBO JOUFSQSFU UIFTF FTUJNBUFT BT TBZJOH "+ 1!"3 ǂǑǂɵ džǁǑǂɵ  džǑǃdž ƽǑƿƽ džǑǀǃ ƾƽǑƽƾ  ǦƽǑƾǀ ƽǑƿDž ǦƽǑǂDž ƽǑǀƾ  ǦƾǑƾǀ ƽǑƿDž ǦƾǑǂDž ǦƽǑǃdž 0&$* ƾǑǁǁ ƽǑƾǁ ƾǑƿƾ ƾǑǃDŽ ćF QPTUFSJPS NFBO GPS NBSSJBHF SBUF  JT OPX DMPTF UP [FSP XJUI CPUI TJEFT PG [FSP ćF QPTUFSJPS NFBO GPS BHF BU NBSSJBHF  IB GBSUIFS GSPN [FSP CVU JT FTTFOUJBMMZ VODIBOHFE *U XJMM IFMQ UP WJTV USJCVUJPO FTUJNBUFT -),1ǯ -/" &0ǯ*ǂǑǀǰ ǰ ćJT JT UIF SFTVMU XJUI ."1 WBMVFT TIPXO CZ UIF QPJOUT BOE UIF QF TPMJE IPSJ[POUBM MJOFT sigma bA bR a -2 0 2 4 6 8 Value PG [FSP ćF QPTUFSJPS NFBO GPS BHF BU NBSSJBHF  IBT BDUVBMMZ HPUUFO T PN [FSP CVU JT FTTFOUJBMMZ VODIBOHFE *U XJMM IFMQ UP WJTVBMJ[F UIFTF QPTUFSJ FTUJNBUFT " &0ǯ*ǂǑǀǰ ǰ SFTVMU XJUI ."1 WBMVFT TIPXO CZ UIF QPJOUT BOE UIF QFSDFOUJMF JOUFSWBMT [POUBM MJOFT sigma bA bR a -2 0 2 4 6 8 10 Value OUFSQSFU UIFTF FTUJNBUFT BT TBZJOH
  13. Multivariate divorce • Once we know median age marriage, little

    additional value in knowing marriage rate. • Once we know marriage rate, still value in knowing median age marriage. • If we don’t know median age marriage, still useful to know marriage rate. USJCVUJPO FTUJNBUFT -),1ǯ -/" &0ǯ*ǂǑǀǰ ǰ ćJT JT UIF SFTVMU XJUI ."1 WBMVFT TIPXO CZ U TPMJE IPSJ[POUBM MJOFT sigma bA bR a -2 0 2 V :PV DBO JOUFSQSFU UIFTF FTUJNBUFT BT TBZJOH
  14. Plotting multivariate models • Lots of plotting options now 1.

    Predictor residual plots 2. Counterfactual plots 3. Posterior prediction plots 4. invent your own  4163*064 "440$ -1 0 1 2 6 8 10 12 Marriage.s Divorce 6 8 10 12 Divorce 'ĶĴłĿIJ ƍƊ %JWPSDF SBUF JT BTTPDJBUFE XJU NFEJBO BHF BU NBSSJBHF SJHIU  #PUI QSFEJD UIJT FYBNQMF ćF BWFSBHF NBSSJBHF SBUF BDS NFEJBO BHF BU NBSSJBHF JT  ĕHVSF #VU EPFT NBSSJBHF DBVTF EJWPSDF *O B USJW HFU B EJWPSDF XJUIPVU ĕSTU HFUUJOH NBSSJFE #VU UIFS SJBHF SBUF UP CF DPSSFMBUFE XJUI EJWPSDF‰JUT FBTZ UP IJHI DVMUVSBM WBMVBUJPO PG NBSSJBHF BOE UIFSFGPSF CF TPNFUIJOH JT TVTQJDJPVT IFSF "OPUIFS QSFEJDUPS BTTPDJBUFE XJUI EJWPSDF JT UI UIF SJHIUIBOE QMPU JO 'ĶĴłĿIJ ƍƊ "HF BU NBSSJBHF J IJHIFS BHF BU NBSSJBHF QSFEJDUT MFTT EJWPSDF :PV DBO CZ ĕUUJOH UIJT MJOFBS SFHSFTTJPO NPEFM  4163*064 "440$*"5*0/  -1 0 1 2 6 8 10 12 Marriage.s Divorce -2 -1 0 1 2 3 6 8 10 12 MedianAgeMarriage.s Divorce 'ĶĴłĿIJ ƍƊ %JWPSDF SBUF JT BTTPDJBUFE XJUI CPUI NBSSJBHF SBUF MFę BOE
  15. Predictor residual plots • Goal: Show association of each predictor

    with outcome, “controlling” for other predictors • Useful intuition • Never analyze residuals! • Recipe: 1. Regress predictor on other predictors 2. Compute predictor residuals 3. Regress outcome on residuals
  16. 1. Predictor on predictor • Regress marriage rate on median

    age marriage -2 -1 0 1 2 3 MedianAgeMarriage.s IBWF IJHIFS SBUFT PG NBSSJBHF UIBO FYQFDUFE BDDPSEJOH UP BHF BU NBSSJBHF ćPTF CFMPX UIF MJOF IBWF MPXFS SBUFT UIBO FYQFDUFE "T CFGPSF 3 JT NBSSJBHF SBUF BOE " JT NFEJBO BHF BU NBSSJBHF /PUF UIBU TJODF XF TUBOEBSEJ[FE CPUI WBSJBCMFT XF BMSFBEZ FYQFDU UIF NFBO α UP CF BSPVOE [FSP 4P *WF DFOUFSFE αT QSJPS UIFSF CVU JUT TUJMM TP ĘBU UIBU JU IBSEMZ NBUUFST ćJT DPEF XJMM ĕU UIF NPEFM 3 DPEF  *ǂǑǁ ʆǦ *-ǯ )&01ǯ //&$"Ǒ0 ʍ !+,/*ǯ *2 ǒ 0&$* ǰ ǒ *2 ʆǦ  ʀ ǹ"!&+$"//&$"Ǒ0 ǒ  ʍ !+,/*ǯ ƽ ǒ ƾƽ ǰ ǒ  ʍ !+,/*ǯ ƽ ǒ ƾ ǰ ǒ 0&$* ʍ !2+&#ǯ ƽ ǒ ƾƽ ǰ ǰ ǒ !1 ʅ ! ǰ "OE UIFO XF DPNQVUF UIF SFTJEVBMT CZ TVCUSBDUJOH UIF PCTFSWFE NBSSJBHF SBUF JO FBDI 4UBUF GSPN UIF QSFEJDUFE SBUF CBTFE VQPO VTJOH BHF BU NBSSJBHF 3 DPEF  ȅ ,*-21" "5-" 1"! 3)2" 1 ǒ #,/ " % 11" *2 ʆǦ ,"#ǯ*ǂǑǁǰDZǚǚDz ʀ ,"#ǯ*ǂǑǁǰDZǚǚDzǹ!ɢ"!&+$"//&$"Ǒ0 ȅ ,*-21" /"0&!2) #,/ " % 11" SFHSFTTJPO PG TPSUT UIBU IBT BMSFBEZ iDPOUSPMMFEw GPS BMM PG UIF PUIFS MFBWFT JO UIF WBSJBUJPO UIBU JT OPU FYQFDUFE CZ UIF NPEFM PG UIF NF PUIFS QSFEJDUPST *O PVS NVMUJWBSJBUF NPEFM PG EJWPSDF SBUF XF IBWF UXP QSFE //&$"Ǒ0 BOE  NFEJBO BHF BU NBSSJBHF "!&+$"//& EJDUPS SFTJEVBMT GPS FJUIFS XF KVTU VTF UIF PUIFS QSFEJDUPS UP NPEF UIJT JT UIF NPEFM XF OFFE 3J ∼ /PSNBM(µJ, σ) µJ = α + β"J α ∼ /PSNBM(, ) β ∼ /PSNBM(, ) σ ∼ 6OJGPSN(, )
  17. 2. Compute residuals • Residual: distance of each outcome from

    expectation //&$"Ǒ0 ʍ !+,/*ǯ *2 ǒ 0&$* ǰ ǒ *2 ʆǦ  ʀ ǹ"!&+$"//&$"Ǒ0 ǒ  ʍ !+,/*ǯ ƽ ǒ ƾƽ ǰ ǒ  ʍ !+,/*ǯ ƽ ǒ ƾ ǰ ǒ 0&$* ʍ !2+&#ǯ ƽ ǒ ƾƽ ǰ ǰ ǒ !1 ʅ ! ǰ "OE UIFO XF DPNQVUF UIF SFTJEVBMT CZ TVCUSBDUJOH UIF PCTFSWFE NBSSJBHF SBUF JO FBDI 4UBUF GSPN UIF QSFEJDUFE SBUF CBTFE VQPO VTJOH BHF BU NBSSJBHF 3 DPEF  ȅ ,*-21" "5-" 1"! 3)2" 1 ǒ #,/ " % 11" *2 ʆǦ ,"#ǯ*ǂǑǁǰDZǚǚDz ʀ ,"#ǯ*ǂǑǁǰDZǚǚDzǹ!ɢ"!&+$"//&$"Ǒ0 ȅ ,*-21" /"0&!2) #,/ " % 11" *Ǒ/"0&! ʆǦ !ɢ//&$"Ǒ0 Ǧ *2 8IFO B SFTJEVBM JT QPTJUJWF UIBU NFBOT UIBU UIF PCTFSWFE SBUF XBT JO FYDFTT PG XIBU XFE FYQFDU HJWFO UIF NFEJBO BHF BU NBSSJBHF JO UIBU 4UBUF 8IFO B SFTJEVBM JT OFHBUJWF UIBU NFBOT UIF PCTFSWFE SBUF XBT CFMPX XIBU XFE FYQFDU *O TJNQMFS UFSNT 4UBUFT XJUI QPTJUJWF SFTJEVBMT NBSSZ GBTU GPS UIFJS BHF PG NBSSJBHF XIJMF 4UBUFT XJUI OFHBUJWF SFTJEVBMT NBSSZ TMPX GPS UIFJS BHF PG NBSSJBHF *UMM IFMQ UP QMPU UIF SFMBUJPOTIJQ CFUXFFO UIFTF UXP WBSJBCMFT BOE TIPX UIF SFTJEVBMT BT XFMM )FSFT TPNF DPEF UP EP KVTU UIBU ESBXJOH B HSBZ MJOF TFHNFOU GPS FBDI SFTJEVBM GPS FBDI 4UBUF
  18. -2 -1 0 1 2 3 -1 0 1 2

    d$MedianAgeMarriage.s d$Marriage.s
  19. residual -2 -1 0 1 2 3 -1 0 1

    2 MedianAgeMarriage.s Marriage.s 'ĶĴłĿIJ ƍƌ 3 BęFS BDDPVOU NFEJBO BHF B JT B SFTJEVBM SJBHF SBUF GSP QSFEJDU NBSSJ BMPOF 4P 4UBU MJOF IBWF IJHI BDDPSEJOH UP B IBWF MPXFS SB
  20.   .6-5*7"3*"5& -*/&"3 .0%&-4 -2 -1 0 1 2

    3 -1 0 1 2 MedianAgeMarriage.s Marriage.s 'ĶĴłĿIJ ƍƌ 3FTJEVBM NBSSJBHF SBUF JO FBDI 4UBUF BęFS BDDPVOUJOH GPS UIF MJOFBS BTTPDJBUJPO XJUI NFEJBO BHF BU NBSSJBHF &BDI HSBZ MJOF TFHNFOU JT B SFTJEVBM UIF EJTUBODF PG FBDI PCTFSWFE NBS SJBHF SBUF GSPN UIF FYQFDUFE WBMVF BUUFNQUJOH UP QSFEJDU NBSSJBHF SBUF XJUI NFEJBO BHF BU NBSSJBHF BMPOF 4P 4UBUFT UIBU MJF BCPWF UIF CMBDL SFHSFTTJPO MJOF IBWF IJHIFS SBUFT PG NBSSJBHF UIBO FYQFDUFE BDDPSEJOH UP BHF BU NBSSJBHF ćPTF CFMPX UIF MJOF IBWF MPXFS SBUFT UIBO FYQFDUFE 0 12 14 rce rate faster slower 0 12 14 rce rate older younger marriage rate < expectation “low rate for age of marriage” marriage rate > expectation “high rate for age of marriage”
  21. slower faster   .6-5*7"3*"5& -*/&"3 .0%&-4 -2 -1 0

    1 2 3 -1 0 1 2 MedianAgeMarriage.s Marriage.s 'ĶĴłĿIJ ƍƌ 3FTJEVBM NBSSJBHF SBUF JO FBDI 4UB BęFS BDDPVOUJOH GPS UIF MJOFBS BTTPDJBUJPO XJ NFEJBO BHF BU NBSSJBHF &BDI HSBZ MJOF TFHNF JT B SFTJEVBM UIF EJTUBODF PG FBDI PCTFSWFE NB SJBHF SBUF GSPN UIF FYQFDUFE WBMVF BUUFNQUJOH QSFEJDU NBSSJBHF SBUF XJUI NFEJBO BHF BU NBSSJB BMPOF 4P 4UBUFT UIBU MJF BCPWF UIF CMBDL SFHSFTTJP MJOF IBWF IJHIFS SBUFT PG NBSSJBHF UIBO FYQFDUF BDDPSEJOH UP BHF BU NBSSJBHF ćPTF CFMPX UIF MJ IBWF MPXFS SBUFT UIBO FYQFDUFE 2 14 e faster slower 2 14 e older younger -2 -1 0 1 2 3 MedianAgeMarriage.s IBWF MPXF -1.5 -0.5 0.5 1.0 1.5 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower Divorce rate 'ĶĴłĿIJ ƍƍ 1SFEJDUPS SFTJEVBM QMPUT GPS UI GBTU NBSSJBHF SBUFT GPS UIFJS NFEJBO BHF P EJWPSDF SBUFT BT EP 4UBUFT XJUI TMPX NBSSJ NFEJBO BHF PG NBSSJBHF GPS UIFJS NBSSJBH XIJMF 4UBUFT XJUI ZPVOH NFEJBO BHF PG NBS
  22. 3. Outcome on residuals • How is divorce associated with

    residual marriage rate? States with fast/slow rates of marriage (for age of marriage) do not (on average) have fast/slow divorce rates -2 -1 0 1 2 3 -1 0 1 MedianAgeMarriage.s Marriage. JT B S SJBHF QSFEJ BMPOF MJOF I BDDPS IBWF -1.5 -0.5 0.5 1.0 1.5 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower 'ĶĴłĿIJ ƍƍ 1SFEJDUPS SFTJEVBM QMPUT G
  23.   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4

    6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4 6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę Figure 5.4 -3 -1 0 1 2 3 -5 0 5 10 MedianAgeMarriage.c Marriage.c -5 0 5 10 -3 -1 1 2 3 Marriage.c MedianAgeMarriage.c
  24.   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4

    6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4 6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę Figure 5.4 -3 -1 0 1 2 3 -5 0 5 10 MedianAgeMarriage.c Marriage.c -5 0 5 10 -3 -1 1 2 3 Marriage.c MedianAgeMarriage.c slower faster
  25.   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4

    6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4 6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę Figure 5.4 -3 -1 0 1 2 3 -5 0 5 10 MedianAgeMarriage.c Marriage.c -5 0 5 10 -3 -1 1 2 3 Marriage.c MedianAgeMarriage.c
  26.   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4

    6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4 6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę Figure 5.4 -3 -1 0 1 2 3 -5 0 5 10 MedianAgeMarriage.c Marriage.c -5 0 5 10 -3 -1 1 2 3 Marriage.c MedianAgeMarriage.c younger older
  27.   .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4

    6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƌ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę  .6-5*7"3*"5& -*/&"3 .0%&-4 -6 -2 0 2 4 6 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 3 6 8 10 12 14 Age of marriage residuals Divorce rate older younger Figure 5.4 -3 -1 0 1 2 3 -5 0 5 10 MedianAgeMarriage.c Marriage.c -5 0 5 10 -3 -1 1 2 3 Marriage.c MedianAgeMarriage.c
  28. Statistical “control” • Multiple linear regression answers question: How is

    each predictor associated with outcome, once we know all the other predictors? • Uses model to build expected outcomes — not magic! • Don’t get cocky: Marriage rate may still be associated with divorce, for some subset of States • Can’t make strong causal inferences from averages; need data on individuals -1.5 -0.5 0.5 1.0 1.5 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower 'ĶĴłĿIJ ƍƍ 1SFEJDUPS SFTJEVBM QMPUT GP GBTU NBSSJBHF SBUFT GPS UIFJS NFEJBO BH EJWPSDF SBUFT BT EP 4UBUFT XJUI TMPX N NFEJBO BHF PG NBSSJBHF GPS UIFJS NBS XIJMF 4UBUFT XJUI ZPVOH NFEJBO BHF PG 4P 4UBUFT UP UIF SJHIU PG UIF MJOF NBSSZ GBTUFS UIB TMPXFS UIBO FYQFDUFE "WFSBHF EJWPSDF SBUF PO C UIF SFHSFTTJPO MJOF EFNPOTUSBUFT MJUUMF SFMBUJPOT TMPQF PG UIF SFHSFTTJPO MJOF JT −. FYBDUMZ XI ćF SJHIUIBOE QMPU JO 'ĶĴłĿIJ ƍƍ EJTQMBZT NFEJBO BHF BU NBSSJBHF iDPOUSPMMJOHw GPS NBSSJ EBTIFE MJOF IBWF PMEFS UIBO FYQFDUFE NFEJBO ZPVOHFS UIBO FYQFDUFE NFEJBO BHF BU NBSSJBHF PO UIF SJHIU JT MPXFS UIBO UIF SBUF PO UIF MFę -2 -1 0 1 2 3 -1 0 1 2 MedianAgeMarriage.s Marriage.s 'ĶĴłĿIJ ƍƌ 3FTJEVBM NBSSJBHF SBUF JO FBDI 4U BęFS BDDPVOUJOH GPS UIF MJOFBS BTTPDJBUJPO X NFEJBO BHF BU NBSSJBHF &BDI HSBZ MJOF TFHN JT B SFTJEVBM UIF EJTUBODF PG FBDI PCTFSWFE N SJBHF SBUF GSPN UIF FYQFDUFE WBMVF BUUFNQUJOH QSFEJDU NBSSJBHF SBUF XJUI NFEJBO BHF BU NBSSJ BMPOF 4P 4UBUFT UIBU MJF BCPWF UIF CMBDL SFHSFTT MJOF IBWF IJHIFS SBUFT PG NBSSJBHF UIBO FYQFDU BDDPSEJOH UP BHF BU NBSSJBHF ćPTF CFMPX UIF M IBWF MPXFS SBUFT UIBO FYQFDUFE -1.5 -0.5 0.5 1.0 1.5 6 8 10 12 14 Marriage rate residuals Divorce rate faster slower -1 0 1 2 6 8 10 12 14 Age of marriage residuals Divorce rate older younger 'ĶĴłĿIJ ƍƍ 1SFEJDUPS SFTJEVBM QMPUT GPS UIF EJWPSDF EBUB -Fę 4UBUFT XJUI GBTU NBSSJBHF SBUFT GPS UIFJS NFEJBO BHF PG NBSSJBHF IBWF BCPVU UIF TBNF
  29. Counterfactual plots • Goal: Explore model implications for outcomes •

    Fix other predictor(s) • Compute predictions across values of predictor • Compute for unobserved (impossible?) cases, hence “counterfactual” Figure 5.6   .6-5*7"3*"5& -*/&"3 .0%&-4 -1 0 1 2 6 8 10 12 Marriage.s Divorce MedianAgeMarriage.s = 0 -2 -1 0 1 2 3 6 8 10 12 MedianAgeMarriage.s Divorce Marriage.s = 0 'ĶĴłĿIJ ƍƎ $PVOUFSGBDUVBM QMPUT GPS UIF NVMUJWBSJBUF EJWPSDF NPEFM (ǀǏƾ
  30. Figure 5.6 Change marriage rate, without changing median age marriage?

    Change median age marriage, without changing marriage rate? -1 0 1 2 6 8 10 12 Marriage.s Divorce MedianAgeMarriage.s = 0 -2 -1 0 1 2 3 6 8 10 12 MedianAgeMarriage.s Divorce Marriage.s = 0 'ĶĴłĿIJ ƍƎ $PVOUFSGBDUVBM QMPUT GPS UIF NVMUJWBSJBUF EJWPSDF NPEFM (ǀǏƾ &BDI QMPU TIPXT UIF DIBOHF JO QSFEJDUFE NFBO BDSPTT WBMVFT PG B TJOHMF QSF EJDUPS IPMEJOH UIF PUIFS QSFEJDUPS DPOTUBOU BU JUT NFBO WBMVF [FSP JO CPUI DBTFT  4IBEFE SFHJPOT TIPX  QFSDFOUJMF JOUFSWBMT PG UIF NFBO EBSL OBSSPX BOE  QSFEJDUJPO JOUFSWBMT MJHIU XJEF  .# ǭ (0Ǐ ǐ Ǐ. , Ǯ .# ǭ Ǐ ǐ Ǐ. , Ǯ ćF TUSBUFHZ BCPWF JT UP CVJME B OFX MJTU PG EBUB UIBU EFTDSJCF UIF DPVOUFSGBDUVBM DBTFT XF XJTI UP TJNVMBUF QSFEJDUJPOT GPS ćF '$./ OBNFE +- Ǐ/ IPMET UIFTF DBTFT /PUF UIBU UIF PCTFSWFE WBMVFT GPS  $)" --$" Ǐ. BSF OPU VTFE *OTUFBE XF DPNQVUF UIF BWFS BHF WBMVF BOE UIFO VTF UIJT BWFSBHF JOTJEF UIF MJOFBS NPEFM 4P --$" Ǐ. DIBOHFT BDSPTT
  31. Posterior predictions • Goal: Compute implied predictions for observed cases

    • Check model fit — golems do make mistakes • Find model failures, stimulate new ideas • Always average over the posterior distribution • Using only MAP leads to overconfidence • Embrace the uncertainty
  32. 4 6 8 10 12 14 case Divorce 1 3

    5 7 9 11 13 15 17 19 21 23 25 Posterior validation check 4 6 8 10 12 14 case Divorce 26 28 30 32 34 36 38 40 42 44 46 48 50 Posterior validation check postcheck(m5.3)
  33. Figure 5.6 Predicted compared to observed  4163*064 "440$*"5*0/ (a)

    (c) (b) 6 8 10 12 6 8 10 12 Observed divorce Predicted divorce ID UT TX MI DE DC NC OH IA KS MD MA WA NM WV VT OR SD AZ TN NH IN MS LA RI CO OK GA KY AK AL AR ME 4 ME