Richard McElreath
February 22, 2019
1.8k

# L18 Statistical Rethinking Winter 2019

Lecture 18 of the Dec 2018 through March 2019 edition of Statistical Rethinking. Covers Chapter 14, varying slopes and other covariance models.

## Richard McElreath

February 22, 2019

## Transcript

/ Week 9
2. ### Non-centered random chimps m14.3 <- ulam( alist( L ~ binomial(1,p),

logit(p) <- g[tid] + alpha[actor,tid] + beta[block_id,tid], # adaptive priors - non-centered transpars> matrix[actor,4]:alpha <- compose_noncentered( sigma_actor , L_Rho_actor , z_actor ), transpars> matrix[block_id,4]:beta <- compose_noncentered( sigma_block , L_Rho_block , z_block ), matrix[4,actor]:z_actor ~ normal( 0 , 1 ), matrix[4,block_id]:z_block ~ normal( 0 , 1 ), # fixed priors g[tid] ~ normal(0,1), vector[4]:sigma_actor ~ dexp(1), cholesky_factor_corr[4]:L_Rho_actor ~ lkj_corr_cholesky( 2 ), vector[4]:sigma_block ~ dexp(1), cholesky_factor_corr[4]:L_Rho_block ~ lkj_corr_cholesky( 2 ) ) , data=dat , chains=4 , cores=4 , log_lik=TRUE )
3. ### Non-centered random chimps m14.3 <- ulam( alist( L ~ binomial(1,p),

logit(p) <- g[tid] + alpha[actor,tid] + beta[block_id,tid], # adaptive priors - non-centered transpars> matrix[actor,4]:alpha <- compose_noncentered( sigma_actor , L_Rho_actor , z_actor ), transpars> matrix[block_id,4]:beta <- compose_noncentered( sigma_block , L_Rho_block , z_block ), matrix[4,actor]:z_actor ~ normal( 0 , 1 ), matrix[4,block_id]:z_block ~ normal( 0 , 1 ), # fixed priors g[tid] ~ normal(0,1), vector[4]:sigma_actor ~ dexp(1), cholesky_factor_corr[4]:L_Rho_actor ~ lkj_corr_cholesky( 2 ), vector[4]:sigma_block ~ dexp(1), cholesky_factor_corr[4]:L_Rho_block ~ lkj_corr_cholesky( 2 ) ) , data=dat , chains=4 , cores=4 , log_lik=TRUE )
4. ### Non-centered random chimps m14.3 <- ulam( alist( L ~ binomial(1,p),

logit(p) <- g[tid] + alpha[actor,tid] + beta[block_id,tid], # adaptive priors - non-centered transpars> matrix[actor,4]:alpha <- compose_noncentered( sigma_actor , L_Rho_actor , z_actor ), transpars> matrix[block_id,4]:beta <- compose_noncentered( sigma_block , L_Rho_block , z_block ), matrix[4,actor]:z_actor ~ normal( 0 , 1 ), matrix[4,block_id]:z_block ~ normal( 0 , 1 ), # fixed priors g[tid] ~ normal(0,1), vector[4]:sigma_actor ~ dexp(1), cholesky_factor_corr[4]:L_Rho_actor ~ lkj_corr_cholesky( 2 ), vector[4]:sigma_block ~ dexp(1), cholesky_factor_corr[4]:L_Rho_block ~ lkj_corr_cholesky( 2 ) ) , data=dat , chains=4 , cores=4 , log_lik=TRUE )
5. ### Non-centered random chimps   "%7&/563&4 */ \$07"3*"/\$& 200 400

600 800 1000 1200 1000 1500 2000 centered (default) non-centered (cholesky) 'ĶĴłĿĲ ƉƌƎ %JTUS TBNQMFT )Ǿ !! G OPODFOUFSFE QBSBNF DMBTTJĕFE WBSZJOH TMP (ǎǑǡǐ SFTQFDUJWFMZ FRVJWBMFOU JOGFSFODFT WFSTJPO TBNQMFT NVDI number of effective parameters
6. ### Random chimpanzees  "%7"/\$&% 7"3:*/( 4-01&4  8F DBO JOTQFDU

