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

Statistical Rethinking Fall 2017 Lecture 09

Statistical Rethinking Fall 2017 Lecture 09

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

Richard McElreath

November 24, 2017
Tweet

More Decks by Richard McElreath

Other Decks in Education

Transcript

  1. Manatees and bombers   */5&3"$5*0/4 'ĶĴłĿIJ ƏƉ ŁļĽ %PSTBM

    TDBST GPS  BEVMU 'MPSJEB NBOBUFFT 3PXT PG Figure 7.1
  2. Manatees and bombers • Conditioning: Dependence on state • Everything

    is conditional • On data • On model • On information state • Interactions: Association of predictor conditional on other predictor(s)
  3. Interaction effects • Interactions: Influence of predictor conditional on other

    predictor(s) • Influence of sugar in coffee depends on stirring • Influence of gene on phenotype depends on environment • Influence of skin color on cancer depends on latitude • Generalized linear models (GLMs): All predictors interact to some degree • Multilevel models: Massive interaction engines
  4. The value of being rugged • Economic indicators and terrain

    ruggedness for 234 countries   $0.1"3*/( .0%&-4 &WFSZUIJOH NBLFT NPSF TFOTF XJUI BO FYBNQMF 4P IFSF ZPVÔMM NFFU B TFU PG EBUB UIBU ZPVÔMM XPSL XJUI BHBJO JO UIF OFYU DIBQUFS (P BIFBE BOE MPBE UIF UBCMF 3 DPEF  OLEUDU\ UHWKLQNLQJ GDWD UXJJHG G  UXJJHG &BDI SPX JO UIJT EBUB GSBNF JT B DPVOUSZ BOE UIF WBSJPVT DPMVNOT BSF FDPOPNJD HFPHSBQIJD BOE IJTUPSJDBM GFBUVSFT 8FÔMM CF JOUFSFTUFE JO QSFEJDUJOH FDPOPNJD EFWFMPQNFOU BT B GVODUJPO PG HFU SFBEZ GPS JU IPX SVHHFE UIF UFSSBJO JT JO B DPVOUSZ 5IF WBSJBCMF UXJJHG JT B 5FSSBJO 3VHHFEOFTT *OEFY UIBU RVBOUJGJFT UIF UPQPHSBQIJD IFUFSPHFOFJUZ PG B MBOETDBQF *G ZPV JOTQFDU UIF EJTUSJCVUJPO PG UXJJHG JO UIF EBUB ZPVÔMM TFF UIBU JU IBT B MPOH SJHIU UBJM EVF UP B GFX WFSZ SVHHFE DPVOUSJFT MJLF /FQBM BOE 4XJU[FSMBOE "O FYQMBOBUPSZ WBSJBCMF XJUI B TLFXFE EJTUSJCVUJPO MJLF UIJT JT VTVBMMZ B HPPE DBOEJEBUF GPS QSFBOBMZTJT USBOTGPSNBUJPO 5IF SFBTPO JT UIBU B QSFEJDUPS WBSJBCMF UIBU GMBSFT PVU PO FJUIFS TJEF JT VOMJLFMZ UP CF MJOFBSMZ SFMBUFE UP BO PVUDPNF WBSJBCMF *O UIJT DBTF *ÔN HPJOH UP TLJQ UIJT TUFQ CPUI GPS UIF TBLF PG TJNQMJGZJOH UIF QSFTFOUBUJPO BOE CF DBVTF JU NBLFT MJUUMF EJGGFSFODF JO UIJT DBTF "GUFS XPSLJOH UISPVHI UIJT  $0.1"3*/( & 0 1 2 3 4 5 6 7 8 9 10 11 Terrain Ruggedness Index log GDP year 2000 Switzerland Kyrgyzstan Lebanon Nepal Tajikistan Yemen 'J UJ SV TP MJ TI UI UI P  OP ORJ UJGSSFB a UXJJHG
  5. • Split data into Africa and non-Africa: Figure 7.2 The

    value of being rugged   */5&3"$5*0/4 0 1 2 3 4 5 6 6 7 8 9 rugged log(rgdppc_2000) Africa 0 1 2 3 4 5 7 8 9 10 11 rugged log(rgdppc_2000) not Africa 'ĶĴłĿIJ ƏƊ 4FQBSBUF MJOFBS SFHSFTTJPOT JOTJEF BOE PVUTJEF PG "GSJDB GPS MPH ȃ (& '*" 1 -.$*) *! *0/*( ɠ'*"Ǭ"+ ʄǤ '*"ǭ ɠ-"++Ǭƽƻƻƻ Ǯ ȃ 3/-/ *0)/-$ . 2$/#  /  ʄǤ ǯ *(+' / Ǐ. .ǭɠ-"++ǬƽƻƻƻǮ ǐ ǰ ȃ .+'$/ *0)/-$ . $)/* !-$ ) )*/Ǥ!-$ ǏƼ ʄǤ ǯ ɠ*)/Ǭ!-$ʃʃƼ ǐ ǰ ȃ !-$ Ǐƻ ʄǤ ǯ ɠ*)/Ǭ!-$ʃʃƻ ǐ ǰ ȃ )*/ !-$ &BDI SPX JO UIFTF EBUB JT B DPVOUSZ BOE UIF WBSJPVT DPMVNOT BSF FDPOPNJD HFPHSBQIJD BOE IJTUPSJDBM GFBUVSFT ćF WBSJBCMF -0""  JT B 5FSSBJO 3VHHFEOFTT *OEFY UIBU RVBOUJĕFT UIF UPQPHSBQIJD IFUFSPHFOFJUZ PG B MBOETDBQF ćF PVUDPNF WBSJBCMF IFSF JT SFBM HSPTT EP NFTUJD QSPEVDU QFS DBQJUB GSPN UIF ZFBS  -"++Ǭƽƻƻƻ 8FMM VTF UIF MPHBSJUIN PG JU BT JT UZQJDBM GPS SFBTPOT TJNJMBS UP UIPTF XF EJTDVTTFE GPS CPEZ NBTT JO $IBQUFS  'JU UIF SFHSFTTJPO NPEFMT EJTQMBZFE JO 'ĶĴłĿIJ ƏƊ XJUI UIJT DPEF 3 DPEF  ȃ !-$) )/$*). (ǂǏƼ ʄǤ (+ǭ '$./ǭ '*"Ǭ"+ ʋ )*-(ǭ (0 ǐ .$"( Ǯ ǐ (0 ʄǤ  ɾ -Ƿ-0""  ǐ  ʋ )*-(ǭ ǃ ǐ Ƽƻƻ Ǯ ǐ - ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ .$"( ʋ 0)$!ǭ ƻ ǐ Ƽƻ Ǯ Ǯ ǐ /ʃǏƼ Ǯ
  6. • Splitting the data is a bad idea: • No

    estimates re how you split the data • Does not pool information • How about adding a categorical variable for Africa? The value of being rugged   */5&3"$5 0 1 2 3 4 5 6 6 7 8 9 rugged log(rgdppc_2000) Africa log(rgdppc_2000) 'ĶĴłĿIJ ƏƊ 4FQBSBUF MJOFBS SFHSFTTJPOT JO (%1 BHBJOTU UFSSBJO SVHHFEOFTT ćF TM OFHBUJWF PVUTJEF )PX DBO XF SFDPWFS UI DPNCJOFE EBUB ȃ (& '*" 1 -.$*) *! *0/*( ɠ'*"Ǭ"+ ʄǤ '*"ǭ ɠ-"++Ǭƽƻƻƻ Ǯ ȃ 3/-/ *0)/-$ . 2$/#  /  ʄǤ ǯ *(+' / Ǐ. .ǭɠ-"++ǬƽƻƻƻǮ ǐ ǰ   */5&3"$5*0/4 0 1 2 3 4 5 6 6 7 8 9 rugged log(rgdppc_2000) Africa 0 1 2 3 4 5 7 8 9 10 11 rugged log(rgdppc_2000) not Africa
  7. Dummy doesn’t work • Dummy variable for Africa: Figure 7.3

    *UT XPSUI ĕUUJOH UIJT NPEFM UP QSPWF JU UP ZPVSTFMG UIPVHI *N HPJOH UP XBML UISPVHI UIJT BT B TJNQMF NPEFM DPNQBSJTPO FYFSDJTF KVTU TP ZPV CFHJO UP HFU TPNF BQQMJFE FYBNQMFT PG DPODFQUT ZPVWF BDDVNVMBUFE GSPN FBSMJFS DIBQUFST ćF RVFTUJPO JT UP XIBU FYUFOU TJOHMJOH PVU "GSJDBO OBUJPOT DIBOHFT QSFEJDUJPOT ćFSF BSF UXP NPEFMT UP ĕU UP TUBSU ćF ĕSTU JT KVTU UIF TJNQMF MJOFBS SFHSFTTJPO PG MPH(%1 PO SVHHFEOFTT CVU OPX GPS UIF FOUJSF EBUB TFU 3 DPEF  (ǂǏƾ ʄǤ (+ǭ '$./ǭ '*"Ǭ"+ ʋ )*-(ǭ (0 ǐ .$"( Ǯ ǐ (0 ʄǤ  ɾ -Ƿ-0""  ǐ  ʋ )*-(ǭ ǃ ǐ Ƽƻƻ Ǯ ǐ - ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ .$"( ʋ 0)$!ǭ ƻ ǐ Ƽƻ Ǯ Ǯ ǐ /ʃ Ǯ ćF TFDPOE JT UIF NPEFM UIBU JODMVEFT B EVNNZ WBSJBCMF GPS "GSJDBO OBUJPOT 3 DPEF  (ǂǏƿ ʄǤ (+ǭ '$./ǭ '*"Ǭ"+ ʋ )*-(ǭ (0 ǐ .$"( Ǯ ǐ (0 ʄǤ  ɾ -Ƿ-0""  ɾ Ƿ*)/Ǭ!-$ ǐ  ʋ )*-(ǭ ǃ ǐ Ƽƻƻ Ǯ ǐ - ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ  ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ .$"( ʋ 0)$!ǭ ƻ ǐ Ƽƻ Ǯ Ǯ ǐ /ʃ Ǯ /PX UP DPNQBSF UIFTF NPEFMT VTJOH 8"*$ 3 DPEF  *(+- ǭ (ǂǏƾ ǐ (ǂǏƿ Ǯ  #6*-% 0 1 2 3 4 5 6 6 7 8 9 10 11 Terrain Ruggedness Index log GDP year 2000 Africa not Africa (ǂǏƾ ǀƾDŽǏǁ ƽǏǂ ǁƾǏƼ ƻ ƼƾǏƽ JOUFSBDUJPO EPFT XPSL )PX DBO ZPV SFDPWFS UIF DIBOHF JO TMPQF ZPV TFDUJPO :PV OFFE B QSPQFS JOUFSBDUJPO FČFDU ćF MJLFMJIPPE GPS UIF JO NBUI GPSN JT :J ∼ /PSNBM(µJ, σ) µJ = α + β3 3J + β" "J Ǯƿƽƽƽǰ " JT ,+1Ǯ#/&  BOE 3 JT /2$$"! "T ZPVWF EPOF TJODF PEFM JT CVJMU CZ SFQMBDJOH UIF QBSBNFUFS µ JO UIF UPQ MJOF UIF MJLFMJIPPE IBU JT B GVODUJPO PG EBUB BOE OFX QBSBNFUFST TVDI BT α BOE β JPOT CZ FYUFOEJOH UIJT TUSBUFHZ /PX ZPV XBOU UP BMMPX UIF SFMBUJPO UP WBSZ BT B GVODUJPO PG " 8JUIJO UIF NPEFM UIJT SFMBUJPOTIJQ JT β3  'PMMPXJOH UIF TBNF TUSBUFHZ PG SFQMBDJOH QBSBNFUFST XJUI MJOFBS IUGPSXBSE XBZ UP NBLF β3 EFQFOE VQPO " JT KVTU UP EFĕOF UIF TMPQF MG POF UIBU JODMVEFT " ćJT BQQSPBDI SFTVMUT JO UIJT MJLFMJIPPE ZPVMM
  8. 1 2 3 4 5 6 Terrain Ruggedness Index JOH

    B MJOFBS JOUFSBDUJPO EPFT XPSL )PX DBO ZPV SFDPWFS UIF DIBOHF J UBSU PG UIJT TFDUJPO :PV OFFE B QSPQFS JOUFSBDUJPO FČFDU ćF MJLFMJI KVTU QMPUUFE JO NBUI GPSN JT :J ∼ /PSNBM(µJ, σ) µJ = α + β3 3J + β" "J ),$ǯ/$!-- Ǯƿƽƽƽǰ " JT ,+1Ǯ#/&  BOE 3 JT /2$$"! "T ZPVWF IF MJOFBS NPEFM JT CVJMU CZ SFQMBDJOH UIF QBSBNFUFS µ JO UIF UPQ MJOF UIF S FRVBUJPO UIBU JT B GVODUJPO PG EBUB BOE OFX QBSBNFUFST TVDI BT α BO VJME JOUFSBDUJPOT CZ FYUFOEJOH UIJT TUSBUFHZ /PX ZPV XBOU UP BMMPX U FO : BOE 3 UP WBSZ BT B GVODUJPO PG " 8JUIJO UIF NPEFM UIJT SFM CZ UIF TMPQF β3  'PMMPXJOH UIF TBNF TUSBUFHZ PG SFQMBDJOH QBSBNFUFST Interaction • Need to allow effect of rugged to depend upon continent
  9. Interaction • Need to allow effect of rugged to depend

    upon continent old direct effect of rugged linear effect of Africa on slope OFBS FRVBUJPO UIBU JT B GVODUJPO PG EBUB BOE OFX QBSBNFUFST TVDI BT α BOE M CVJME JOUFSBDUJPOT CZ FYUFOEJOH UIJT TUSBUFHZ /PX ZPV XBOU UP BMMPX UIF XFFO : BOE 3 UP WBSZ BT B GVODUJPO PG " 8JUIJO UIF NPEFM UIJT SFMBUJP E CZ UIF TMPQF β3  'PMMPXJOH UIF TBNF TUSBUFHZ PG SFQMBDJOH QBSBNFUFST X UIF NPTU TUSBJHIUGPSXBSE XBZ UP NBLF β3 EFQFOE VQPO " JT KVTU UP EFĕOF OFBS NPEFM JUTFMG POF UIBU JODMVEFT " ćJT BQQSPBDI SFTVMUT JO UIJT MJLFMJIPP E QSJPST XIJDI XFMM BEE JO B CJU  :J ∼ /PSNBM(µJ, σ) µJ = α + γJ 3J + β" "J >OLQHDUP γJ = β3 + β"3 "J >OLQHDUPRG IF ĕSTU NPEFM XJUI UXP MJOFBS NPEFMT CVU JUT TUSVDUVSF JT UIF TBNF BT FWFSZ PVWF BMSFBEZ ĕU JO UIJT CPPL 4P ZPV EPOU OFFE UP MFBSO BOZ OFX USJDLT G EFM UP EBUB ćF USJDLT MJF FOUJSFMZ JO JOUFSQSFUJOH JU ĕSTU MJOF BCPWF JT UIF TBNF (BVTTJBO MJLFMJIPPE ZPVWF CFFO VTJOH TJODF $ POE MJOF JT UIF TBNF LJOE PG BEEJUJWF EFĕOJUJPO PG µJ UIBU ZPVWF TFFO NB E MJOF JT UIF OFX CJU ćF OFX TZNCPM γJ JT KVTU B QMBDFIPMEFS GPS UIF MJOFBS
  10. Interaction • Need to allow effect of rugged to depend

    upon continent  */5&3"$5*0/4 UTFMG POF UIBU JODMVEFT " ćJT BQQSPBDI SFTVMUT JO UIJT NPEFM ZJ ∼ /PSNBM(µJ, σ) >OLNHOLKRRG@ µJ = α + γJ SJ + β" "J >OLQHDUPRGHORI µ@ γJ = βS + β"S "J >OLQHDUPRGHORIVORSH@ M XJUI UISFF FYQSFTTJPOT CVU JUT TUSVDUVSF JT UIF TBNF BT FWFSZ (BVTT FBEZ ĕU JO UIJT CPPL 4P ZPV EPOU OFFE UP MFBSO BOZ OFX USJDLT GPS M ćF USJDLT MJF FOUJSFMZ JO JOUFSQSFUJOH JU ćF ĕSTU MJOF BCPWF JT UIF IPPE ZPVWF CFFO VTJOH TJODF $IBQUFS  ćF TFDPOE MJOF JT UIF TBNF OJUJPO PG µJ UIBU ZPVWF TFFO NBOZ UJNFT UIF OFX CJU ćF OFX TZNCPM γJ JT KVTU B QMBDFIPMEFS GPS UIF MJOFBS UIF TMPQF CFUXFFO (%1 BOE SVHHFEOFTT 8F VTF iHBNNBw γ IFSF .PEFM GBNJMZ *DŽǑǂ IBT BCPVU  PG UIF "*$DFTUJNBUFE NPEF TVQQPSU GPS JODMVEJOH UIF JOUFSBDUJPO FČFDU "OE OPUF UIBU %*$ TVMUT UP "*$D 8IZ #FDBVTF UIF QSJPST BSF ĘBU BOE UIFSFT NVD QBSBNFUFST 0WFSUIJOLJOH $POWFOUJPOBM GPSN PG JOUFSBDUJPO *OTUFBE PG B NPE NPEFM BT ZPV TBX BCPWF JUT DPOWFOUJPOBM UP NVMUJQMZ PVU BOZ JOUFSB POMZ POF MJOFBS NPEFM 'PS FYBNQMF UIF (%1 PO SVHHFEOFTT NPEFM ZJ ∼ /PSNBM(µJ, σ) µJ = α + βS SJ + β"S "J SJ + β" "J ćJT JT FRVJWBMFOU UP UIF GPSN JO UIF NBJO UFYU ćF FRVBUJPO GPS γ I UIF TFDPOE MJOF BOE FYQBOEFE ćJT FYQBOEFE GPSN BMTP XPSLT GPS FT *DŽǑǂ ʆǦ *-ǯ )&01ǯ ),$ǯ/$!-- Ǯƿƽƽƽǰ ʍ !+,/*ǯ *2 ǒ 0&$* ǰ ǒ *2 ʍ  ʀ /ǹ/2$$"! ʀ /ǹ/2$$"!ǹ ,+1Ǯ#/&  ʀ ǹ ,+1 ǰ ǒ !1ʅ!! ǒ
  11. Interaction β"S <  "GSJDBO OBUJPOT IBWF B NPSF OFHBUJWF

    TMPQF 'PS BOZ OBUJPO OPU JO "GSJDB "J =  BOE TP UIF JOUFSBDUJPO QBSBNFUFS β"S IBT OP FČFDU PO QSFEJDUJPO GPS UIBU OBUJPO 0G DPVSTF ZPV BSF HPJOH UP DPNQVUF UIF QPTUFSJPS EJTUSJCVUJPO GPS β"S GSPN UIF EBUB #VU PODF ZPV IBWF UIF QPTUFSJPS EJTUSJCVUJPO JU JT POMZ UISPVHI VOEFSTUBOEJOH XIFSF UIF QBSBNFUFS ĕUT JOUP ZPVS NPEFM UIBU XJMM BMMPX ZPV JOUFSQSFU JU 5P ĕU UIJT OFX NPEFM ZPV DBO KVTU VTF (+ BT CFGPSF )FSFT UIF DPEF UP ĕU UIF NPEFM UIBU JODMVEFT BO JOUFSBDUJPO CFUXFFO SVHHFEOFTT BOE CFJOH JO "GSJDB 3 DPEF  (ǂǏǀ ʄǤ (+ǭ '$./ǭ '*"Ǭ"+ ʋ )*-(ǭ (0 ǐ .$"( Ǯ ǐ (0 ʄǤ  ɾ "((Ƿ-0""  ɾ Ƿ*)/Ǭ!-$ ǐ  #6*-%*/( "/ */5&3"$5*0/  "(( ʄǤ - ɾ -Ƿ*)/Ǭ!-$ ǐ  ʋ )*-(ǭ ǃ ǐ Ƽƻƻ Ǯ ǐ  ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ - ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ - ʋ )*-(ǭ ƻ ǐ Ƽ Ǯ ǐ .$"( ʋ 0)$!ǭ ƻ ǐ Ƽƻ Ǯ Ǯ ǐ /ʃ Ǯ *U MPPLT KVTU BT ZPV NJHIU FYQFDU XJUI UXP MJOFBS NPEFMT OPX ćF "(( EFĕOJUJPO HFUT FWBMVBUFE BOE UIFO UIPTF WBMVFT BSF VTFE UP FWBMVBUF UIF EFĕOJUJPO PG (0 BOE ĕOBMMZ (0 HFUT VTFE UP DPNQVUF UIF MJLFMJIPPE *U BMM KVTU DBTDBEFT VQ #FGPSF NPWJOH PO UP JOUFSQSFU UIF FTUJNBUFT BOE QMPUUJOH UIF QSFEJDUJPOT MFUT VTF %*$ UP DPNQBSF UIJT OFX NPEFM UP UIF QSFWJPVT UXP 3 DPEF  *(+- ǭ (ǂǏƾ ǐ (ǂǏƿ ǐ (ǂǏǀ Ǯ TIJQ CFUXFFO : BOE 3 UP WBSZ BT B GVODUJPO PG " 8JUIJO UIF NFBTVSFE CZ UIF TMPQF β3  'PMMPXJOH UIF TBNF TUSBUFHZ PG SFQMB NPEFMT UIF NPTU TUSBJHIUGPSXBSE XBZ UP NBLF β3 EFQFOE VQPO β3 BT B MJOFBS NPEFM JUTFMG POF UIBU JODMVEFT " ćJT BQQSPBDI SFT BMTP OFFE QSJPST XIJDI XFMM BEE JO B CJU  :J ∼ /PSNBM(µJ, σ) µJ = α + γJ 3J + β" "J γJ = β3 + β"3 "J ćJT JT UIF ĕSTU NPEFM XJUI UXP MJOFBS NPEFMT CVU JUT TUSVDUVSF JT NPEFM ZPVWF BMSFBEZ ĕU JO UIJT CPPL 4P ZPV EPOU OFFE UP MFBS UIJT NPEFM UP EBUB ćF USJDLT MJF FOUJSFMZ JO JOUFSQSFUJOH JU ćF ĕSTU MJOF BCPWF JT UIF TBNF (BVTTJBO MJLFMJIPPE ZPVWF ćF TFDPOE MJOF JT UIF TBNF LJOE PG BEEJUJWF EFĕOJUJPO PG µJ UI ćF UIJSE MJOF JT UIF OFX CJU ćF OFX TZNCPM γJ JT KVTU B QMBDFIP UIBU EFĕOFT UIF TMPQF CFUXFFO (%1 BOE SVHHFEOFTT 8F VTF iH GPMMPXT iCFUBw β JO UIF (SFFL BMQIBCFU ćF FRVBUJPO GPS γJ EFĕ SVHHFEOFTT BOE "GSJDBO OBUJPOT *U JT B MJOFBS JOUFSBDUJPO FČFDU MJOFBS NPEFM
  12. FWBMVBUFE BOE UIFO UIPTF WBMVFT BSF VTFE UP FWBMVBUF UIF

    EFĕOJUJPO PG (0 BOE ĕOBMMZ (0 HFUT VTFE UP DPNQVUF UIF MJLFMJIPPE *U BMM KVTU DBTDBEFT VQ #FGPSF NPWJOH PO UP JOUFSQSFU UIF FTUJNBUFT BOE QMPUUJOH UIF QSFEJDUJPOT MFUT VTF %*$ UP DPNQBSF UIJT OFX NPEFM UP UIF QSFWJPVT UXP 3 DPEF  *(+- ǭ (ǂǏƾ ǐ (ǂǏƿ ǐ (ǂǏǀ Ǯ   +    2 $"#/   (ǂǏǀ ƿǁDŽǏǁ ǀǏƾ ƻǏƻ ƻǏDŽǂ ƼǀǏƼƾ  (ǂǏƿ ƿǂǁǏƿ ƿǏƿ ǁǏǃ ƻǏƻƾ ƼǀǏƾǀ ǁǏƽƽ (ǂǏƾ ǀƾDŽǏǂ ƽǏǃ ǂƻǏƼ ƻǏƻƻ ƼƾǏƾƼ ƼǀǏƽƽ .PEFM GBNJMZ (ǂǏǀ IBT BCPVU  PG UIF 8"*$FTUJNBUFE NPEFM XFJHIU ćBUT WFSZ TUSPOH TVQQPSU GPS JODMVEJOH UIF JOUFSBDUJPO FČFDU ćBU QSPCBCMZ JTOU TVSQSJTJOH HJWFO UIF PCWJ PVT EJČFSFODF JO TMPQF XF CFHBO UIJT TUPSZ XJUI #VU UIF NPEJDVN PG XFJHIU HJWFO UP (ǂǏƿ TVHHFTUT UIBU UIF QPTUFSJPS NFBOT GPS UIF TMPQFT JO (ǂǏǀ BSF B MJUUMF PWFSĕU "OE UIF TUBOEBSE FSSPS PG UIF EJČFSFODF JO 8"*$ CFUXFFO UIF UPQ UXP NPEFMT JT BMNPTU UIF TBNF BT UIF EJG GFSFODF JUTFMG ćFSF BSF POMZ TP NBOZ "GSJDBO DPVOUSJFT BęFS BMM TP UIF EBUB BSF TQBSTF BT GBS BT FTUJNBUJOH UIF JOUFSBDUJPO HPFT *NQPSUBOUMZ JUT OPU DMFBS XIBU JOGPSNBUJPO DSJUFSJB NFBO JO UIJT EBUB DPOUFYU 8F BSFOU TFSJPVTMZ JNBHJOJOH UIBU XF XJMM SFTBNQMF GSPN TPNF QSPDFTT UIBU DSFBUFE "GSJDBO OBUJPOT BOE OPO"GSJDBO OBUJPOT 4P EP JOGPSNBUJPO DSJUFSJB NBLF TFOTF BU BMM IFSF * UIJOL UIFZ EP CVU SFBTPOBCMF QFPQMF DBO EJTBHSFF PO UIJT QPJOU )FSFT BO BSHVNFOU GPS IPX UIFJS BEWJDF BCPVU PWFSĕUUJOH JT SFMFWBOU FWFO XIFO UIF USBJOUFTU QBSBEJHN CFIJOE JOGPSNBUJPO DSJUFSJB DBOOPU CF VOEFSTUPPE MJUFSBMMZ 'JSTU OP NBUUFS XIBU ZPV XBOU UP EP XJUI UIF FTUJNBUFT QSPEVDFE CZ B NPEFM UIF FT UJNBUFT NVTU CF PWFSĕU ćFZ NVTU CF PWFSĕU CFDBVTF OPU FWFSZ GFBUVSF PG UIF TBNQMF JT DBVTFE CZ UIF QSPDFTT PG JOUFSFTU 4P FWFO JG PVS JOUFSFTU JT FYQMBOBUJPO SBUIFS UIBO QSF EJDUJPO BOE UIFSF XJMM CF OP OFX "GSJDBO OBUJPOT UP NBLF B QSFEJDUJPO GPS PWFSĕUUJOH TUJMM m7.3 m7.4 m7.5 460 480 500 520 540 deviance WAIC
  13. Interpreting interactions • Is hard • Add interaction => other

    parameters change meaning • Influence of predictor depends upon multiple parameters and their covariation FBDI DPFďDJFOU TBZT IPX NVDI UIF BWFSBHF PVUDPNF µ DIBOHFT XIFO UIF QSFEJDUPS DIBOHFT CZ POF VOJU "OE TJODF BMM PG UIF QBSBNFUFST IBWF JOEFQFOEFOU JOĘVFODFT PO UIF PVUDPNF UIFSFT OP USPVCMF JO JOUFSQSFUJOH FBDI QBSBNFUFS TFQBSBUFMZ &BDI TMPQF QBSBNFUFS HJWFT VT B EJSFDU NFBTVSF PG FBDI QSFEJDUPS WBSJBCMFT JOĘVFODF *OUFSBDUJPO NPEFMT SVJO UIJT QBSBEJTF IPXFWFS -PPL BU UIF JOUFSBDUJPO MJLFMJIPPE BHBJO ZJ ∼ /PSNBM(µJ, σ) >OLNHOLKRRG@ µJ = α + γJ SJ + β" "J >OLQHDUPRGHORI µ@ γJ = βS + β"S "J >OLQHDUPRGHORIVORSH@ /PX UIF DIBOHF JO µJ UIBU SFTVMUT GSPN B VOJU DIBOHF JO SJ JT HJWFO CZ γJ  "OE TJODF γJ JT B GVODUJPO PG UISFF UIJOHT‰βS β"S BOE "J ‰XF IBWF UP LOPX BMM UISFF JO PSEFS UP LOPX UIF JOĘVFODF PG SJ PO UIF PVUDPNF ćF POMZ UJNF UIF TMPQF βS IBT JUT PME NFBOJOH JT XIFO "J =  XIJDI NBLFT γJ = βS  0UIFSXJTF UP DPNQVUF UIF JOĘVFODF PG SJ PO UIF PVUDPNF XF IBWF UP TJNVMUBOFPVTMZ DPOTJEFS UXP QBSBNFUFST BOE BOPUIFS QSFEJDUPS WBSJBCMF ćF QSBDUJDBM JNQMJDBUJPO PG UIJT GBDU JT UIBU ZPV DBO OP MPOHFS SFBE UIF JOĘVFODF PG FJUIFS QSFEJDUPS GSPN UIF UBCMF PG FTUJNBUFT )FSF BSF UIF QBSBNFUFS FTUJNBUFT 3 DPEF  +- $.ǭ(ǂǏǀǮ  ) / 1 ƽǏǀɳ DŽǂǏǀɳ  DŽǏƼǃ ƻǏƼƿ ǃǏDŽƽ DŽǏƿǀ - ǤƻǏƼǃ ƻǏƻǃ ǤƻǏƾƾ ǤƻǏƻƿ  ǤƼǏǃǀ ƻǏƽƽ ǤƽǏƽǂ ǤƼǏƿƽ - ƻǏƾǀ ƻǏƼƾ ƻǏƼƻ ƻǏǁƻ .$"( ƻǏDŽƾ ƻǏƻǀ ƻǏǃƾ ƼǏƻƾ 4JODF γ "(( EPFTOU BQQFBS JO UIJT UBCMF‰JU XBTOU FTUJNBUFE‰XF IBWF UP DPNQVUF JU PVSTFMWFT *UT FBTZ FOPVHI UP EP UIBU BU UIF ."1 WBMVFT QPTUFSJPS NFBOT  'PS FYBNQMF UIF ."1 TMPQF SFMBUJOH SVHHFEOFTT UP MPH(%1 XJUIJO "GSJDB JT
  14. Interpreting interactions UJPOT FBDI DPFďDJFOU TBZT IPX NVDI UIF BWFSBHF

    PVUDPNF µ UPS DIBOHFT CZ POF VOJU "OE TJODF BMM PG UIF QBSBNFUFST IB PO UIF PVUDPNF UIFSFT OP USPVCMF JO JOUFSQSFUJOH FBDI QBSBN QBSBNFUFS HJWFT VT B EJSFDU NFBTVSF PG FBDI QSFEJDUPS WBSJBCMF *OUFSBDUJPO NPEFMT SVJO UIJT QBSBEJTF IPXFWFS -PPL BU UI ZJ ∼ /PSNBM(µJ, σ) µJ = α + γJ SJ + β" "J γJ = βS + β"S "J /PX UIF DIBOHF JO µJ UIBU SFTVMUT GSPN B VOJU DIBOHF JO SJ JT H B GVODUJPO PG UISFF UIJOHT‰βS β"S BOE "J‰XF IBWF UP LOPX UIF JOĘVFODF PG SJ PO UIF PVUDPNF ćF POMZ UJNF UIF TMPQF βS I "J =  XIJDI NBLFT γJ = βS 0UIFSXJTF UP DPNQVUF UIF JOĘV XF IBWF UP TJNVMUBOFPVTMZ DPOTJEFS UXP QBSBNFUFST BOE BOPUI ćF QSBDUJDBM JNQMJDBUJPO PG UIJT GBDU JT UIBU ZPV DBO OP MP FJUIFS QSFEJDUPS GSPN UIF UBCMF PG FTUJNBUFT )FSF BSF UIF QBSBN Where’s gamma? In Africa:   */5&3"$5*0/4 EF  -/" &0ǯ*DŽǑǂǰ 01&*1" ǑǑ ƿǑǂɵ džDŽǑǂɵ  džǑƿƿ ƽǑƾǁ DžǑdžǂ džǑǁdž / ǦƽǑƿƽ ƽǑƽDž ǦƽǑǀǂ ǦƽǑƽǂ  ǦƾǑdžǂ ƽǑƿƿ ǦƿǑǀdž ǦƾǑǂƾ / ƽǑǀdž ƽǑƾǀ ƽǑƾǁ ƽǑǃǂ 0&$* ƽǑdžǀ ƽǑƽǂ ƽǑDžǀ ƾǑƽǀ 4JODF γ $** EPFTOU BQQFBS JO UIJT UBCMF‰JU XBTOU FTUJNBUFE‰XF IBWF UP DPNQVU PVSTFMWFT *UT FBTZ FOPVHI UP EP UIBU BU UIF ."1 FTUJNBUFT 'PS FYBNQMF UIF TMPQF SFMBU SVHHFEOFTT UP MPH(%1 XJUIJO "GSJDB JT γ = βS + β"S() = −. + . = . "OE PVUTJEF PG "GSJDB γ = βS + β"S() = −. 4P UIF SFMBUJPOTIJQ CFUXFFO SVHHFEOFTT BOE MPH(%1 JT FTTFOUJBMMZ SFWFSTFE JOTJEF B PVUTJEF PG "GSJDB  *ODPSQPSBUJOH VODFSUBJOUZ #VU UIBUT POMZ BU UIF ."1 FTUJNBUFT 5P HFU TP Outside Africa:   */5&3"$5*0/4 " &0ǯ*DŽǑǂǰ 01&*1" ǑǑ ƿǑǂɵ džDŽǑǂɵ džǑƿƿ ƽǑƾǁ DžǑdžǂ džǑǁdž ǦƽǑƿƽ ƽǑƽDž ǦƽǑǀǂ ǦƽǑƽǂ ǦƾǑdžǂ ƽǑƿƿ ǦƿǑǀdž ǦƾǑǂƾ / ƽǑǀdž ƽǑƾǀ ƽǑƾǁ ƽǑǃǂ $* ƽǑdžǀ ƽǑƽǂ ƽǑDžǀ ƾǑƽǀ ODF γ $** EPFTOU BQQFBS JO UIJT UBCMF‰JU XBTOU FTUJNBUFE‰XF IBWF UP DPNQVUF JU STFMWFT *UT FBTZ FOPVHI UP EP UIBU BU UIF ."1 FTUJNBUFT 'PS FYBNQMF UIF TMPQF SFMBUJOH HHFEOFTT UP MPH(%1 XJUIJO "GSJDB JT γ = βS + β"S() = −. + . = . OE PVUTJEF PG "GSJDB γ = βS + β"S() = −. UIF SFMBUJPOTIJQ CFUXFFO SVHHFEOFTT BOE MPH(%1 JT FTTFOUJBMMZ SFWFSTFE JOTJEF BOE UTJEF PG "GSJDB  *ODPSQPSBUJOH VODFSUBJOUZ #VU UIBUT POMZ BU UIF ."1 FTUJNBUFT 5P HFU TPNF GVODUJPO PG UISFF UIJOHT‰βS β"S BOE "J ‰XF IBWF UP LOPX BMM UISFF JO PSEFS UP LOPX UIF JOĘVFODF PG SJ PO UIF PVUDPNF ćF POMZ UJNF UIF TMPQF βS IBT JUT PME NFBOJOH JT XIFO "J =  XIJDI NBLFT γJ = βS  0UIFSXJTF UP DPNQVUF UIF JOĘVFODF PG SJ PO UIF PVUDPNF XF IBWF UP TJNVMUBOFPVTMZ DPOTJEFS UXP QBSBNFUFST BOE BOPUIFS QSFEJDUPS WBSJBCMF ćF QSBDUJDBM JNQMJDBUJPO PG UIJT GBDU JT UIBU ZPV DBO OP MPOHFS SFBE UIF JOĘVFODF PG FJUIFS QSFEJDUPS GSPN UIF UBCMF PG FTUJNBUFT )FSF BSF UIF QBSBNFUFS FTUJNBUFT 3 DPEF  +- $.ǭ(ǂǏǀǮ  ) / 1 ƽǏǀɳ DŽǂǏǀɳ  DŽǏƼǃ ƻǏƼƿ ǃǏDŽƽ DŽǏƿǀ - ǤƻǏƼǃ ƻǏƻǃ ǤƻǏƾƾ ǤƻǏƻƿ  ǤƼǏǃǀ ƻǏƽƽ ǤƽǏƽǂ ǤƼǏƿƽ - ƻǏƾǀ ƻǏƼƾ ƻǏƼƻ ƻǏǁƻ .$"( ƻǏDŽƾ ƻǏƻǀ ƻǏǃƾ ƼǏƻƾ 4JODF γ "(( EPFTOU BQQFBS JO UIJT UBCMF‰JU XBTOU FTUJNBUFE‰XF IBWF UP DPNQVUF JU PVSTFMWFT *UT FBTZ FOPVHI UP EP UIBU BU UIF ."1 WBMVFT QPTUFSJPS NFBOT  'PS FYBNQMF UIF ."1 TMPQF SFMBUJOH SVHHFEOFTT UP MPH(%1 XJUIJO "GSJDB JT γ = βS + β"S() = −. + . = . "OE PVUTJEF PG "GSJDB γ = βS + β"S() = −. 4P UIF SFMBUJPOTIJQ CFUXFFO SVHHFEOFTT BOE MPH(%1 JT FTTFOUJBMMZ SFWFSTFE JOTJEF BOE PVU TJEF PG "GSJDB  *ODPSQPSBUJOH VODFSUBJOUZ #VU UIBUT POMZ BU UIF ."1 WBMVFT 5P HFU TPNF JEFB PG UIF VODFSUBJOUZ BSPVOE UIPTF γ WBMVFT XFMM OFFE UP VTF UIF XIPMF QPTUFSJPS 4JODF γ
  15. Interpreting interactions • Need uncertainty as well • Sample from

    posterior • Compute posterior distribution of gamma gamma.Africa gamma.notAfrica Figure 7.5 -0.4 -0.2 0.0 0.2 0.4 0.6 0 1 2 gamma 'ĶĴłĿIJ Əƍ 1PTUFSJPS EJTUSJCVUJPOT PG UIF TMPQF SFMBUJOH UFSSBJO SVHHFEOFTT UP MPH(%1 #MVF "GSJDBO OBUJPOT #MBDL OPO"GSJDBO OBUJPOT 3 DPEF  +*./ ʄǤ 3/-/Ǐ.(+' .ǭ (ǂǏǀ Ǯ "((Ǐ!-$ ʄǤ +*./ɠ- ɾ +*./ɠ-ǷƼ "((Ǐ)*/!-$ ʄǤ +*./ɠ- ɾ +*./ɠ-Ƿƻ ćF TZNCPMT "((Ǐ!-$ BOE "((Ǐ)*/!-$ OPX IPME TBNQMFT GSPN UIF QPTUFSJPS EJTUSJCVUJPOT PG γ XJUIJO "GSJDB BOE γ PVUTJEF "GSJDB SFTQFDUJWFMZ ćF NFBOT PG UIFTF EJT USJCVUJPOT BSF KVTU MJLF UIF DBMDVMBUJPOT XF EJE BU UIF FOE PG UIF QSFWJPVT TFDUJPO 3 DPEF  ( )ǭ "((Ǐ!-$Ǯ ( )ǭ "((Ǐ)*/!-$ Ǯ ǯƼǰ ƻǏƼǁƾƼǁǀƾ ǯƼǰ ǤƻǏƼǃƽƿǀƿǂ /FBSMZ JEFOUJDBM UP UIF ."1 WBMVFT #VU OPU XF BMTP IBWF GVMM EJTUSJCVUJPOT PG UIF TMPQFT XJUIJO BOE PVUTJEF PG "GSJDB -FUT QMPU UIFN PO UIF TBNF BYJT TP XF DBO TFF UIFJS PWFSMBQ DMFBSMZ -0.4 -0.2 0.0 0.2 0.4 0.6 0 1 2 3 4 5 gamma Density
  16. Interpreting interactions gamma.Africa gamma.notAfrica Figure 7.5 -0.4 -0.2 0.0 0.2

    0.4 0.6 0 1 2 3 4 5 gamma Density difference gamma 'ĶĴłĿIJ Əƍ 1PTUFSJPS EJTUSJCVUJPOT PG UIF TMPQF SFMBUJOH UFSSBJO SVHHFEOFTT UP MPH(%1 #MVF "GSJDBO OBUJPOT #MBDL OPO"GSJDBO OBUJPOT UIF EJČFSFODF CFUXFFO UIF TMPQFT GPS FBDI TBNQMF GSPN UIF QPTUFSJPS BOE UIFO BTL XIBU QSPQPSUJPO PG UIFTF EJČFSFODFT JT CFMPX [FSP ćJT DPEF XJMM EP JU 3 DPEF  !&## ʆǦ $**Ǒ#/&  Ǧ $**Ǒ+,1#/&  02*ǯ !&## ʆ ƽ ǰ ǵ )"+$1%ǯ !&## ǰ DZƾDz ƽǑƽƽǀǃ "T BMXBZT ZPVS BOTXFS XJMM CF TMJHIUMZ EJČFSFOU EVF UP TJNVMBUJPO WBSJBODF #VU UIJT JT BMXBZT HPJOH UP CF B WFSZ TNBMM OVNCFS SFHBSEMFTT PG UIF FYBDU TBNQMFT ZPV HFU 4P DPOEJUJPOBM PO UIJT NPEFM BOE UIFTF EBUB JUT IJHIMZ JNQMBVTJCMF UIBU UIF TMPQF BTTPDJBUJPO SVHHFEOFTT XJUI MPH(%1 JT MPXFS JOTJEF "GSJDB UIBO PVUTJEF JU "MTP OPUF UIBU UIJT QSPCBCJMJUZ  JT WFSZ UJOZ DPNQBSFE UP UIF WJTVBM PWFSMBQ PG UIF UXP EJTUSJCVUJPOT JO 'ĶĴłĿIJ Əƍ ćBU JT OPU B NJTUBLF ćF EJTUSJCVUJPOT JO UIF ĕHVSF BSF NBSHJOBM MJLF TJMIPVFUUFT PG FBDI EJTUSJCVUJPO JHOPSJOH BMM PG UIF PUIFS EJNFOTJPOT JO UIF QPTUFSJPS ćF DBMDVMBUJPO BCPWF JT UIF EJTUSJCVUJPO PG UIF EJČFSFODF CFUXFFO UIF UXP ćF EJTUSJCVUJPO PG UIFJS EJČFSFODF JT OPU UIF TBNF BT UIF WJTVBM PWFSMBQ PG UIFJS NBSHJOBM EJTUSJCVUJPOT ćJT JT BMTP UIF SFBTPO XF DBOU VTF PWFSMBQ JO DPOĕEFODF JOUFSWBMT PG EJČFS FOU QBSBNFUFST BT BO JOGPSNBM UFTU PG iTJHOJĕDBODFw PG UIF EJČFSFODF *G ZPV DBSF BCPVU UIF EJČFSFODF ZPV NVTU DPNQVUF UIF EJTUSJCVUJPO PG UIF EJČFSFODF EJSFDUMZ
  17. Plotting interaction  #6*-%*/( "/ */5&3"$5*0/  0 1 2

    3 4 5 6 6 7 8 9 Terrain Ruggedness Index log GDP year 2000 African nations 0 1 2 3 4 5 7 8 9 10 11 Terrain Ruggedness Index log GDP year 2000 Non-African nations 'ĶĴłĿIJ Əƌ 1PTUFSJPS QSFEJDUJPOT GPS UIF UFSSBJO SVHHFEOFTT NPEFM JODMVE JOH UIF JOUFSBDUJPO CFUXFFO "GSJDB BOE SVHHFEOFTT Figure 7.4
  18. Tulip blooms • 27 replicate blooms across three levels of

    both water and shade blooms 1.0 2.0 3.0 0 100 300 1.0 2.0 3.0 water 0 100 300 1.0 2.0 3.0 1.0 2.0 3.0 shade
  19. Tulip blooms No interaction: water and shade have independent effects

    Interaction: water and shade have interdependent effects  $0/5*/6064 */5&3"$5*0/4  UFSBDUJPO MJLFMJIPPE JT #J ∼ /PSNBM(µJ, σ) µJ = α + β8 8J + β4 4J + β84 8J 4J F WBMVF PG ),,* PO SPX J 8J JT UIF WBMVF PG 41"/ BOE 4J JT UIF WBMVF PG BWJOH UIF DBUFHPSJDBM WBSJBCMF "! PVU PG UIJT BOBMZTJT CVU * BDUVBMMZ UIJOL B T SFRVJSFT JU BOE JO UIF QSBDUJDF QSPCMFNT BU UIF FOE PG UIF DIBQUFS XFMM DPNF "! UP UIF BOBMZTJT ćF QPJOUT * XJTI UP NBLF SJHIU OPX EPOU EFQFOE VQPO JU FSFE NPEFMT 8IJMF B DPNQMFUF NPEFM DPNQBSJTPO BOBMZTJT JT QPTTJCMF TJNQMJGZ UIF TUPSZ CZ GPDVTJOH PO KVTU UXP NPEFMT  UIF NPEFM XJUI !" CVU OP JOUFSBDUJPO BOE  UIF NPEFM XJUI CPUI NBJO FČFDUT BOE UIF / XJUI 0%!" * EP TP KVTU GPS UIF TBLF PG CSFWJUZ :PV DBO ĕU UIF NJTTJOH XJUI POMZ POF PG UIF UXP QSFEJDUPS WBSJBCMFT BOE EFNPOTUSBUF GPS ZPVSTFMG T EPOU DIBOHF U MJLFMJIPPE JT XFMM BEE QSJPST MBUFS  #J ∼ /PSNBM(µJ, σ) µJ = α + β8 8J + β4 4J
  20.   */5&3"$5*0/4  ʋ )*-(ǭ ƻ ǐ Ƽƻƻ Ǯ

    ǐ 2 ʋ )*-(ǭ ƻ ǐ Ƽƻƻ Ǯ ǐ . ʋ )*-(ǭ ƻ ǐ Ƽƻƻ Ǯ ǐ 2. ʋ )*-(ǭ ƻ ǐ Ƽƻƻ Ǯ ǐ .$"( ʋ 0)$!ǭ ƻ ǐ Ƽƻƻ Ǯ Ǯ ǐ /ʃ ǐ ( /#*ʃǙ ' -Ǥ Ǚ ǐ *)/-*'ʃ'$./ǭ(3$/ʃƼ ƿǮ Ǯ /P BOHSZ XBSOJOHT BOZNPSF 4P MFUT MPPL BU UIF FTUJNBUFT 3 DPEF  * !/ǭ(ǂǏǁǐ(ǂǏǂǮ (ǂǏǁ (ǂǏǂ  ǀƾǏƿǁ ǤǃƿǏƿǂ 2 ǂǁǏƾǁ ƼǀƼǏƼǁ . ǤƾǃǏDŽƽ ƾǀǏƼƾ .$"( ǀǂǏƿƻ ƿǁǏƽǀ 2.  ǤƾDŽǏǁǂ )*. ƽǂ ƽǂ /PX DPOTJEFS UIFTF FTUJNBUFT BOE USZ UP ĕHVSF PVU XIBU UIF NPEFMT BSF UFMMJOH VT BCPVU UIF JOĘVFODF PG XBUFS BOE TIBEF PO UIF CMPPNT 'JSTU DPOTJEFS UIF JOUFSDFQUT  α ćF FTUJNBUF Tulip blooms • Estimates gone wild! Intercept completely different Influence of shade changes direction? Interaction negative? /PX DPOTJEFS UIF TMPQF QBSBNFUFST *O UIF NBJOFČFDUPOMZ NPEFM (ǂǏǁ UIF ."1 WBMVF GPS UIF NBJO FČFDU PG 2/ - JT QPTJUJWF BOE UIF NBJO FČFDU GPS .# JT OFHBUJWF 5BLF B MPPL BU UIF TUBOEBSE EFWJBUJPOT BOE JOUFSWBMT JO +- $.ǭ(ǂǏǁǮ UP WFSJGZ UIBU CPUI QPTUFSJPS EJTUSJCVUJPOT BSF SFMJBCMZ PO POF TJEF PG [FSP :PV NJHIU JOGFS UIBU UIFTF QPTUFSJPS EJTUSJCV UJPOT TVHHFTU UIBU XBUFS JODSFBTFT CMPPNT XIJMF TIBEF SFEVDFT UIFN 'PS FWFSZ BEEJUJPOBM MFWFM PG TPJM NPJTUVSF CMPPNT JODSFBTF CZ  PO BWFSBHF 'PS FWFSZ BEEJUJPO VOJU PG TIBEF CMPPNT EFDSFBTF CZ  PO BWFSBHF ćPTF TPVOE SFBTPOBCMF #VU UIF BOBMPHPVT QPTUFSJPS EJTUSJCVUJPOT GSPN UIF JOUFSBDUJPO NPEFM (ǂǏǂ BSF RVJUF EJČFSFOU 'JSTU BTTVSF ZPVSTFMG UIBU UIF JOUFSBDUJPO NPEFM JT JOEFFE B NVDI CFUUFS NPEFM 3 DPEF  *(+- ǭ (ǂǏǁ ǐ (ǂǏǂ Ǯ   +    2 $"#/   (ǂǏǂ ƽDŽǁǏƾ ǁǏƽƽ ƻǏƻƻ ƻǏDŽDŽ ǀǏƻǀ  (ǂǏǁ ƾƻǁǏƾ ǀǏǀƼ ƼƻǏƻƼ ƻǏƻƼ ƿǏǁƿ ƾǏƻƽ ćJT DPNQBSJTPO BTTJHOT OFBSMZ BMM PG UIF XFJHIU PG FWJEFODF UP (ǂǏǂ 4P MFUT DPOTJEFS UIF QPTUFSJPS EJTUSJCVUJPO GSPN (ǂǏǂ /PX CPUI NBJO FČFDUT BSF QPTJUJWF CVU UIF OFX JOUFSBDUJPO QPTUFSJPS NFBO JT OFHBUJWF "SF ZPV UP DPODMVEF OPX UIBU UIF NBJO FČFDU PG TIBEF JT UP IFMQ m7.6 m7.7 285 290 295 300 305 310 315 deviance WAIC
  21. Plotting interaction • Slope changes with values of other predictor,

    so use more than one plot • Here, need three plots, triptych Lewis Powell (1844–1865), before his hanging for conspiracy to assassinate Abraham Lincoln.
  22. Interaction -1 0 1 0 100 200 300 water.c =

    -1 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 0 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 1 shade (centered) blooms -1 0 1 0 100 200 300 water.c = -1 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 0 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 1 shade (centered) blooms No Interaction slope varies slope constant
  23. Interaction -1 0 1 0 100 200 300 water.c =

    -1 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 0 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 1 shade (centered) blooms -1 0 1 0 100 200 300 water.c = -1 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 0 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 1 shade (centered) blooms No Interaction slope varies slope constant
  24. -1 0 1 0 100 200 300 water.c = -1

    shade (centered) blooms -1 0 1 0 100 200 300 water.c = 0 shade (centered) blooms -1 0 1 0 100 200 300 water.c = 1 shade (centered) blooms Water depends on Shade Shade depends on Water -1 0 1 0 100 200 300 shade.c = -1 water (centered) blooms -1 0 1 0 100 200 300 shade.c = 0 water (centered) blooms -1 0 1 0 100 200 300 shade.c = 1 water (centered) blooms
  25. Interactions not always linear • Suppose all tulip data collected

    under “cool” temperatures • Under “hot” temperature, tulips do not bloom • Interaction, but not a linear one • blooms goes to zero at threshold
  26. Higher order interactions • Just keep multiplying: Z J ∼

    /PSNBM(µ, σ) β →  γSJ|"J= ≈ −. + .() = . Z J ∼ /PSNBM(µJ, σ), µJ = α + β YJ + β YJ + β YJ + β YJ YJ + β YJ YJ + β YJ YJ + β YJ YJ YJ.
  27. Higher order interactions • Just keep multiplying: Z J ∼

    /PSNBM(µ, σ) β →  γSJ|"J= ≈ −. + .() = . Z J ∼ /PSNBM(µJ, σ), µJ = α + β YJ + β YJ + β YJ + β YJ YJ + β YJ YJ + β YJ YJ + β YJ YJ YJ. main effects
  28. Higher order interactions • Just keep multiplying: Z J ∼

    /PSNBM(µ, σ) β →  γSJ|"J= ≈ −. + .() = . Z J ∼ /PSNBM(µJ, σ), µJ = α + β YJ + β YJ + β YJ + β YJ YJ + β YJ YJ + β YJ YJ + β YJ YJ YJ. main effects 2-way interactions
  29. Higher order interactions • Just keep multiplying: Z J ∼

    /PSNBM(µ, σ) β →  γSJ|"J= ≈ −. + .() = . Z J ∼ /PSNBM(µJ, σ), µJ = α + β YJ + β YJ + β YJ + β YJ YJ + β YJ YJ + β YJ YJ + β YJ YJ YJ. main effects 2-way interactions 3-way interaction
  30. Higher order interactions • Dangers of high-order interactions • Hard

    to interpret: “The extent to which the effect of x1 depends upon the value of x2 depends upon the value of x3, dude.” • Hard to estimate: need lots of data, risk multicollinearity --> regularize • But you might really need them, because conditionality runs deep The Dude abides high-order interactions
  31. Higher order interactions • data(Wines2012) • Judgment of Princeton, 2012

    • New Jersey wines vs fine French wines • Outcome variable: score • Predictors: • region (NJ/FR) • nationality of judge (USA/FR-BE) • flight (red/white)
  32. Higher order interactions • Predictors: region, nationality of judge, flight

    • Consider interactions: • Interaction of region and judge is bias. Bias depends upon flight. • Interaction of judge and flight is preference. Preference depends upon region. • Interaction of region and flight is comparative advantage. Advantage depends upon judge.
  33. Interaction everywhere • Homework: data(Wines2012) • Answer the question: “What

    predicts score?” • Next week: Chapters 8, 9, start of 10 • Onward to generalized linear models (GLMs) • All predictors interact to some extent • Onward to multilevel models (GLMMs) • Massive interaction engines --> allow parameters to be conditional on group membership • Need Markov chains
  34. • mc-stan.org • Install RStan 1. Get C++ compiler 2.

    ??? 3. Profit Stanislaw Ulam (1909–1984)