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

Statistical Rethinking Fall 2017 Lecture 15

Statistical Rethinking Fall 2017 Lecture 15

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

Richard McElreath

January 05, 2018
Tweet

More Decks by Richard McElreath

Other Decks in Education

Transcript

  1. Ulysses’ Compass again • Why are varying effects (partial pooling)

    more accurate than fixed effects (no pooling)? • Grand mean: maximum underfitting • Fixed effects: maximum overfitting • Varying effects: adaptive regularization
  2.   .6-5*-&7&- .0%&-4 ćJT NPEFM ĕU QSPWJEFT FTUJNBUFT GPS

     QBSBNFUFST POF PWFSBMM TBNQMF J WBSJBODF BNPOH UBOLT σ BOE UIFO  QFSUBOL JOUFSDFQUT -FUT DIFDL 8"*$ UIF FČFDUJWF OVNCFS PG QBSBNFUFST 8FMM DPNQBSF UIF FBSMJFS NPEFM *ƾƿǑ NVMUJMFWFM NPEFM 3 DPEF  ,*-/"ǯ *ƾƿǑƾ ǒ *ƾƿǑƿ ǰ   -  !  4"&$%1  ! *ƾƿǑƿ ƾƽƾƽǑƿ ǀDžǑƽ ƽǑƽ ƾ ǀDŽǑdžǁ  *ƾƿǑƾ ƾƽƿǀǑǀ ǁdžǑǁ ƾǀǑƾ ƽ ǁǀǑƽƾ ǃǑǂǁ ćFSF BSF UXP GBDUT UP OPUF IFSF 'JSTU UIF NVMUJMFWFM NPEFM IBT POMZ  FČFD ćFSF BSF  GFXFS FČFDUJWF QBSBNFUFST UIBO BDUVBM QBSBNFUFST CFDBVTF UIF UP FBDI JOUFSDFQU TISJOLT UIFN BMM UPXBSET UIF NFBO α *O UIJT DBTF UIF QSJ TUSPOH $IFDL UIF NFBO PG 0&$* XJUI -/" &0 PS ,"# BOE ZPVMM TFF JUT BSP B ĿIJĴłĹĮĿĶŇĶĻĴ ĽĿĶļĿ MJLF ZPVWF VTFE JO QSFWJPVT DIBQUFST CVU OPX UIF :PV DBO IPXFWFS ĕU UIJ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PXO QBSBNFUFST )FSF JT UIF NVMUJMFWFM NPEFM JO NBUIFNBU TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] >ORJRG αŁĮĻĸ ∼ /PSNBM(α, σ) >YDU\ α ∼ /PSNBM(, ) >SU σ ∼ )BMG$BVDIZ(, ) >SULRUIRUVWDQGDU /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B GVODUJPO PG UXP QBSB ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF (BVTTJBO EJTUSJCVUJPO X TUBOEBSE EFWJBUJPO σ JT UIF QSJPS GPS FBDI UBOLT JOUFSDFQU #VU UIBU QSJPS JUT α BOE σ 4P UIFSF BSF UXP MFWFMT JO UIF NPEFM FBDI SFTFNCMJOH B TJNQMFS N MFWFM UIF PVUDPNF JT T UIF QBSBNFUFST BSF αŁĮĻĸ BOE UIF QSJPS JT αŁĮĻĸ ∼ *O UIF TFDPOE MFWFM UIF iPVUDPNFw WBSJBCMF JT UIF WFDUPS PG JOUFSDFQU QBSBN QBSBNFUFST BSF α BOE σ BOE UIFJS QSJPST BSF α ∼ /PSNBM(, ) BOE σ ∼ ) TFUT POF GPS FBDI UBOL 5P HFU FBDI UBOLT FYQFDUFE TV Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWF UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWF TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] αŁĮĻĸ ∼ /PSNBM(α, σ) α ∼ /PSNBM(, ) σ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF (
  4. Ulysses’ Compass again TFUT POF GPS FBDI UBOL 5P HFU

    FBDI UBOLT FYQFDUFE TVSWJWBM QSPCBCJMJUZ KVT Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P GBS OPUIJOH OFX /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWFMZ QPPMT JOGPSNBUJPO UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF UIF QSJPS GPS UIF Ǿ/ GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWFM NPEFM JO NBUIFNBU TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] >ORJRG αŁĮĻĸ ∼ /PSNBM(α, σ) >YDU\ α ∼ /PSNBM(, ) >SU σ ∼ )BMG$BVDIZ(, ) >SULRUIRUVWDQGDU /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B GVODUJPO PG UXP QBSB ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF (BVTTJBO EJTUSJCVUJPO X TUBOEBSE EFWJBUJPO σ JT UIF QSJPS GPS FBDI UBOLT JOUFSDFQU #VU UIBU QSJPS JUT α BOE σ 4P UIFSF BSF UXP MFWFMT JO UIF NPEFM FBDI SFTFNCMJOH B TJNQMFS N MFWFM UIF PVUDPNF JT T UIF QBSBNFUFST BSF αŁĮĻĸ BOE UIF QSJPS JT αŁĮĻĸ ∼ *O UIF TFDPOE MFWFM UIF iPVUDPNFw WBSJBCMF JT UIF WFDUPS PG JOUFSDFQU QBSBN QBSBNFUFST BSF α BOE σ BOE UIFJS QSJPST BSF α ∼ /PSNBM(, ) BOE σ ∼ ) TFUT POF GPS FBDI UBOL 5P HFU FBDI UBOLT FYQFDUFE TV Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWF UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWF TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] αŁĮĻĸ ∼ /PSNBM(α, σ) α ∼ /PSNBM(, ) σ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF ( 0 Complete pooling All clusters same
  5. Ulysses’ Compass again TFUT POF GPS FBDI UBOL 5P HFU

    FBDI UBOLT FYQFDUFE TVSWJWBM QSPCBCJMJUZ KVT Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P GBS OPUIJOH OFX /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWFMZ QPPMT JOGPSNBUJPO UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF UIF QSJPS GPS UIF Ǿ/ GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWFM NPEFM JO NBUIFNBU TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] >ORJRG αŁĮĻĸ ∼ /PSNBM(α, σ) >YDU\ α ∼ /PSNBM(, ) >SU σ ∼ )BMG$BVDIZ(, ) >SULRUIRUVWDQGDU /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B GVODUJPO PG UXP QBSB ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF (BVTTJBO EJTUSJCVUJPO X TUBOEBSE EFWJBUJPO σ JT UIF QSJPS GPS FBDI UBOLT JOUFSDFQU #VU UIBU QSJPS JUT α BOE σ 4P UIFSF BSF UXP MFWFMT JO UIF NPEFM FBDI SFTFNCMJOH B TJNQMFS N MFWFM UIF PVUDPNF JT T UIF QBSBNFUFST BSF αŁĮĻĸ BOE UIF QSJPS JT αŁĮĻĸ ∼ *O UIF TFDPOE MFWFM UIF iPVUDPNFw WBSJBCMF JT UIF WFDUPS PG JOUFSDFQU QBSBN QBSBNFUFST BSF α BOE σ BOE UIFJS QSJPST BSF α ∼ /PSNBM(, ) BOE σ ∼ ) TFUT POF GPS FBDI UBOL 5P HFU FBDI UBOLT FYQFDUFE TV Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWF UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWF TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] αŁĮĻĸ ∼ /PSNBM(α, σ) α ∼ /PSNBM(, ) σ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF ( 0 ∞ Complete pooling All clusters same No pooling All clusters unrelated
  6. 0.0 0.5 1.0 1.5 2.0 N = 8000 Bandwidth =

    0.03128 Ulysses’ Compass again Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P GB /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWFMZ UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF UI GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWFM N TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] αŁĮĻĸ ∼ /PSNBM(α, σ) α ∼ /PSNBM(, ) σ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B GV ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF (BV TUBOEBSE EFWJBUJPO σ JT UIF QSJPS GPS FBDI UBOLT JOUFSDFQ α BOE σ 4P UIFSF BSF UXP MFWFMT JO UIF NPEFM FBDI SFTF MFWFM UIF PVUDPNF JT T UIF QBSBNFUFST BSF αŁĮĻĸ BOE U *O UIF TFDPOE MFWFM UIF iPVUDPNFw WBSJBCMF JT UIF WFDUPS QBSBNFUFST BSF α BOE σ BOE UIFJS QSJPST BSF α ∼ /PSN TFUT POF GPS FBDI UBOL 5P HFU FBDI UBOLT FYQFDUFE TV Ǿ/)& WBMVFT BOE UIFO VTF UIF MPHJTUJD USBOTGPSN 4P /PX MFUT ĕU UIF NVMUJMFWFM NPEFM XIJDI BEBQUJWF UIBU JT SFRVJSFE UP FOBCMF BEBQUJWF QPPMJOH JT UP NBLF GVODUJPO PG JUT PXO QBSBNFUFST )FSF JT UIF NVMUJMFWF TJ ∼ #JOPNJBM(OJ, QJ) MPHJU(QJ) = αŁĮĻĸ[J] αŁĮĻĸ ∼ /PSNBM(α, σ) α ∼ /PSNBM(, ) σ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU UIF QSJPS GPS UIF αŁĮĻĸ JOUFSDFQUT JT OPX B ćJT JT XIFSF UIF iNVMUJw JO NVMUJMFWFM BSJTFT ćF ( 0 ∞ Complete pooling All clusters same No pooling All clusters unrelated prior posterior 1.5
  7. Regularizing distribution   .6-5*-&7&- .0%&-4 -3 -2 -1 0

    1 2 3 4 0.00 0.10 0.20 0.30 log-odds survive Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 probability survive Density 'ĶĴłĿIJ ƉƊƊ ćF JOGFSSFE QPQVMBUJPO PG TVSWJWBM BDSPTT UBOLT -Fę  (BVTTJBO EJTUSJCVUJPOT PG UIF MPHPEET PG TVSWJWBM TBNQMFE GSPN UIF QPTUF SJPS PG (ǎǏǡǏ 3JHIU 4VSWJWBM QSPCBCJMJUJFT GPS UIPVTBOE OFX TJNVMBUFE UBOLT BWFSBHJOH PWFS UIF QPTUFSJPS EJTUSJCVUJPO PO UIF MFę
  8. • Simulate to demonstrate accuracy advantage • 60 ponds •

    5, 10, 25, 35 tadpoles each of 15 pond n true.a s p.nopool p.partpool p.true 1 1 5 -3.089936132 1 0.2000000 0.32173203 0.04352429 2 2 5 0.267290817 5 1.0000000 0.91305884 0.56642768 3 3 5 0.896554101 4 0.8000000 0.79164823 0.71024085 4 4 5 1.934806220 5 1.0000000 0.91276066 0.87378044 5 5 5 -0.758682067 0 0.0000000 0.17692527 0.31893247 6 6 5 3.904836388 5 1.0000000 0.91337140 0.98025353 7 7 5 2.271914139 4 0.8000000 0.79349508 0.90652411 8 8 5 2.886101619 4 0.8000000 0.79557800 0.94715510 9 9 5 1.436457877 3 0.6000000 0.64219989 0.80790553 10 10 5 1.156079068 3 0.6000000 0.64414477 0.76061953 Ulysses’ Compass again
  9. Raw proportion Multilevel estimate   .6-5*-&7&- .0%&-4 0.00 0.10

    0.20 0.30 pond absolute error 1 10 20 30 40 50 60 tiny (5) small (10) medium (25) large (35) 'ĶĴłĿIJ ƉƊƋ &SSPS PG OPQPPMJOH BOE QBSUJBM QPPMJOH FTUJNBUFT GPS UIF TJN VMBUFE UBEQPMF QPOET ćF IPSJ[POUBM BYJT EJTQMBZT QPOE OVNCFS ćF WFSUJ DBM BYJT NFBTVSFT UIF BCTPMVUF FSSPS JO UIF QSFEJDUFE QSPQPSUJPO PG TVSWJWPST DPNQBSFE UP UIF USVF WBMVF VTFE JO UIF TJNVMBUJPO ćF IJHIFS UIF QPJOU
  10. Raw proportion Multilevel estimate   .6-5*-&7&- .0%&-4 0.00 0.10

    0.20 0.30 pond absolute error 1 10 20 30 40 50 60 tiny (5) small (10) medium (25) large (35) 'ĶĴłĿIJ ƉƊƋ &SSPS PG OPQPPMJOH BOE QBSUJBM QPPMJOH FTUJNBUFT GPS UIF TJN VMBUFE UBEQPMF QPOET ćF IPSJ[POUBM BYJT EJTQMBZT QPOE OVNCFS ćF WFSUJ DBM BYJT NFBTVSFT UIF BCTPMVUF FSSPS JO UIF QSFEJDUFE QSPQPSUJPO PG TVSWJWPST DPNQBSFE UP UIF USVF WBMVF VTFE JO UIF TJNVMBUJPO ćF IJHIFS UIF QPJOU avg raw error avg multilevel error
  11. Raw proportion Multilevel estimate   .6-5*-&7&- .0%&-4 0.00 0.10

    0.20 0.30 pond absolute error 1 10 20 30 40 50 60 tiny (5) small (10) medium (25) large (35) 'ĶĴłĿIJ ƉƊƋ &SSPS PG OPQPPMJOH BOE QBSUJBM QPPMJOH FTUJNBUFT GPS UIF TJN VMBUFE UBEQPMF QPOET ćF IPSJ[POUBM BYJT EJTQMBZT QPOE OVNCFS ćF WFSUJ DBM BYJT NFBTVSFT UIF BCTPMVUF FSSPS JO UIF QSFEJDUFE QSPQPSUJPO PG TVSWJWPST DPNQBSFE UP UIF USVF WBMVF VTFE JO UIF TJNVMBUJPO ćF IJHIFS UIF QPJOU
  12. Prosocial chimpanzees partner focal  #*/0.*"- 3&(3&44*0/ 'ĶĴłĿIJ ƉƈƉ $IJNQBO[FF

    QSPTPD FYQFSJNFOU BT TFFO GSPN UIF QFSTQF PG UIF GPDBM BOJNBM ćF MFę BOE MFWFST BSF JOEJDBUFE JO UIF GPSFHSP 1VMMJOH FJUIFS FYQBOET BO BDDPSEJPO WJDF JO UIF DFOUFS QVTIJOH UIF GPPE UPXBSET CPUI FOET PG UIF UBCMF #PUI USBZT DMPTF UP UIF GPDBM BOJNBM IBWF JO UIFN 0OMZ POF PG UIF GPPE USBZ UIF PUIFS TJEF DPOUBJOT GPPE ćF QBS DPOEJUJPO NFBOT BOPUIFS BOJNBM BT UVSFE TJUT PO UIF PUIFS FOE PG UIF U 0UIFSXJTF UIF PUIFS FOE XBT FNQUZ
  13. Prosocial chimpanzees • Two conditions: (1) partner, (2) alone •

    Two options: (1) prosocial, (2) asocial • Two outcomes: (1) left, (2) right • Six blocks (sessions) • Seven actors (individuals) • Want to predict outcome as function of condition and where prosocial option is • Do chimps prefer left lever when partner present and prosocial on left?  #*/0.*"- 8IFO IVNBO TUVEFOUT QBSUJDJQBUF JO BO FY UIF MFWFS MJOLFE UP UXP QJFDFT PG GPPE UIF QSP
  14. Cross-classification • Can use more than one cluster type •

    Chimpanzee experiment data • Pulls in chimpanzees • Pulls in blocks • Each chimp in each block • Not nested, but cross-classified 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 1 2 3 4 5 6 block row in data 504 400 300 200 100 1
  15. Multilevel chimpanzees JOUFSDFQUT UP UIJT NPEFM XF KVTU SFQMBDF UIF

    ĕYFE SFHVMBSJ[JOH QSJPS XJUI BO #VU UIJT UJNF *MM QVU UIF NFBO α VQ JO UIF MJOFBS NPEFM SBUIFS UIBO EPXO JO UI #FDBVTF JU XJMM QBWF UIF XBZ UP BEEJOH NPSF WBSZJOH FČFDUT MBUFS :PVMM TFF X QVTIFE GPSXBSE B MJUUMF )FSF JT UIF NVMUJMFWFM DIJNQBO[FFT NPEFM JO NBUIFNBUJDBM GPSN XJUI UIF DFQU DPNQPOFOUT IJHIMJHIUFE JO CMVF -J ∼ #JOPNJBM(, QJ) MPHJU(QJ) = α + αĮİŁļĿ[J] + (β1 + β1$ $J)1J αĮİŁļĿ ∼ /PSNBM(, σĮİŁļĿ) α ∼ /PSNBM(, ) β1 ∼ /PSNBM(, ) β1$ ∼ /PSNBM(, ) σĮİŁļĿ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU α JT JOTJEF UIF MJOFBS NPEFM OPU JOTJEF UIF (BVTTJBO QSJPS GPS α NBUIFNBUJDBMMZ FRVJWBMFOU UP XIBU ZPV EJE XJUI UIF UBEQPMFT FBSMJFS JO UIF DI BMXBZT UBLF UIF NFBO PVU PG B (BVTTJBO EJTUSJCVUJPO BOE USFBU UIF EJTUSJCVUJP QMVT B (BVTTJBO EJTUSJCVUJPO DFOUFSFE PO [FSP ćJT NJHIU TFFN B MJUUMF XFJS NJHIU IFMQ USBJO ZPVS JOUVJUJPO CZ FYQFSJNFOUJOH JO 3 ćFTF UXP MJOFT PG DPE varying intercepts on actor Mean alpha in linear model now. Is equivalent.
  16. Multilevel chimpanzees  .VMUJMFWFM DIJNQBO[FFT -FUT QSPDFFE CZ UBLJOH UIF

    GVMM DI $IBQUFS  (ǎǍǡǑ QBHF  BOE ĕSTU BEEJOH WBSZJOH JOUFSDFQUT PO JOUFSDFQUT UP UIJT NPEFM XF KVTU SFQMBDF UIF ĕYFE SFHVMBSJ[JOH QSJPS #VU UIJT UJNF *MM QVU UIF NFBO α VQ JO UIF MJOFBS NPEFM SBUIFS UIBO E #FDBVTF JU XJMM QBWF UIF XBZ UP BEEJOH NPSF WBSZJOH FČFDUT MBUFS :P QVTIFE GPSXBSE B MJUUMF )FSF JT UIF NVMUJMFWFM DIJNQBO[FFT NPEFM JO NBUIFNBUJDBM GPSN DFQU DPNQPOFOUT IJHIMJHIUFE JO CMVF -J ∼ #JOPNJBM(, QJ) MPHJU(QJ) = α + αĮİŁļĿ[J] + (β1 + β1$ $J)1J αĮİŁļĿ ∼ /PSNBM(, σĮİŁļĿ) α ∼ /PSNBM(, ) β1 ∼ /PSNBM(, ) β1$ ∼ /PSNBM(, ) σĮİŁļĿ ∼ )BMG$BVDIZ(, ) /PUJDF UIBU α JT JOTJEF UIF MJOFBS NPEFM OPU JOTJEF UIF (BVTTJBO Q NBUIFNBUJDBMMZ FRVJWBMFOU UP XIBU ZPV EJE XJUI UIF UBEQPMFT FBSMJFS BMXBZT UBLF UIF NFBO PVU PG B (BVTTJBO EJTUSJCVUJPO BOE USFBU UIF EJ QMVT B (BVTTJBO EJTUSJCVUJPO DFOUFSFE PO [FSP ćJT NJHIU TFFN B M NJHIU IFMQ USBJO ZPVS JOUVJUJPO CZ FYQFSJNFOUJOH JO 3 ćFTF UXP MJO EPN WBMVFT GSPN UXP JEFOUJDBM (BVTTJBO EJTUSJCVUJPOT XJUI NFBO   3 DPEF  4ǎ ʚǶ -)*-(ǿ ǎ Ǒ Ǣ ǎǍ Ǣ ǎ Ȁ 4Ǐ ʚǶ ǎǍ ʔ -)*-(ǿ ǎ Ǒ Ǣ Ǎ Ǣ ǎ Ȁ m12.4 <- map2stan( alist( pulled_left ~ dbinom( 1 , p ) , logit(p) <- a + a_actor[actor] + (bp + bpC*condition)*prosoc_left , a_actor[actor] ~ dnorm( 0 , sigma_actor ), a ~ dnorm(0,10), bp ~ dnorm(0,10), bpC ~ dnorm(0,10), sigma_actor ~ dcauchy(0,1) ) , data=d )
  17. Cross-classified chimpanzees varying intercepts on actor varying intercepts on block

    joint mean  5XP UZQFT PG DMVTUFS 5P BEE UIF TFDPOE DMVTUFS UZQF '*& X UIF TUSVDUVSF GPS UIF /*- DMVTUFS ćJT NFBOT UIF MJOFBS NPEFM HFUT ZF JOUFSDFQU αįĹļİĸ[J]  )FSF JT UIF NBUIFNBUJDBM GPSN PG UIF NPEFM XJUI UIF NBDIJOF IJHIMJHIUFE JO CMVF -J ∼ #JOPNJBM(, QJ) MPHJU(QJ) = α + αĮİŁļĿ[J] + αįĹļİĸ[J] + (β1 + β1$ $J)1J αĮİŁļĿ ∼ /PSNBM(, σĮİŁļĿ) αįĹļİĸ ∼ /PSNBM(, σįĹļİĸ) α ∼ /PSNBM(, ) β1 ∼ /PSNBM(, ) β1$ ∼ /PSNBM(, ) σĮİŁļĿ ∼ )BMG$BVDIZ(, ) σįĹļİĸ ∼ )BMG$BVDIZ(, ) Just one “alpha” for both cluster types. Otherwise unidentified parameters.
  18. Cross-classified chimpanzees (ǎǏǡǑ ʚǶ - .(+' ǿ (ǎǏǡǑ Ǣ *-

    .ʙǐ Ǣ #$).ʙǑ Ǣ 2-(0+ʙǎǍǍǍ (P BIFBE BOEJOTQFDU UIFUSBDF QMPU +'*/ǿ(ǎǏǡǑȀ BOEUIFQPTUFSJPS E *UT JNQPSUBOU UP OPUJDF OPX UIBU UIF Ǿ/*- QBSBNFUFST BSF EF BOZ HJWFO SPX J UIF UPUBM JOUFSDFQU JT α + αĮİŁļĿ[J]  ćF QBSU UIBU WBS UIF EFWJBUJPO GSPN UIF HSBOE NFBO α  5XP UZQFT PG DMVTUFS 5P BEE UIF TFDPOE DMVTUFS UZQF '* UIF TUSVDUVSF GPS UIF /*- DMVTUFS ćJT NFBOT UIF MJOFBS NPEFM HF JOUFSDFQU αįĹļİĸ[J]  )FSF JT UIF NBUIFNBUJDBM GPSN PG UIF NPEFM XJUI NBDIJOF IJHIMJHIUFE JO CMVF -J ∼ #JOPNJBM(, QJ) MPHJU(QJ) = α + αĮİŁļĿ[J] + αįĹļİĸ[J] + (β1 + β1$ $ αĮİŁļĿ ∼ /PSNBM(, σĮİŁļĿ) αįĹļİĸ ∼ /PSNBM(, σįĹļİĸ) α ∼ /PSNBM(, ) β1 ∼ /PSNBM(, ) β1$ ∼ /PSNBM(, ) σĮİŁļĿ ∼ )BMG$BVDIZ(, ) σįĹļİĸ ∼ )BMG$BVDIZ(, ) m12.5 <- map2stan( alist( pulled_left ~ dbinom( 1 , p ), logit(p) <- a + a_actor[actor] + a_block[block_num] + (bp + bpc*condition)*prosoc_left, a_actor[actor] ~ dnorm( 0 , sigma_actor ), a_block[block_num] ~ dnorm( 0 , sigma_block ), c(a,bp,bpc) ~ dnorm(0,10), sigma_actor ~ dcauchy(0,1), sigma_block ~ dcauchy(0,1) ) , data=d )
  19. Cross-classified chimpanzees (ǎǏǡǑ ʚǶ - .(+' ǿ (ǎǏǡǑ Ǣ *-

    .ʙǐ Ǣ #$).ʙǑ Ǣ 2-(0+ʙǎǍǍǍ (P BIFBE BOEJOTQFDU UIFUSBDF QMPU +'*/ǿ(ǎǏǡǑȀ BOEUIFQPTUFSJPS E *UT JNQPSUBOU UP OPUJDF OPX UIBU UIF Ǿ/*- QBSBNFUFST BSF EF BOZ HJWFO SPX J UIF UPUBM JOUFSDFQU JT α + αĮİŁļĿ[J]  ćF QBSU UIBU WBS UIF EFWJBUJPO GSPN UIF HSBOE NFBO α  5XP UZQFT PG DMVTUFS 5P BEE UIF TFDPOE DMVTUFS UZQF '* UIF TUSVDUVSF GPS UIF /*- DMVTUFS ćJT NFBOT UIF MJOFBS NPEFM HF JOUFSDFQU αįĹļİĸ[J]  )FSF JT UIF NBUIFNBUJDBM GPSN PG UIF NPEFM XJUI NBDIJOF IJHIMJHIUFE JO CMVF -J ∼ #JOPNJBM(, QJ) MPHJU(QJ) = α + αĮİŁļĿ[J] + αįĹļİĸ[J] + (β1 + β1$ $ αĮİŁļĿ ∼ /PSNBM(, σĮİŁļĿ) αįĹļİĸ ∼ /PSNBM(, σįĹļİĸ) α ∼ /PSNBM(, ) β1 ∼ /PSNBM(, ) β1$ ∼ /PSNBM(, ) σĮİŁļĿ ∼ )BMG$BVDIZ(, ) σįĹļİĸ ∼ )BMG$BVDIZ(, ) m12.5 <- map2stan( alist( pulled_left ~ dbinom( 1 , p ), logit(p) <- a + a_actor[actor] + a_block[block_num] + (bp + bpc*condition)*prosoc_left, a_actor[actor] ~ dnorm( 0 , sigma_actor ), a_block[block_num] ~ dnorm( 0 , sigma_block ), c(a,bp,bpc) ~ dnorm(0,10), sigma_actor ~ dcauchy(0,1), sigma_block ~ dcauchy(0,1) ) , data=d )
  20. Cross-classified chimpanzees • Lots of variation among actors • Little

    variation among blocks • a_actor’s vary a lot • a_block’s vary hardly at all 0 1 2 3 4 5 6 7 0.0 1.0 2.0 3.0 sigma value Density blocks actors   .6-5*- sigma_block sigma_actor bpc bp a a_block[6] a_block[5] a_block[4] a_block[3] a_block[2] a_block[1] a_actor[7] a_actor[6] a_actor[5] a_actor[4] a_actor[3] a_actor[2] a_actor[1] -2 0 2 4 6 Value
  21. Cross-classified chimpanzees • Incorporating block: no anticipated benefits; little cost

    Vary Parameters Effective parameters WAIC weight actor, block 18 11 533 0.35 actor 11 8 532 0.65 ćF +- $. QMPU JT TIPXO JO UIF MFęIBOE QBSU PG 'ĶĴłĿIJ ƉƊƌ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MPDLT :PV DBO FBTJMZ TFF UIJT WBSJBUJPO JO UIF WBSZJOH JOUFSDFQU FTUJNBUFT UIF Ǿ/*- EJTUSJCVUJPOT BSF NVDI NPSF TDBUUFSFE UIBO BSF UIF Ǿ'*& EJTUSJCVUJPOT "T B DPOTFRVFODF BEEJOH '*& UP UIJT NPEFM IBTOU BEEFE B MPU PG PWFSĕUUJOH SJTL -FUT DPNQBSF UIF NPEFM XJUI POMZ WBSZJOH JOUFSDFQUT PO /*- UP UIF NPEFM XJUI CPUI LJOET PG WBSZJOH JOUFSDFQUT 3 DPEF  *(+- ǿ(ǎǏǡǑǢ(ǎǏǡǒȀ   +    2 $"#/   (ǎǏǡǑ ǒǐǎǡǒ Ǖǡǎ ǍǡǍ ǍǡǓǒ ǎǖǡǒǍ  (ǎǏǡǒ ǒǐǏǡǔ ǎǍǡǒ ǎǡǏ Ǎǡǐǒ ǎǖǡǔǑ ǎǡǖǑ -PPL BU UIF +  DPMVNO XIJDI SFQPSUT UIF iFČFDUJWF OVNCFS PG QBSBNFUFSTw 8IJMF (ǎǏǡǒ
  22. Posterior predictions • Predictions more subtle: Same clusters or new

    clusters? • Same clusters: proceed as usual • New clusters: should average over distribution of varying effects • In this case: • Same clusters: Predictions for these chimpanzees • New clusters: Prediction for a new chimpanzee or rather for population of chimpanzees
  23. Same clusters, new clusters • Same actors: • Really same

    as before: varying effects are just parameters; you know the model; push samples back through the model • link() and sim() obey this rule • New actors (counterfactual): • which actor (cluster) to use for counterfactual predictions? • average actor • marginal of actor • show sample of actors from posterior
  24. Average actor • “average actor” means actor with population average

    intercept, “alpha” • Strategy: • replace varying intercept samples with zeros => all actors have average intercept now • compute predictions as usual BWFSBHF BDUPS #Z iBWFSBHF w * NFBO BO JOEJWJEVBM DIJNQBO[FF XJUI BO JOUFSDFQU FYBDUMZ BU  α UIF QPQVMBUJPO NFBO ćJT TJNVMUBOFPVTMZ JNQMJFT B WBSZJOH JOUFSDFQU PG [FSP 4JODF UIFSF JT VODFSUBJOUZ BCPVU UIF QPQVMBUJPO NFBO UIFSF JT TUJMM VODFSUBJOUZ BCPVU UIJT BWFSBHF JOEJWJEVBMT JOUFSDFQU #VU BT ZPVMM TFF UIF VODFSUBJOUZ JT NVDI TNBMMFS UIBO JU SFBMMZ TIPVME CF JG XF XJTI UP IPOFTUMZ SFQSFTFOU UIF QSPCMFN PG XIBU UP FYQFDU GSPN B OFX JOEJWJEVBM ćF ĕSTU TUFQ JT UP NBLF B OFX EBUB MJTU UP DPNQVUF QSFEJDUJPOT PWFS :PVWF EPOF UIJT JO QSFWJPVT DIBQUFST )FSF JT PVS OFX MJTU SFQSFTFOUJOH UIF GPVS EJČFSFOU USFBUNFOUT 3 DPEF  ǡ+-  ʚǶ '$./ǿ +-*.*Ǿ' !/ ʙ ǿǍǢǎǢǍǢǎȀǢ ȕ -$"#/ȅ' !/ȅ-$"#/ȅ' !/ *)$/$*) ʙ ǿǍǢǍǢǎǢǎȀǢ ȕ *)/-*'ȅ*)/-*'ȅ+-/) -ȅ+-/) - /*- ʙ - +ǿǏǢǑȀ ȕ +' #*' - Ȁ /FYU XFSF HPJOH UP NBLF B NBUSJY PG [FSPT UP SFQMBDF UIF WBSZJOH JOUFSDFQU TBNQMFT XJUI *UT FBTJFTU UP KVTU LFFQ UIF TBNF EJNFOTJPO BT UIF PSJHJOBM NBUSJY *O UIJT DBTF UIBU NFBOT VTJOH  TBNQMFT GPS FBDI PG  BDUPST #VU BMM PG UIF TBNQMFT XJMM CF TFU UP [FSP 3 DPEF  ȕ - +' 1-4$)" $)/ - +/ .(+' . 2$/# 5 -*. ȕ ǎǍǍǍ .(+' . 4 ǔ /*-. Ǿ/*-Ǿ5 -*. ʚǶ (/-$3ǿǍǢǎǍǍǍǢǔȀ ćBUT UIF POMZ OFX USJDL /PX XF KVTU QBTT UIJT OFX NBUSJY UP '$)& VTJOH UIF PQUJPOBM - +' BSHVNFOU .BLF TVSF UIF OFX NBUSJY JT OBNFE UIF TBNF BT UIF WBSZ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Ǖ Ȁ +'*/ǿ Ǎ Ǣ Ǎ Ǣ /4+ ʙǫ)ǫ Ǣ 3'ʙǫ+-*.*Ǿ' !/ȅ*)$/$*)ǫ Ǣ 4'ʙǫ+-*+*-/$*) +0''  ' !/ǫ Ǣ 4'$(ʙǿǍǢǎȀ Ǣ 33/ʙǫ)ǫ Ǣ 3'$(ʙǿǎǢǑȀ Ȁ 3$.ǿ ǎ Ǣ /ʙǎǣǑ Ǣ ' '.ʙǿǫǍȅǍǫǢǫǎȅǍǫǢǫǍȅǎǫǢǫǎȅǎǫȀ Ȁ  .6-5*-&7&- 1045&3*03 13&%*$5*0/4  0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 average actor 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 marginal of actor 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 50 simulated actors
  26. Marginal of actor • “Marginal of” means “averaging over variation

    in actors” => shows variation arising from variation across actors • Strategy: • Extract samples for sigma_actor • Simulate new varying intercepts • Use simulated intercepts to simulate predictions VMU JT EJTQMBZFE JO 'ĶĴłĿIJ ƉƊƍ PO UIF MFę ćF HSBZ SFHJPO TIPXT UIF  JOUF S XJUI BO BWFSBHF JOUFSDFQU ćJT LJOE PG DBMDVMBUJPO NBLFT JU FBTZ UP TFF UIF .*Ǿ' !/ BT XFMM BT VODFSUBJOUZ BCPVU XIFSF UIF BWFSBHF JT CVU JU EPFTOU TI O BNPOH BDUPST TIPX UIF WBSJBUJPO BNPOH BDUPST XFMM OFFE UP VTF .$"(Ǿ/*- JO UIF DBMD BHBJO TNVHHMF UIJT JOUP '$)& CZ VTJOH UIF - +' BSHVNFOU ćJT UJNF I NVMBUF B NBUSJY PG OFX WBSZJOH JOUFSDFQUT GSPN B (BVTTJBO EJTUSJCVUJPO EFĕOFE F QSJPS JO UIF NPEFM JUTF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UP UIF BWFSBHF JHOPSJOH WBSJBUJPO BNPOH BDUPST "U UIJT QPJOU TUVEFOUT VTVBMMZ BTL i4P XIJDI POF TIPVME * VTF w ćF BOTXFS JT i*U EF QFOETw #PUI BSF VTFGVM EFQFOEJOH VQPO UIF RVFTUJPO ćF QSFEJDUJPOT GPS BO BWFSBHF BDUPS IFMQ UP WJTVBMJ[F UIF JNQBDU PG USFBUNFOU ćF QSFEJDUJPOT UIBU BSF NBSHJOBM PG BDUPS JMMVT USBUF IPX WBSJBCMF EJČFSFOU DIJNQBO[FFT BSF BDDPSEJOH UP UIF NPEFM :PV QSPCBCMZ XBOU UP DPNQVUF CPUI GPS ZPVSTFMG XIFO USZJOH UP VOEFSTUBOE B NPEFM #VU XIJDI ZPV JODMVEF JO B SFQPSU XJMM EFQFOE VQPO DPOUFYU *O UIJT DBTF XF DBO EP CFUUFS CZ NBLJOH B QMPU UIBU EJTQMBZT CPUI UIF USFBUNFOU FČFDU BOE UIF WBSJBUJPO BNPOH BDUPST 8F DBO EP UIJT CZ GPSHFUUJOH BCPVU JOUFSWBMT BOE JOTUFBE TJNV MBUJOH B TFSJFT PG OFX BDUPST JO FBDI PG UIF GPVS USFBUNFOUT #Z ESBXJOH B MJOF GPS FBDI BDUPS BDSPTT BMM GPVS USFBUNFOUT XFMM CF BCMF UP WJTVBMJ[F CPUI UIF [JH[BH JNQBDU PG +-*.*Ǿ' !/ BT XFMM BT UIF WBSJBUJPO BNPOH JOEJWJEVBMT 8IBU XFMM EP OPX JT XSJUF B OFX GVODUJPO UIBU TJNVMBUFT B OFX BDUPS GSPN UIF FTUJNBUFE  .6-5*-&7&- 1045&3*03 13&%*$5*0/4  0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 average actor 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 marginal of actor 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 50 simulated actors
  28. 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left

    0/0 1/0 0/1 1/1 average actor 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 marginal of actor 0.0 0.2 0.4 0.6 0.8 1.0 prosoc_left/condition proportion pulled left 0/0 1/0 0/1 1/1 50 simulated actors 'ĶĴłĿIJ ƉƊƍ 1PTUFSJPS QSFEJDUJWF EJTUSJCVUJPOT GPS UIF DIJNQBO[FFT WBSZ JOH JOUFSDFQU NPEFM (ǎǏǡǑ ćF TPMJE MJOFT BSF QPTUFSJPS NFBOT BOE UIF TIBEFE SFHJPOT BSF  QFSDFOUJMF JOUFSWBMT -Fę 4FUUJOH UIF WBSZJOH JO UFSDFQU Ǿ/*- UP [FSP QSPEVDFT QSFEJDUJPOT GPS BO BWFSBHF BDUPS ćFTF QSFEJDUJPOT JHOPSF VODFSUBJOUZ BSJTJOH GSPN WBSJBUJPO BNPOH BDUPST .JE EMF 4JNVMBUJOH WBSZJOH JOUFSDFQUT VTJOH UIF QPTUFSJPS TUBOEBSE EFWJBUJPO
  29. Multilevel overdispersion • Overdispersion: Count data with residual variation greater

    than expectation • Implies unmodeled heterogeneity across cases • Can estimate that heterogeneity with varying intercepts on each case • Estimate varying intercept for each observation in the data Human photoreceptors, up close
  30. Multilevel islands • Recall Oceanic tools model  .6-5*-&7&- 1045&3*03

    13&%*$5*0/4 UIF NPEFM 5J ∼ 1PJTTPO(µJ) MPH(µJ) = α + αĶŀĹĮĻı[J] + β1 MPH 1J α ∼ /PSNBM(, ) β1 ∼ /PSNBM(, ) αĶŀĹĮĻı ∼ /PSNBM(, σĶŀĹĮĻı) σĶŀĹĮĻı ∼ )BMG$BVDIZ(, ) 5 JT /*/'Ǿ/**'. 1 JT +*+0'/$*) BOE J JOEFYFT FBDI JTMBOE JOUFSDFQU NPEFM CVU XJUI B WBSZJOH JOUFSDFQU GPS FWFSZ PCTFSWBUJP VQ CFJOH BO FTUJNBUF PG UIF PWFSEJTQFSTJPO BNPOH JTMBOET "OP UIBU UIF WBSZJOH JOUFSDFQUT αĶŀĹĮĻı BSF SFTJEVBMT GPS FBDI JTMBOE # USJCVUJPO PG UIFTF SFTJEVBMT XF HFU BO FTUJNBUF PG UIF FYDFTT WBSJBU Distribution of island intercepts informs amount of excess variation culture population contact total_tools mean_TU 1 Malekula 1100 low 13 3.2 2 Tikopia 1500 low 22 4.7 3 Santa Cruz 3600 low 24 4.0 4 Yap 4791 high 43 5.0 5 Lau Fiji 7400 high 33 5.0 6 Trobriand 8000 high 19 4.0 7 Chuuk 9200 high 40 3.8 8 Manus 13000 low 28 6.6 9 Tonga 17500 high 55 5.4 10 Hawaii 275000 low 71 6.6
  31. 7 8 9 10 11 12 20 30 40 50

    60 70 log population total tools 'ĶĴłĿIJ ƉƊƎ 1PTUFSJPS QSFEJDUJPOT GPS UIF PWFSEJTQFSTFE 1PJT NPEFM (ǎǏǡǓ ćF TIBEFE SFHJPOT BSF JOTJEF UP PVU   JOUFSWBMT PG UIF FYQFDUFE NFBO .BSHJOBMJ[JOH PWFS UIF WBSZJOH SFTVMUT JO B NVDI XJEFS QSFEJDUJPO SFHJPO UIBO XFE FYQFDU VO 1PJTTPO QSPDFTT 50% 80% 95% 7 8 9 10 11 12 20 30 40 50 60 70 log population total tools No varying intercepts (no overdispersion) Varying intercepts (overdispersion) WAIC pWAIC dWAIC weight SE dSE m12.6 70.0 4.9 0.0 1 2.65 NA m10.12 84.4 3.8 14.5 0 8.94 7.29 m10.12 m12.6 60 65 70 75 80 85 90 deviance WAIC
  32. Homework • Frogs & contraception: 12M1, 12M2, 12H1 • Next

    week: Chapter 13 — varying slopes and other wonders