UIF TUBOEBSE EFWJBUJPO QBSBNFUFST UP HFU B TFOTF PG IPX BHHSFTTJWFMZ UIF WBSZJOH FČFDUT BSF CFJOH SFHVMBSJ[FE 3 DPEF  +- \$.ǿ (ǎǑǡǐ Ǣ  +/#ʙǏ Ǣ +-.ʙǿǫ.\$"(Ǿ/*-ǫǢǫ.\$"(Ǿ'*&ǫȀ Ȁ ( ) . ǒǡǒʉ ǖǑǡǒʉ )Ǿ !! #/ .\$"(Ǿ/*-ȁǎȂ ǎǡǐǖ ǍǡǑǖ ǍǡǕǍ ǏǡǏǑ ǖǍǓ ǎ .\$"(Ǿ/*-ȁǏȂ ǍǡǖǏ ǍǡǐǕ ǍǡǑǑ ǎǡǓǑ ǎǍǓǍ ǎ .\$"(Ǿ/*-ȁǐ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 ǍǡǑǑ ǎǡǓǑ ǎǍǓǍ ǎ .\$"(Ǿ/*-ȁǐȂ ǎǡǕǓ Ǎǡǒǔ ǎǡǎǑ ǏǡǕǖ ǎǎǖǎ ǎ .\$"(Ǿ/*-ȁǑȂ ǎǡǒǖ ǍǡǓǓ ǍǡǕǓ ǏǡǕǎ ǎǎǑǕ ǎ .\$"(Ǿ'*&ȁǎȂ ǍǡǑǍ ǍǡǐǏ ǍǡǍǐ ǍǡǖǕ ǎǍǐǐ ǎ .\$"(Ǿ'*&ȁǏȂ ǍǡǑǑ ǍǡǐǓ ǍǡǍǑ ǎǡǎǍ ǖǑǑ ǎ .\$"(Ǿ'*&ȁǐȂ ǍǡǐǍ ǍǡǏǔ ǍǡǍǏ Ǎǡǔǖ ǎǓǍǓ ǎ
9. ### Multilevel horoscopes • Think about the causal model first •

Begin with “empty” model with varying intercepts on relevant clusters • Standardize predictors • Use regularizing priors (simulate) • Add in predictors and vary their slopes • Can drop varying effects with tiny sigmas • Consider two sorts of posterior prediction • Same units: What happened in these data? • New units: What might we expect for new units? • Your knowledge of domain trumps all
10. ### Adventures in covariance • Many possibilities arise from using multi-variate

Gaussian distributions • Models of unobserved confounds: Instrumental variables, Mendelian randomization • Models of social relations, networks • Factor analysis (item-response theory) • “Animal model” — heritability of phenotype • Phylogenetic regressions • Spatial autocorrelation
11. ### Instrumental variables • Imagine trying to estimate influence of education

on wages — lots of unmeasured confounds.  "%7&/563&4 */ \$07"3*"/\$& E Q U W F JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS BS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF QFPQMF CPSO FBSMJFS JO UIF E UP HFU MFTT TDIPPMJOH ćJT JT CPUI CFDBVTF UIFZ BSF CJPMPHJDBMMZ PMEFS XIFO UIFZ PPM BOE CFDBVTF UIFZ CFDPNF FMJHJCMF UP ESPQ PVU PG TDIPPM FBSMJFS *O EBUB GSPN
12. ### Instrumental variables • Instrument: A variable that influences exposure (E)

but not outcome (W) • Here: Birthday position in year (Q). People born earlier in year consume less education. • Start school later (biologically) • Eligible to quit school earlier (biologically)  "%7&/563&4 */ \$07"3*"/\$& E Q U W UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS
13. ### Instrumental variables • Instrument: A variable that influences exposure (E)

but not outcome (W) • How could this help us? • Gives us information about U • E and W correlated, due to U • Q helps us measure that correlation  "%7&/563&4 */ \$07"3*"/\$& E Q U W UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS
14. ### Instrumental variables • Example: • People born in 1st quarter

(Q1) of year consume 10 years of education on average • A specific person born in Q1 consumed 12 years • Gives us information about unmeasured U  "%7&/563&4 */ \$07"3*"/\$& E Q U W UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS
15. ### Instrumental variables • Another perspective: • Q is a “natural

experiment” • Q assigns E, as if by experimenter giving education pills • But individuals are uncooperative and don’t always take their pills => imperfect randomization • Many (most?) real “experiments” are actually like this, have intent to treat   "%7&/563&4 */ \$07"3*"/\$& E Q U W
16. ### Simulated instrument M GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE

CZ RVBSUFS PG CJSUI 2UIJT BOE UIF TBNF VOPCTFSWFE DPOGPVOE 6 ćF UIJSE NPEFM JT GPS 2 PG CFJOH CPSO JO UIF ĕSTU RVBSUFS PG UIF ZFBS ćF NPEFM KVTU TBZT QFPQMF BSF CPSO JO UIF ĕSTU RVBSUFS ćF GPVSUI NPEFM TBZT UIBU UIF T OPSNBMMZ EJTUSJCVUFE XJUI NFBO [FSP BOE TUBOEBSE EFWJBUJPO POF BUJDBM GPSN 8J ∼ /PSNBM(µń,J, σń) [Wage model] µń,J = αń + βĲń &J + 6J &J ∼ /PSNBM(µĲ,J, σĲ) [Education model] µĲ,J = αĲ + βľĲ 2J + 6J 2J ∼ #FSOPVMMJ(.) [Birth model] 6J ∼ /PSNBM(, ) [Confound model] E PO B SFBM TUVEZ  CVU MFUT TJNVMBUF UIF EBUB CPUI UP LFFQ JU TJNQMF JHIU BOTXFS JT 3FNFNCFS 8JUI SFBM EBUB ZPV OFWFS LOPX XIBU UIF XIZ TUVEZJOH TJNVMBUFE FYBNQMFT JT TP JNQPSUBOU CPUI GPS WFSJGZJOH E Q U W #VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT PG UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF Q ZFBS UFOE UP HFU MFTT TDIPPMJOH ćJT JT CPUI CFDBVTF UIFZ BSF CJPMP TUBSU TDIPPM BOE CFDBVTF UIFZ CFDPNF FMJHJCMF UP ESPQ PVU PG TDIP UIF 6OJUFE 4UBUFT BU MFBTU UIPTF CPSO FBSMJFS JO UIF ZFBS EP JOEFFE PG TDIPPM JO UIFJS MJGFUJNFT /PX JG JU JT USVF UIBU 2 POMZ EJSFDUMZ J UIFO 2 JT POF PG UIFTF NZTUFSJPVT JOTUSVNFOUBM WBSJBCMFT *U UVSOT CFDBVTF JU JT B DPMMJEFS XIFO XF MFBSO 2 XF BMTP HFU TPNF JOGPSNB JOGPSNBUJPO BCPVU 6 JT HPPE FOPVHI XF DBO UIFO HFU B HPPE JOGFS & → 8 "DUVBMMZ XF EPOU FWFO OFFE UIF 6 WBMVFT UIFNTFMWFTXF DPSSFMBUFE & BOE 8 FOE VQ BT B SFTVMU PG UIF 6 WBMVFT 4P IPX EPFT BMM PG UIJT BDUVBMMZ XPSL TUBUJTUJDBMMZ ćF HPPE O UP XSJUF EPXO UIF HFOFSBUJWF NPEFM JNQMJFE GPS FYBNQMF CZ UIF %" UIBU NPEFM BT PVS TUBUJTUJDBM NPEFM #BZFT EPFT UIF SFTU ćF CBE O EJTUSJCVUJPO GPS TVDI B NPEFM JT IBSEFS UP BQQSPYJNBUF #VU XF DBO UJNF )FSF JT B TJNQMF HFOFSBUJWF WFSTJPO PG UIF %"( BCPWF *U SFBMMZ IB UIFSF JT NPEFM GPS IPX XBHFT 8 BSF DBVTFE CZ FEVDBUJPO & BOE UIF V 4FDPOE UIFSF JT B NPEFM GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE CZ R
17. ### Simulated instrument M GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE

CZ RVBSUFS PG CJSUI 2UIJT BOE UIF TBNF VOPCTFSWFE DPOGPVOE 6 ćF UIJSE NPEFM JT GPS 2 PG CFJOH CPSO JO UIF ĕSTU RVBSUFS PG UIF ZFBS ćF NPEFM KVTU TBZT QFPQMF BSF CPSO JO UIF ĕSTU RVBSUFS ćF GPVSUI NPEFM TBZT UIBU UIF T OPSNBMMZ EJTUSJCVUFE XJUI NFBO [FSP BOE TUBOEBSE EFWJBUJPO POF BUJDBM GPSN 8J ∼ /PSNBM(µń,J, σń) [Wage model] µń,J = αń + βĲń &J + 6J &J ∼ /PSNBM(µĲ,J, σĲ) [Education model] µĲ,J = αĲ + βľĲ 2J + 6J 2J ∼ #FSOPVMMJ(.) [Birth model] 6J ∼ /PSNBM(, ) [Confound model] E PO B SFBM TUVEZ  CVU MFUT TJNVMBUF UIF EBUB CPUI UP LFFQ JU TJNQMF JHIU BOTXFS JT 3FNFNCFS 8JUI SFBM EBUB ZPV OFWFS LOPX XIBU UIF XIZ TUVEZJOH TJNVMBUFE FYBNQMFT JT TP JNQPSUBOU CPUI GPS WFSJGZJOH E Q U W #VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT PG UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF Q ZFBS UFOE UP HFU MFTT TDIPPMJOH ćJT JT CPUI CFDBVTF UIFZ BSF CJPMP TUBSU TDIPPM BOE CFDBVTF UIFZ CFDPNF FMJHJCMF UP ESPQ PVU PG TDIP UIF 6OJUFE 4UBUFT BU MFBTU UIPTF CPSO FBSMJFS JO UIF ZFBS EP JOEFFE PG TDIPPM JO UIFJS MJGFUJNFT /PX JG JU JT USVF UIBU 2 POMZ EJSFDUMZ J UIFO 2 JT POF PG UIFTF NZTUFSJPVT JOTUSVNFOUBM WBSJBCMFT *U UVSOT CFDBVTF JU JT B DPMMJEFS XIFO XF MFBSO 2 XF BMTP HFU TPNF JOGPSNB JOGPSNBUJPO BCPVU 6 JT HPPE FOPVHI XF DBO UIFO HFU B HPPE JOGFS & → 8 "DUVBMMZ XF EPOU FWFO OFFE UIF 6 WBMVFT UIFNTFMWFTXF DPSSFMBUFE & BOE 8 FOE VQ BT B SFTVMU PG UIF 6 WBMVFT 4P IPX EPFT BMM PG UIJT BDUVBMMZ XPSL TUBUJTUJDBMMZ ćF HPPE O UP XSJUF EPXO UIF HFOFSBUJWF NPEFM JNQMJFE GPS FYBNQMF CZ UIF %" UIBU NPEFM BT PVS TUBUJTUJDBM NPEFM #BZFT EPFT UIF SFTU ćF CBE O EJTUSJCVUJPO GPS TVDI B NPEFM JT IBSEFS UP BQQSPYJNBUF #VU XF DBO UJNF )FSF JT B TJNQMF HFOFSBUJWF WFSTJPO PG UIF %"( BCPWF *U SFBMMZ IB UIFSF JT NPEFM GPS IPX XBHFT 8 BSF DBVTFE CZ FEVDBUJPO & BOE UIF V 4FDPOE UIFSF JT B NPEFM GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE CZ R
18. ### Simulated instrument M GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE

CZ RVBSUFS PG CJSUI 2UIJT BOE UIF TBNF VOPCTFSWFE DPOGPVOE 6 ćF UIJSE NPEFM JT GPS 2 PG CFJOH CPSO JO UIF ĕSTU RVBSUFS PG UIF ZFBS ćF NPEFM KVTU TBZT QFPQMF BSF CPSO JO UIF ĕSTU RVBSUFS ćF GPVSUI NPEFM TBZT UIBU UIF T OPSNBMMZ EJTUSJCVUFE XJUI NFBO [FSP BOE TUBOEBSE EFWJBUJPO POF BUJDBM GPSN 8J ∼ /PSNBM(µń,J, σń) [Wage model] µń,J = αń + βĲń &J + 6J &J ∼ /PSNBM(µĲ,J, σĲ) [Education model] µĲ,J = αĲ + βľĲ 2J + 6J 2J ∼ #FSOPVMMJ(.) [Birth model] 6J ∼ /PSNBM(, ) [Confound model] E PO B SFBM TUVEZ  CVU MFUT TJNVMBUF UIF EBUB CPUI UP LFFQ JU TJNQMF JHIU BOTXFS JT 3FNFNCFS 8JUI SFBM EBUB ZPV OFWFS LOPX XIBU UIF XIZ TUVEZJOH TJNVMBUFE FYBNQMFT JT TP JNQPSUBOU CPUI GPS WFSJGZJOH E Q U W #VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT PG UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF Q ZFBS UFOE UP HFU MFTT TDIPPMJOH ćJT JT CPUI CFDBVTF UIFZ BSF CJPMP TUBSU TDIPPM BOE CFDBVTF UIFZ CFDPNF FMJHJCMF UP ESPQ PVU PG TDIP UIF 6OJUFE 4UBUFT BU MFBTU UIPTF CPSO FBSMJFS JO UIF ZFBS EP JOEFFE PG TDIPPM JO UIFJS MJGFUJNFT /PX JG JU JT USVF UIBU 2 POMZ EJSFDUMZ J UIFO 2 JT POF PG UIFTF NZTUFSJPVT JOTUSVNFOUBM WBSJBCMFT *U UVSOT CFDBVTF JU JT B DPMMJEFS XIFO XF MFBSO 2 XF BMTP HFU TPNF JOGPSNB JOGPSNBUJPO BCPVU 6 JT HPPE FOPVHI XF DBO UIFO HFU B HPPE JOGFS & → 8 "DUVBMMZ XF EPOU FWFO OFFE UIF 6 WBMVFT UIFNTFMWFTXF DPSSFMBUFE & BOE 8 FOE VQ BT B SFTVMU PG UIF 6 WBMVFT 4P IPX EPFT BMM PG UIJT BDUVBMMZ XPSL TUBUJTUJDBMMZ ćF HPPE O UP XSJUF EPXO UIF HFOFSBUJWF NPEFM JNQMJFE GPS FYBNQMF CZ UIF %" UIBU NPEFM BT PVS TUBUJTUJDBM NPEFM #BZFT EPFT UIF SFTU ćF CBE O EJTUSJCVUJPO GPS TVDI B NPEFM JT IBSEFS UP BQQSPYJNBUF #VU XF DBO UJNF )FSF JT B TJNQMF HFOFSBUJWF WFSTJPO PG UIF %"( BCPWF *U SFBMMZ IB UIFSF JT NPEFM GPS IPX XBHFT 8 BSF DBVTFE CZ FEVDBUJPO & BOE UIF V 4FDPOE UIFSF JT B NPEFM GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE CZ R
19. ### Simulated instrument M GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE

CZ RVBSUFS PG CJSUI 2UIJT BOE UIF TBNF VOPCTFSWFE DPOGPVOE 6 ćF UIJSE NPEFM JT GPS 2 PG CFJOH CPSO JO UIF ĕSTU RVBSUFS PG UIF ZFBS ćF NPEFM KVTU TBZT QFPQMF BSF CPSO JO UIF ĕSTU RVBSUFS ćF GPVSUI NPEFM TBZT UIBU UIF T OPSNBMMZ EJTUSJCVUFE XJUI NFBO [FSP BOE TUBOEBSE EFWJBUJPO POF BUJDBM GPSN 8J ∼ /PSNBM(µń,J, σń) [Wage model] µń,J = αń + βĲń &J + 6J &J ∼ /PSNBM(µĲ,J, σĲ) [Education model] µĲ,J = αĲ + βľĲ 2J + 6J 2J ∼ #FSOPVMMJ(.) [Birth model] 6J ∼ /PSNBM(, ) [Confound model] E PO B SFBM TUVEZ  CVU MFUT TJNVMBUF UIF EBUB CPUI UP LFFQ JU TJNQMF JHIU BOTXFS JT 3FNFNCFS 8JUI SFBM EBUB ZPV OFWFS LOPX XIBU UIF XIZ TUVEZJOH TJNVMBUFE FYBNQMFT JT TP JNQPSUBOU CPUI GPS WFSJGZJOH E Q U W #VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT PG UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF Q ZFBS UFOE UP HFU MFTT TDIPPMJOH ćJT JT CPUI CFDBVTF UIFZ BSF CJPMP TUBSU TDIPPM BOE CFDBVTF UIFZ CFDPNF FMJHJCMF UP ESPQ PVU PG TDIP UIF 6OJUFE 4UBUFT BU MFBTU UIPTF CPSO FBSMJFS JO UIF ZFBS EP JOEFFE PG TDIPPM JO UIFJS MJGFUJNFT /PX JG JU JT USVF UIBU 2 POMZ EJSFDUMZ J UIFO 2 JT POF PG UIFTF NZTUFSJPVT JOTUSVNFOUBM WBSJBCMFT *U UVSOT CFDBVTF JU JT B DPMMJEFS XIFO XF MFBSO 2 XF BMTP HFU TPNF JOGPSNB JOGPSNBUJPO BCPVU 6 JT HPPE FOPVHI XF DBO UIFO HFU B HPPE JOGFS & → 8 "DUVBMMZ XF EPOU FWFO OFFE UIF 6 WBMVFT UIFNTFMWFTXF DPSSFMBUFE & BOE 8 FOE VQ BT B SFTVMU PG UIF 6 WBMVFT 4P IPX EPFT BMM PG UIJT BDUVBMMZ XPSL TUBUJTUJDBMMZ ćF HPPE O UP XSJUF EPXO UIF HFOFSBUJWF NPEFM JNQMJFE GPS FYBNQMF CZ UIF %" UIBU NPEFM BT PVS TUBUJTUJDBM NPEFM #BZFT EPFT UIF SFTU ćF CBE O EJTUSJCVUJPO GPS TVDI B NPEFM JT IBSEFS UP BQQSPYJNBUF #VU XF DBO UJNF )FSF JT B TJNQMF HFOFSBUJWF WFSTJPO PG UIF %"( BCPWF *U SFBMMZ IB UIFSF JT NPEFM GPS IPX XBHFT 8 BSF DBVTFE CZ FEVDBUJPO & BOE UIF V 4FDPOE UIFSF JT B NPEFM GPS IPX FEVDBUJPO MFWFMT & BSF DBVTFE CZ R
20. ### Simulated instrument set.seed(73) N <- 500 U_sim <- rnorm( N

) Q_sim <- sample( 1:4 , size=N , replace=TRUE ) E_sim <- rnorm( N , U_sim + Q_sim ) W_sim <- rnorm( N , U_sim + 0*E_sim ) dat_sim <- list( W=standardize(W_sim) , E=standardize(E_sim) , Q=standardize(Q_sim) ) E Q U W #VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT PG UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF Q ZFBS UFOE UP HFU MFTT TDIPPMJOH ćJT JT CPUI CFDBVTF UIFZ BSF CJPMP TUBSU TDIPPM BOE CFDBVTF UIFZ CFDPNF FMJHJCMF UP ESPQ PVU PG TDIP UIF 6OJUFE 4UBUFT BU MFBTU UIPTF CPSO FBSMJFS JO UIF ZFBS EP JOEFFE PG TDIPPM JO UIFJS MJGFUJNFT /PX JG JU JT USVF UIBU 2 POMZ EJSFDUMZ J UIFO 2 JT POF PG UIFTF NZTUFSJPVT JOTUSVNFOUBM WBSJBCMFT *U UVSOT CFDBVTF JU JT B DPMMJEFS XIFO XF MFBSO 2 XF BMTP HFU TPNF JOGPSNB JOGPSNBUJPO BCPVU 6 JT HPPE FOPVHI XF DBO UIFO HFU B HPPE JOGFS & → 8 "DUVBMMZ XF EPOU FWFO OFFE UIF 6 WBMVFT UIFNTFMWFTXF DPSSFMBUFE & BOE 8 FOE VQ BT B SFTVMU PG UIF 6 WBMVFT 4P IPX EPFT BMM PG UIJT BDUVBMMZ XPSL TUBUJTUJDBMMZ ćF HPPE O UP XSJUF EPXO UIF HFOFSBUJWF NPEFM JNQMJFE GPS FYBNQMF CZ UIF %" UIBU NPEFM BT PVS TUBUJTUJDBM NPEFM #BZFT EPFT UIF SFTU ćF CBE O EJTUSJCVUJPO GPS TVDI B NPEFM JT IBSEFS UP BQQSPYJNBUF #VU XF DBO UJNF )FSF JT B TJNQMF HFOFSBUJWF WFSTJPO PG UIF %"( BCPWF *U SFBMMZ IB UIFSF JT NPEFM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Ǖ Ǎǡǖǔ ǎǖǖǖ ǎ ćJT JT KVTU BO PSEJOBSZ DPOGPVOE XIFSF UIF VONFBTVSFE 6 JT SVJOJOH PVS JOGFSFODF *G ZPV IBWF JODFOUJWFT UP CFMJFWF UIBU FEVDBUJPO FOIBODFT XBHFT ZPV NJHIU SFQPSU UIJT JOGFSFODF BT
22. ### Instrumentality • Think of pairs of (W,E) values as sampled

from a common distribution with some covariance structure: IBWF JODFOUJWFT UP CFMJFWF UIBU FEVDBUJPO FOIBODFT XBHFT ZPV NJHIU SFQ JT #VU OP POF TIPVME CFMJFWF JU 5P NBLF VTF PG UIF JOTUSVNFOU 2 UIF NPEFM XF XBOU JOTUFBE JT UIF BCPWF UIF NBUIFNBUJDBM POF 0G DPVSTF XF EPOU IBWF UIF DPOGPVOE WBMV MBUFE UIFN CVU VTJOH UIFN OPX UP EFDPOGPVOE UIF JOGFSFODF XPVME CF D QPJOU JT UIBU XF VTVBMMZ FYQFDU TPNF VONFBTVSFE DPOGPVOE MJLF 6 4P NPEFM PG UIJT ćF FČFDU PG 6 JT UP DSFBUF DPWBSJBUJPO CFUXFFO UIF PCTFSW *G XF DBO NFBTVSF UIJT DPWBSJBUJPO JU XJMM CF MJLF DPOEJUJPOJOH PO 6 " HJWFT VT B XBZ UP HFU JOGPSNBUJPO BCPVU UIBU DPWBSJBUJPO 4P UIF USJDL JT UP XSJUF UIF NPEFM OPX MJLF UIJT 8J &J ∼ .7/PSNBM µń,J µĲ,J , 4 [Joint w µń,J = αń + βĲń &J µĲ,J = αĲ + βľĲ 2J
23. ### Instrumentality QPJOU JT UIBU XF VTVBMMZ FYQFDU TPNF VONFBTVSFE DPOGPVOE

MJLF 6 4P NPEFM PG UIJT ćF FČFDU PG 6 JT UP DSFBUF DPWBSJBUJPO CFUXFFO UIF PCTFSW *G XF DBO NFBTVSF UIJT DPWBSJBUJPO JU XJMM CF MJLF DPOEJUJPOJOH PO 6 " HJWFT VT B XBZ UP HFU JOGPSNBUJPO BCPVU UIBU DPWBSJBUJPO 4P UIF USJDL JT UP XSJUF UIF NPEFM OPX MJLF UIJT 8J &J ∼ .7/PSNBM µń,J µĲ,J , 4 [Joint w µń,J = αń + βĲń &J µĲ,J = αĲ + βľĲ 2J   "%7&/563&4 */ \$07"3*"/\$& E Q U W VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS G UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF QFPQMF CPSO FBSMJFS JO UIF
24. ### Instrumentality QPJOU JT UIBU XF VTVBMMZ FYQFDU TPNF VONFBTVSFE DPOGPVOE

MJLF 6 4P NPEFM PG UIJT ćF FČFDU PG 6 JT UP DSFBUF DPWBSJBUJPO CFUXFFO UIF PCTFSW *G XF DBO NFBTVSF UIJT DPWBSJBUJPO JU XJMM CF MJLF DPOEJUJPOJOH PO 6 " HJWFT VT B XBZ UP HFU JOGPSNBUJPO BCPVU UIBU DPWBSJBUJPO 4P UIF USJDL JT UP XSJUF UIF NPEFM OPX MJLF UIJT 8J &J ∼ .7/PSNBM µń,J µĲ,J , 4 [Joint w µń,J = αń + βĲń &J µĲ,J = αĲ + βľĲ 2J   "%7&/563&4 */ \$07"3*"/\$& E Q U W VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS G UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF QFPQMF CPSO FBSMJFS JO UIF
25. ### Instrumentality QPJOU JT UIBU XF VTVBMMZ FYQFDU TPNF VONFBTVSFE DPOGPVOE

MJLF 6 4P NPEFM PG UIJT ćF FČFDU PG 6 JT UP DSFBUF DPWBSJBUJPO CFUXFFO UIF PCTFSW *G XF DBO NFBTVSF UIJT DPWBSJBUJPO JU XJMM CF MJLF DPOEJUJPOJOH PO 6 " HJWFT VT B XBZ UP HFU JOGPSNBUJPO BCPVU UIBU DPWBSJBUJPO 4P UIF USJDL JT UP XSJUF UIF NPEFM OPX MJLF UIJT 8J &J ∼ .7/PSNBM µń,J µĲ,J , 4 [Joint w µń,J = αń + βĲń &J µĲ,J = αĲ + βľĲ 2J   "%7&/563&4 */ \$07"3*"/\$& E Q U W VU UIFSF JT BMTP BO JOTUSVNFOU 2 JOEJDBUJOH XIFUIFS B QFSTPO XBT CPSO JO UIF ĕSTU RVBSUFS G UIF ZFBS 8IZ NJHIU UIJT DBVTBMMZ JOĘVFODF FEVDBUJPO #FDBVTF QFPQMF CPSO FBSMJFS JO UIF
26. ### ćF NBUSJY 4 JO UIF ĕSTU MJOF JT UIF FSSPS

DPWBSJBODF CFUXFFO XBHFT BOE FEVDBUJPO *UT OPU UIF EFTDSJQUJWF DPWBSJBODF CFUXFFO UIFTF WBSJBCMFT CVU SBUIFS UIF NBUSJY FRVJWBMFOU PG UIF UZQJDBM σ XF TUJDL JO B (BVTTJBO SFHSFTTJPO ćF BCPWF JT B USVF ĺłĹŁĶŃĮĿĶĮŁĲ ĹĶĻĲĮĿ ĺļıĲĹ B SFHSFTTJPO XJUI NVMUJQMF TJNVMUBOFPVT PVUDPNFT BMM NPEFMFE XJUI B KPJOU FSSPS TUSVDUVSF &BDI WBSJBCMF HFUT JUT PXO MJOFBS NPEFM ZJFMEJOH UIF UXP µ EFĕOJUJPOT *U NJHIU CPUIFS ZPV UP TFF FEVDBUJPO & BT CPUI BO PVUDPNF BOE B QSFEJDUPS JOTJEF UIF NFBO GPS 8 #VU UIJT TUBUJTUJDBM SFMBUJPOTIJQ JT BO JNQMJDBUJPO PG UIF %"( ćFSF JT OPUIJOH JMMFHBM BCPVU JU "MM JU TBZT JT UIBU & NJHIU JOĘVFODF 8 BOE UIBU BMTP QBJST PG 8, & WBMVFT NJHIU IBWF B DPSSFMBUJPO ćBU DPSSFMBUJPO BSJTFT QSFTVNJOH UIF %"( UISPVHI UIF V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E MJOFBS SFHSFTTJPO )FSFT UIF 0'( DPEF 3 DPEF  (ǎǑǡǒ ʚǶ 0'(ǿ '\$./ǿ ǿǢȀ ʡ (0'/\$Ǿ)*-('ǿ ǿ(0Ǣ(0Ȁ Ǣ #* Ǣ \$"( ȀǢ (0 ʚǶ  ʔ ȉǢ (0 ʚǶ  ʔ ȉǢ ǿǢȀ ʡ )*-('ǿ Ǎ Ǣ ǍǡǏ ȀǢ ǿǢȀ ʡ )*-('ǿ Ǎ Ǣ Ǎǡǒ ȀǢ #* ʡ '&%Ǿ*--ǿ Ǐ ȀǢ \$"( ʡ 3+*) )/\$'ǿ ǎ Ȁ ȀǢ /ʙ/Ǿ.\$( Ǣ #\$).ʙǑ Ǣ *- .ʙǑ Ȁ +- \$.ǿ (ǎǑǡǒ Ǣ  +/#ʙǐ Ȁ ( ) . ǒǡǒʉ ǖǑǡǒʉ )Ǿ !! #/  ǍǡǍǍ ǍǡǍǐ ǶǍǡǍǒ ǍǡǍǒ ǎǎǒǕ ǎ  ǍǡǍǍ ǍǡǍǑ ǶǍǡǍǔ ǍǡǍǔ ǎǑǍǍ ǎ  ǍǡǓǐ ǍǡǍǐ ǍǡǒǕ ǍǡǓǖ ǎǒǒǔ ǎ  ǶǍǡǍǐ ǍǡǍǔ ǶǍǡǎǑ ǍǡǍǕ ǎǍǎǍ ǎ #*ȁǎǢǎȂ ǎǡǍǍ ǍǡǍǍ ǎǡǍǍ ǎǡǍǍ   #*ȁǎǢǏȂ Ǎǡǒǐ ǍǡǍǒ ǍǡǑǒ ǍǡǓǍ ǖǕǔ ǎ #*ȁǏǢǎȂ Ǎǡǒǐ ǍǡǍǒ ǍǡǑǒ ǍǡǓǍ ǖǕǔ ǎ #*ȁǏǢǏȂ ǎǡǍǍ ǍǡǍǍ ǎǡǍǍ ǎǡǍǍ ǎǔǎǑ ǎ \$"(ȁǎȂ ǎǡǍǎ ǍǡǍǑ Ǎǡǖǒ ǎǡǍǕ ǎǍǏǕ ǎ \$"(ȁǏȂ Ǎǡǔǔ ǍǡǍǐ Ǎǡǔǐ ǍǡǕǎ ǎǑǔǕ ǎ ćFSF JT B MPU HPJOH PO IFSF #VU XF DBO UBLF JU POF QJFDF BU B UJNF 'JSTU MPPL BU  UIF FTUJNBUFE JOĘVFODF PG FEVDBUJPO PO XBHFT *U JT TNBMM BOE TUSBEEMFT CPUI TJEFT PG [FSP ćBU
28. ### Other doors • In principle, many idiosyncratic ways to de-

confound inference, if you analyze the graph correctly (“do-calculus”) • Another well-known tool: Front-door criterion TFF FH %0* %0*4    -JLF WF UP VTF JU SFTQPOTJCMZ 4PNFUJNFT QFPQMF NJTUBLF UIF QSPDFEVSF PG 4-4 NFOUBM WBSJBCMFT ćFZ BSF OPU UIF TBNF UIJOH "OZ NPEFM DBO CF FTUJNBUFE ČFSFOU QSPDFEVSFT FBDI XJUI JUT PXO CFOFĕUT BOE DPTUT 4-4 JT WFSZ MJNJUJOH #BZFTJBO FTUJNBUJPO UFDIOJRVFT FYJTU JU JT FBTJFS UP ĕU JOTUSVNFOUBM WBSJBCMF ZQF PG PVUDPNF ćF NBKPS JTTVF UIBU XJMM BMXBZT SFNBJO OP NBUUFS IPX ZPV JPS JT UIBU JU JT WFSZ IBSE UP CF TVSF UIF JOTUSVNFOUBM WBSJBCMF JT BOZ HPPE SJUFSJPO *OTUSVNFOUBM WBSJBCMFT BSF B XBZ UP HP CFZPOE UIF CBDLEPPS F DBVTBM JOGFSFODF #VU UIFZ BSF OPU BMPOF "OPUIFS FYBNQMF GPS EF F B NFEJBUPS WBSJBCMF BOE UIF ĳĿļĻŁıļļĿ İĿĶŁĲĿĶļĻ \$POTJEFS UIJT U X Y Z TU 9 JOĘVFODFT B NFEJBUPS ; XIJDI JOĘVFODFT UIF PVUDPNF PG JOUFSFTU : PVOEFE CZ UIF VOPCTFSWFE 6 ćFSF JT B CBDLEPPS GSPN 9 UP : UISPVHI U1 U2 X Y Z1 Z2
29. ### Social Relations Models • Context: Dyadic interactions between units •

Common in social sciences, animal behavior • How to separate general behavior from specific dyadic relationships? • Social Relations Models (SRM) one approach — require custom covariance structure • Really just a custom varying effects model
30. ### Nicaragua households • data(KosterLeckie) • 25 households • 300 dyads

> combn(1:25,2) • Gift correlation 0.24  40\$*"- 3&-"5*0/4 "4 \$0 0 20 40 60 80 100 0 20 40 60 80 100 gifts household A to household B gifts B to A
31. ### Nicaragua households • Outcome: Count of gifts from A –>

B • Lots of predictors, but we’ll ignore those for now • Instead use varying effects to measure structure ęT CVU JU NJHIU SFDFJWF NBOZ *O PSEFS UP TUBUJTUJDBMMZ TFQBSBUF CBMBODFE FY OFSBMJ[FE EJČFSFODFT JO HJWJOH BOE SFDFJWJOH XF OFFE B NPEFM UIBU USFBUT U  ćF UZQF PG NPEFM XFMM DPOTJEFS JT PęFO DBMMFE B ŀļİĶĮĹ ĿĲĹĮŁĶļĻŀ ĺļ DJĕDBMMZ XFMM NPEFM HJęT GSPN IPVTFIPME " UP IPVTFIPME # BT B DPNCJOBUJPO UT TQFDJĕD UP UIF IPVTFIPME BOE UIF EZBE ćF PVUDPNF WBSJBCMFT UIF HJę DPV WBSJBCMFTUIFZ BSF DPVOUT XJUI OP PCWJPVT VQQFS CPVOE 8FMM BUUBDI PVS P UIFTF DPVOUT XJUI B MPH MJOL BT JO UIF QSFWJPVT DIBQUFST ćJT HJWFT VT UIF ĕ PEFM Z"→# ∼ 1PJTTPO(λ"#) MPH λ"# = α + H" + S# + E"# BS NPEFM IBT BO JOUFSDFQU α UIBU SFQSFTFOU UIF BWFSBHF HJęJOH SBUF PO UIF MP M EZBET ćF PUIFS FČFDUT XJMM CF PČTFUT GSPN UIJT BWFSBHF ćFO H" JT B WBSZJO FS GPS UIF HFOFSBMJ[FE HJWJOH UFOEFODZ PG IPVTFIPME " SFHBSEMFTT PG EZBE ć HFOFSBMJ[FE SFDFJWJOH PG IPVTFIPME # SFHBSEMFTT PG EZBE 'JOBMMZ UIF FČFD ETQFDJĕD SBUF UIBU " HJWFT UP # ćFSF JT B DPSSFTQPOEJOH MJOFBS NPEFM GPS UI average giving giving offset for A receiving offset for A dyad offset A–>B
32. ### Nicaragua households FDJĕD UP UIF IPVTFIPME BOE UIF EZBE ćF

PVUDPNF WBSJBCMFT UIF HJę DPVOUT BCMFTUIFZ BSF DPVOUT XJUI OP PCWJPVT VQQFS CPVOE 8FMM BUUBDI PVS WBSZ TF DPVOUT XJUI B MPH MJOL BT JO UIF QSFWJPVT DIBQUFST ćJT HJWFT VT UIF ĕSTU Q  Z"→# ∼ 1PJTTPO(λ"#) MPH λ"# = α + H" + S# + E"# PEFM IBT BO JOUFSDFQU α UIBU SFQSFTFOU UIF BWFSBHF HJęJOH SBUF PO UIF MPH TDB BET ćF PUIFS FČFDUT XJMM CF PČTFUT GSPN UIJT BWFSBHF ćFO H" JT B WBSZJOH FČ PS UIF HFOFSBMJ[FE HJWJOH UFOEFODZ PG IPVTFIPME " SFHBSEMFTT PG EZBE ćF FČ FSBMJ[FE SFDFJWJOH PG IPVTFIPME # SFHBSEMFTT PG EZBE 'JOBMMZ UIF FČFDU E" FDJĕD SBUF UIBU " HJWFT UP # ćFSF JT B DPSSFTQPOEJOH MJOFBS NPEFM GPS UIF PU EJSFDUJPO XJUIJO UIF TBNF EZBE Z#→" ∼ 1PJTTPO(λ#") MPH λ#" = α + H# + S" + E#" 5PHFUIFS UIJT BMM JNQMJFT UIBU FBDI IPVTFIPME ) OFFET WBSZJOH FČFDUT B H) BOE B BEEJUJPO FBDI EZBE "# IBT UXP WBSZJOH FČFDUT E"# BOE E#"  8F XBOU UP BMMPX UIF QBSBNFUFST UP CF DPSSFMBUFEEP QFPQMF XIP HJWF B MPU BMTP HFU B MPU 8F BMTP XBOU UP B EZBE FČFDUT UP CF DPSSFMBUFEJT UIFSF CBMBODF XJUIJO EZBET 8F DBO EP BMM PG UIJT X EJČFSFODF NVMUJOPSNBM QSJPST ćF ĕSTU XJMM SFQSFTFOU UIF QPQVMBUJPO PG IPVTFIPME HJ SJ ∼ .7/PSNBM   , σ H σHσSρHS σHσSρHS σ S 'PS BOZ IPVTFIPME J B QBJS PG H BOE S QBSBNFUFST BSF BTTJHOFE B QSJPS XJUI B UZQJDBM DP NBUSJY XJUI UXP TUBOEBSE EFWJBUJPOT BOE B DPSSFMBUJPO QBSBNFUFS ćFSFT OPUIJOH O SFBMMZ ćF TFDPOE NVMUJOPSNBM QSJPS XJMM SFQSFTFOU UIF QPQVMBUJPO PG EZBE FČFDUT EJK EKJ ∼ .7/PSNBM   , σ E σ EρE σ EρE σ E 'PS B EZBE XJUI IPVTFIPMET J BOE K UIFSF JT B QBJS PG EZBE FČFDUT XJUI B QSJPS XJUI DPWBSJBODF NBUSJY #VU UIJT NBUSJY JT GVOOZ 5BLF B DMPTF MPPL BOE ZPVMM TFF UIBU UIFS POF TUBOEBSE EFWJBUJPO QBSBNFUFST σE  8IZ #FDBVTF UIF MBCFMT JO FBDI EZBE BSF B
33. ### Nicaragua households FDJĕD UP UIF IPVTFIPME BOE UIF EZBE ćF

PVUDPNF WBSJBCMFT UIF HJę DPVOUT BCMFTUIFZ BSF DPVOUT XJUI OP PCWJPVT VQQFS CPVOE 8FMM BUUBDI PVS WBSZ TF DPVOUT XJUI B MPH MJOL BT JO UIF QSFWJPVT DIBQUFST ćJT HJWFT VT UIF ĕSTU Q  Z"→# ∼ 1PJTTPO(λ"#) MPH λ"# = α + H" + S# + E"# PEFM IBT BO JOUFSDFQU α UIBU SFQSFTFOU UIF BWFSBHF HJęJOH SBUF PO UIF MPH TDB BET ćF PUIFS FČFDUT XJMM CF PČTFUT GSPN UIJT BWFSBHF ćFO H" JT B WBSZJOH FČ PS UIF HFOFSBMJ[FE HJWJOH UFOEFODZ PG IPVTFIPME " SFHBSEMFTT PG EZBE ćF FČ FSBMJ[FE SFDFJWJOH PG IPVTFIPME # SFHBSEMFTT PG EZBE 'JOBMMZ UIF FČFDU E" FDJĕD SBUF UIBU " HJWFT UP # ćFSF JT B DPSSFTQPOEJOH MJOFBS NPEFM GPS UIF PU EJSFDUJPO XJUIJO UIF TBNF EZBE Z#→" ∼ 1PJTTPO(λ#") MPH λ#" = α + H# + S" + E#" 5PHFUIFS UIJT BMM JNQMJFT UIBU FBDI IPVTFIPME ) OFFET WBSZJOH FČFDUT B H) BOE B BEEJUJPO FBDI EZBE "# IBT UXP WBSZJOH FČFDUT E"# BOE E#"  8F XBOU UP BMMPX UIF QBSBNFUFST UP CF DPSSFMBUFEEP QFPQMF XIP HJWF B MPU BMTP HFU B MPU 8F BMTP XBOU UP B EZBE FČFDUT UP CF DPSSFMBUFEJT UIFSF CBMBODF XJUIJO EZBET 8F DBO EP BMM PG UIJT X EJČFSFODF NVMUJOPSNBM QSJPST ćF ĕSTU XJMM SFQSFTFOU UIF QPQVMBUJPO PG IPVTFIPME HJ SJ ∼ .7/PSNBM   , σ H σHσSρHS σHσSρHS σ S 'PS BOZ IPVTFIPME J B QBJS PG H BOE S QBSBNFUFST BSF BTTJHOFE B QSJPS XJUI B UZQJDBM DP NBUSJY XJUI UXP TUBOEBSE EFWJBUJPOT BOE B DPSSFMBUJPO QBSBNFUFS ćFSFT OPUIJOH O SFBMMZ ćF TFDPOE NVMUJOPSNBM QSJPS XJMM SFQSFTFOU UIF QPQVMBUJPO PG EZBE FČFDUT EJK EKJ ∼ .7/PSNBM   , σ E σ EρE σ EρE σ E 'PS B EZBE XJUI IPVTFIPMET J BOE K UIFSF JT B QBJS PG EZBE FČFDUT XJUI B QSJPS XJUI DPWBSJBODF NBUSJY #VU UIJT NBUSJY JT GVOOZ 5BLF B DMPTF MPPL BOE ZPVMM TFF UIBU UIFS POF TUBOEBSE EFWJBUJPO QBSBNFUFST σE  8IZ #FDBVTF UIF MBCFMT JO FBDI EZBE BSF B Z#→" ∼ 1PJTTPO(λ#") MPH λ#" = α + H# + S" + E#" 5PHFUIFS UIJT BMM JNQMJFT UIBU FBDI IPVTFIPME ) OFFET WBSZJOH FČFDUT B H) BOE B S)  *O BEEJUJPO FBDI EZBE "# IBT UXP WBSZJOH FČFDUT E"# BOE E#"  8F XBOU UP BMMPX UIF H BOE S QBSBNFUFST UP CF DPSSFMBUFEEP QFPQMF XIP HJWF B MPU BMTP HFU B MPU 8F BMTP XBOU UP BMMPX UIF EZBE FČFDUT UP CF DPSSFMBUFEJT UIFSF CBMBODF XJUIJO EZBET 8F DBO EP BMM PG UIJT XJUI UXP EJČFSFODF NVMUJOPSNBM QSJPST ćF ĕSTU XJMM SFQSFTFOU UIF QPQVMBUJPO PG IPVTFIPME FČFDUT HJ SJ ∼ .7/PSNBM   , σ H σHσSρHS σHσSρHS σ S 'PS BOZ IPVTFIPME J B QBJS PG H BOE S QBSBNFUFST BSF BTTJHOFE B QSJPS XJUI B UZQJDBM DPWBSJBODF NBUSJY XJUI UXP TUBOEBSE EFWJBUJPOT BOE B DPSSFMBUJPO QBSBNFUFS ćFSFT OPUIJOH OFX IFSF SFBMMZ ćF TFDPOE NVMUJOPSNBM QSJPS XJMM SFQSFTFOU UIF QPQVMBUJPO PG EZBE FČFDUT EJK EKJ ∼ .7/PSNBM   , σ E σ EρE σ EρE σ E 'PS B EZBE XJUI IPVTFIPMET J BOE K UIFSF JT B QBJS PG EZBE FČFDUT XJUI B QSJPS XJUI BOPUIFS DPWBSJBODF NBUSJY #VU UIJT NBUSJY JT GVOOZ 5BLF B DMPTF MPPL BOE ZPVMM TFF UIBU UIFSF JT POMZ POF TUBOEBSE EFWJBUJPO QBSBNFUFST σE  8IZ #FDBVTF UIF MBCFMT JO FBDI EZBE BSF BSCJUSBSZ *U JTOU NFBOJOHGVM XIJDI IPVTFIPME DPNFT ĕSTU PS TFDPOE 4P FBDI QBSBNFUFS NVTU IBWF UIF TBNF WBSJBODF #VU XF EP XBOU UP FTUJNBUF UIFJS DPSSFMBUJPO BOE UIBU JT XIBU ρE XJMM EP GPS VT *G ρE JT MBSHF UIFO XIFO POF IPVTFIPME HJWFT NPSF XJUIJO B EZBE TP UPP EPFT UIF PUIFS
34. ### Nicaragua households HJ SJ ∼ .7/PSNBM   , σ

H σHσSρHS σHσSρHS σ S IPME J B QBJS PG H BOE S QBSBNFUFST BSF BTTJHOFE B QSJPS XJUI B UZQJD XP TUBOEBSE EFWJBUJPOT BOE B DPSSFMBUJPO QBSBNFUFS ćFSFT OPUI E NVMUJOPSNBM QSJPS XJMM SFQSFTFOU UIF QPQVMBUJPO PG EZBE FČFD EJK EKJ ∼ .7/PSNBM   , σ E σ EρE σ EρE σ E UI IPVTFIPMET J BOE K UIFSF JT B QBJS PG EZBE FČFDUT XJUI B QSJPS USJY #VU UIJT NBUSJY JT GVOOZ 5BLF B DMPTF MPPL BOE ZPVMM TFF UIBU EFWJBUJPO QBSBNFUFST σE  8IZ #FDBVTF UIF MBCFMT JO FBDI EZBE HGVM XIJDI IPVTFIPME DPNFT ĕSTU PS TFDPOE 4P FBDI QBSBNFUFS N  #VU XF EP XBOU UP FTUJNBUF UIFJS DPSSFMBUJPO BOE UIBU JT XIBU ρ HF UIFO XIFO POF IPVTFIPME HJWFT NPSF XJUIJO B EZBE TP UPP EP OFBS [FSP UIFO UIFSF JT OP QBUUFSO XJUIJO EZBET Dyad is symmetric (A/B just labels), so variance same for both variables
35. ### Nicaragua households • Model code in text • Only trick

is copying sigma_d • Consider general g/r effects first: EZBET ćJT JT OFDFTTBSZ CFDBVTF UIF NPEFM JT QBSBNFUFSJ[FE VTJOH B \$IPMF GVODUJPO (0'/\$+'4Ǿ'*2 -Ǿ/-\$Ǿ. '!Ǿ/-).+*. NVMUJQMJFT B NBUSJY CZ JUT ćJT JT IPX B \$IPMFTLZ GBDUPS JT NBEF CBDL JOUP JUT PSJHJOBM NBUSJY *G ZPV X UIF DPSSFMBUJPOT BNPOH UIF FČFDUT UIFO UIJT JT B VTFGVM DBMDVMBUJPO ćF ",ʛ UIF MJOF QMBDFT UIF MJOF JO 4UBOT HFOFSBUFE RVBOUJUJFT CMPDL XIJDI IPMET DPEF BęFS FBDI )BNJMUPOJBO USBOTJUJPO 4P BOZUIJOH ZPV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G HJWJOH IBWF TPNF PG UIF MPXFTU SBUFT PG SFDFJWJOH ćBU JT UIF OFHBUJWF D TBX JO UIF +- \$. PVUQVU /PUF BMTP UIF HSFBUFS WBSJBUJPO JO HJWJOH SBUFT ćBU UP UIF TUBOEBSE EFWJBUJPO QBSBNFUFST /P XIBU BCPVU UIF EZBE FČFDUT -FUT MPPL BU UIBU DPWBSJBODF NBUSJY +- \$.ǿ (ǎǑǡǑ Ǣ  +/#ʙǐ Ǣ +-.ʙǿǫ#*ǾǫǢǫ.\$"(ǾǫȀ Ȁ ( ) . ǒǡǒʉ ǖǑǡǒʉ )Ǿ !! #/ #*ǾȁǎǢǎȂ ǎǡǍǍ ǍǡǍǍ ǎǡǍǍ ǎǡǍǍ   #*ǾȁǎǢǏȂ ǍǡǕǕ ǍǡǍǐ ǍǡǕǏ Ǎǡǖǐ ǎǍǔǏ ǎǡǍǎ #*ǾȁǏǢǎȂ ǍǡǕǕ ǍǡǍǐ ǍǡǕǏ Ǎǡǖǐ ǎǍǔǏ ǎǡǍǎ #*ǾȁǏǢǏȂ ǎǡǍǍ ǍǡǍǍ ǎǡǍǍ ǎǡǍǍ   .\$"(Ǿ ǎǡǎǍ ǍǡǍǓ ǎǡǍǏ ǎǡǏǍ ǎǐǑǒ ǎǡǍǍ ćF DPSSFMBUJPO IFSF JT QPTJUJWF BOE TUSPOH "OE UIFSF JT NPSF WBSJBUJPO BNPO UIFSF JTBNPOHIPVTFIPME JO HJWJOHSBUFT ćJTJNQMJFT UIBUQBJSTPG IPVTFIPMETBS JG POF IPVTFIPME HJWFT MFTT UIBO BWFSBHF BęFS BDDPVOUJOH GPS HFOFSBMJ[FE HJWJO JOH UIFO UIF PUIFS QSPCBCMZ HJWFT MFTT BT XFMM 8F DBO QMPU UIF SBX EZBE FČFD
38. ### 0 2 4 6 8 0 2 4 6 8

generalized giving generalized receiving -2 -1 0 1 2 3 -1 0 1 2 3 household A in dyad household B in dyad 'ĶĴłĿĲ ƉƌƑ -Fę &YQFDUFE HJWJOH BOE SFDFJWJOH BCTFOU BOZ EZBETQFDJĕD FČFDUT &BDI QPJOU JT B IPVTFIPME BOE UIF FMMJQTFT TIPX  DPNQBUJCJMJUZ SFHJPOT ćFSF JT B OFHBUJWF SFMBUJPOTIJQ CFUXFFO BWFSBHF HJWJOH BOE BWFS BHF SFDFJWJOH BDSPTT IPVTFIPMET 3JHIU %ZBETQFDJĕD FČFDUT BCTFOU HFOFS BMJ[FE HJWJOH BOE SFDFJWJOH "ęFS BDDPVOUJOH GPS PWFSBMM SBUFT PG HJWJOH BOE SFDFJWJOH SFTJEVBM HJęT BSF TUSPOHMZ DPSSFMBUFE XJUIJO EZBET Conditioning on general giving/receiving, gifts are very balanced. Role of zeros?
39. ### Homework • Bangladesh contraception again • Next week: Gaussian processes,

measurement error, missing data, horoscopes