From ca6b8484720ef2b1753bde681a6d63feb00193eb Mon Sep 17 00:00:00 2001 From: Aki Vehtari Date: Thu, 15 Feb 2024 19:21:02 +0200 Subject: [PATCH 1/2] simplify mcse_elpd using log-normal approximation --- R/loo.R | 26 +++++++++--------- tests/testthat/reference-results/loo.rds | Bin 2079 -> 2090 bytes tests/testthat/reference-results/mcse_loo.rds | Bin 47 -> 55 bytes .../reference-results/moment_match_loo_1.rds | Bin 1739 -> 1748 bytes .../reference-results/moment_match_loo_2.rds | Bin 1739 -> 1748 bytes .../reference-results/moment_match_loo_3.rds | Bin 1738 -> 1748 bytes .../moment_match_var_and_cov.rds | Bin 1922 -> 1933 bytes 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/R/loo.R b/R/loo.R index a321ff08..3c242c45 100644 --- a/R/loo.R +++ b/R/loo.R @@ -484,31 +484,31 @@ importance_sampling_loo_object <- function(pointwise, diagnostics, dims, #' @param ll Log-likelihood matrix. #' @param E_elpd elpd_loo column of pointwise matrix. #' @param psis_object Object returned by [psis()]. -#' @param n_samples Number of draws to take from `Normal(E[epd_i], SD[epd_i])`. +#' @param n_samples Deprecated #' @return Vector of standard error estimates. #' -mcse_elpd <- function(ll, lw, E_elpd, r_eff, n_samples = 1000) { +mcse_elpd <- function(ll, lw, E_elpd, r_eff, n_samples = NULL) { lik <- exp(ll) w2 <- exp(lw)^2 E_epd <- exp(E_elpd) - # zn is approximate ordered statistics of unit normal distribution with offset - # recommended by Blom (1958) - S <- n_samples - c <- 3/8 - r <- 1:n_samples - zn <- qnorm((r - c) / (S - 2 * c + 1)) + if (length(r_eff)==1 && !is.null(ncol(ll))) { + r_eff <- rep(r_eff, ncol(ll)) + } var_elpd <- vapply( seq_len(ncol(w2)), FUN.VALUE = numeric(1), FUN = function(i) { - var_epd_i <- sum(w2[, i] * (lik[, i] - E_epd[i]) ^ 2) - sd_epd_i <- sqrt(var_epd_i) - z <- E_epd[i] + sd_epd_i * zn - var(log(z[z > 0])) + # Variance in linear scale + # Equation (6) in Vehtari et al. (2022) + var_epd_i <- sum(w2[, i] * (lik[, i] - E_epd[i]) ^ 2) / r_eff[i] + # Compute variance in log scale by match the variance of a + # log-normal approximation + # https://en.wikipedia.org/wiki/Log-normal_distribution#Arithmetic_moments + log(1 + var_epd_i/E_epd[i]^2) } ) - sqrt(var_elpd / r_eff) + sqrt(var_elpd) } diff --git a/tests/testthat/reference-results/loo.rds b/tests/testthat/reference-results/loo.rds index b832ced5b7ffee095732bec56a144fec93cd786d..696632af6365d1e6e7df20195517f2cbfd71a967 100644 GIT binary patch literal 2090 zcmV+_2-Wu=iwFP!000001MQZ1R8vH72OR6*>1AD5D z%YE&UdFlCy&lRC4RIgc1l2F?aC-^1O^T9w{9&*H*pq@z0qY*}g+2{hHA_-NDqdxRE z>%A%88)8ZgiR4R!GOEtek7MG!;eMewI+Q1liqdQ2=ywHG6$$h+=!O}KWw9a&KUS#M z^i_+gZ=L=pm6G&V&-@3r+L5&J8l}ekTatceqv=Q88%SEjvB|kg6OyPIs(EhGKoUI> zkFCUVa!jy)dE2$uq^ZBBxz`jgl3|qtW!tqRanU{3qnmn;=S!Qzwwp0LGIHc{YgeajJ0FHYm&{%sU~*{NzTwp{*-{ZB)zP#d`_<| z$?mcl%x@h-GA`VyJha(?G)nGh+y;51N&V5>Tss|Utdj<`ajIHrt|QH^I?XzAZ4qf?o)Dou{hBm(jw{eO4wE$3y>-FOVJ-wU#7J%O37{nWf`t7frkAc3&ft~yRa zYTk{d-^GnU_H_5GFMM@S&D0+DHaiC=940LrTY3@FS6`!dornM>Biozq;{i!!1?s_P zXCYBs^VrBW7*g|%-HEQbu#@>Z)vwzUwpl%|eNnsuwlXg@baFMYWqQb;Z&uENT^0NH zPo1|0=aPy?U&w=odSv-6<^OF2sn1& z(On{kfc(IlzKk>i6c$lI*8`~Xlic7YJ^^Po{V-NyPQtk_117lCr@%qK7o83hseW$h zg?T)xtXY{&FD77Lrp|d;6s1$`6b}~=Q2g5s4!fIxQ$8#U9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X7!>#W{f+4v{! z@0c+7R(}cz8= zX?`j&)RncxC-y;6Zx>Gw&;Jy04*hbKC1v19(}8AoLI&E}(l+AvV0%zi)p;yErVW(d zyYT9FF8x4J=iwr`Ll`QJ$chLinikN$sv-OTb0Ortp)QFHUO4(k$n%SGBWC(Q z{v-LOPfFg!y7rxKZe?K0Z#gu58swL5&B#;fA#b?o-MDQe@PKdjGzC!h&#I-?(2qPQybJ0^hN$>f4kR>zfm+!%{;lCH?r%2&c gsT#(T!_-U)m#k1G_8Jyjn)pus0y**y1qBNL06ofVqW}N^ diff --git a/tests/testthat/reference-results/moment_match_var_and_cov.rds b/tests/testthat/reference-results/moment_match_var_and_cov.rds index 87901129d63a0706b9ae26699edf8f4cf21979f6..262ec5602a8e335f413efb2560febc3592b648c7 100644 GIT binary patch literal 1933 zcmV;82XgoyiwFP!000001Lc-`Jk;qP#~(8YV^D6bwJJ7}TT7y&?Ri?1+M`5SNllEA zsWB!q>Xa^a>s8ivarwCpvm(_>tZN~!XSRrrbI=}%Q%=%GwNeg}#^wCRZ>FQX&g*r~ z-)CO0-+Z6%^L(G%@B99JUf%#M0014R(rAFLMmB-k)-7x8T**Ft(jf z^z0KA*dpE@{gSl{g-||noOqkodbkdjL_REXU|FKCC?Ak3lJiu6D$tZ~5Xy}p4U>Fm z)B8=^4?;A^5Pon3M@Y8y6>)mh*{E?2PY}xDMMf%oHNi}WY;xI(88qb#Poan#5iH^; ze43vp`9G<+QmS-$^V-vCzYkA=*tKy^8CaPE_Hi$iF`T`^z5}rM8%Y2+NVL;E4&vLVAqnhFW4CwwlQ0g00O;S1rrVF7=8 z!B^D)+l6oJ(FFje{NdXrqI!VW{W^bNM=Zb_M2*4SIRK`ej{AEkx^Ujm~ z0iTXG8_CB9f~Im;leXkfo6TPWxIV*}p4knc^A0QHdI0d(M)d9{pZdfIY9> zU7G;_@}PJ|42ox@L-C9l6wio3@r-mSp2_}co{=8KGh$LaBW;Rj#H4se42oyOpm;_M zif5!v@r?8+o)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_W#}2@(1yAcc82}zQdpxSn1HjDh zoLAh9Anng=MMChxB<8q^WTdg=dW6pR#HUv2fg>Q#auN$ z95P+JfwYxJcG&+0pkJN^J--(~_t2#ljR4?}&FQ^=BhMXz0{$6L2(Zt!hacqufV?T5 z5kc{cj3}NFLGg?Tif6>6cqaR2ct*w)&xk?sj0`EB5rg6x5fsmepm;_E#WOObct*w) z&xoLSMy3?ch@f~zh7`|;N%4#bif3d*@r)Q0&&ZJC8JSQ#BZA_Y+;@g&#H4se3^mW= z<{qv?sa>$PY0+NAR$Y8ix?^bkYfE^=`q*&f$O>37ShOR!AsSyY+9c;0EP>hVb%Fkl z_OMRAX5lHb5PY+(&CtrH31`oL;?QWlA66zwGP6D0VW~fD@%2UYgYcCAt-R^WVhdv}5Lw@@C; z=-Qy;1h0AUa_;=(2rKpM1VsYK?YZbVo@dF}SgOKbGurA3_Dre`audZ{%%tB%^JN*~ovo1RrSr__~D=Red=MhsiT zVf_~cm2%$U@*{ci96p=F5{AWc;smTi>OyL&F6OF&YJ-2>ZoN0$WXy%Aly zX1sgbbtH9V)3!P}Az9Yur0)GfR1hw`o#E_;3jVavBjrgClKpvVB)%;lNvalvM9TtI=Z1PD`SIeT(BM-@a(iAge2v7?_!_D8+IQ7REOoqEdc7WhLxRz#)h9GiA3~p_Rz)IBhfu)f z$9>8bX><}1!3{ge7m#6WO$;FvaYZaacr=F{_dn<{_2jv=Mvv?gzU8YW+#By$n-qnr zSFA30^V+~n(R(uwY+jgXZXQ$z{`UqJ+!&!CHZDw6!$e^*LLQfYaMmzg)g*KBFXWxk Ik_8I@0I6WQg#Z8m From 473e1071122a72acdeae7c72df02e8a4f45e94c8 Mon Sep 17 00:00:00 2001 From: jgabry Date: Thu, 15 Feb 2024 14:12:56 -0700 Subject: [PATCH 2/2] use saveRDS(..., version = 2) to maintain compatibility with R < 3.5 --- R/loo.R | 4 ++-- tests/testthat/reference-results/loo.rds | Bin 2090 -> 2081 bytes tests/testthat/reference-results/mcse_loo.rds | Bin 55 -> 47 bytes .../reference-results/moment_match_loo_1.rds | Bin 1748 -> 1741 bytes .../reference-results/moment_match_loo_2.rds | Bin 1748 -> 1740 bytes .../reference-results/moment_match_loo_3.rds | Bin 1748 -> 1740 bytes .../moment_match_var_and_cov.rds | Bin 1933 -> 1924 bytes 7 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/loo.R b/R/loo.R index 3c242c45..b8899ff6 100644 --- a/R/loo.R +++ b/R/loo.R @@ -491,7 +491,7 @@ mcse_elpd <- function(ll, lw, E_elpd, r_eff, n_samples = NULL) { lik <- exp(ll) w2 <- exp(lw)^2 E_epd <- exp(E_elpd) - if (length(r_eff)==1 && !is.null(ncol(ll))) { + if (length(r_eff) == 1 && !is.null(ncol(ll))) { r_eff <- rep(r_eff, ncol(ll)) } var_elpd <- @@ -505,7 +505,7 @@ mcse_elpd <- function(ll, lw, E_elpd, r_eff, n_samples = NULL) { # Compute variance in log scale by match the variance of a # log-normal approximation # https://en.wikipedia.org/wiki/Log-normal_distribution#Arithmetic_moments - log(1 + var_epd_i/E_epd[i]^2) + log(1 + var_epd_i / E_epd[i]^2) } ) sqrt(var_elpd) diff --git a/tests/testthat/reference-results/loo.rds b/tests/testthat/reference-results/loo.rds index 696632af6365d1e6e7df20195517f2cbfd71a967..0dea98c3e53ef331b951edc4ac166a31ec372471 100644 GIT binary patch delta 2073 zcmV+!2y5TOu|AAc@AxX=;%yNZrdk)nd4gN6`-1`?J8L4;vb1Oo^GSwuusj4Wp; zs4Q9`PX)DrP%R)uTRUom!6aphxRr)^_!6u3^qiUh=bv})_b%_=-1~XoeEp0u45MOt zGzvzg5mg$Cco1z=Q=&A$eH68)B_7tuxa{K0=h7e)q}2>NVSkWifF1lC=JH^qI~UoK z8pHIc#5@Y7hZ#-2EQl{8ifM0_AS7A7H^h(_62=ko#6+E?9Y=pNR@=`LLjW~)g^!7h~5st~kvs8_MI}}l#xwt{o$($T3 z4X&>d`LiB&;;+^dIGW*IA?zDp@BNOy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 M0R$W6e2xnM0OUv)Pyhe` diff --git a/tests/testthat/reference-results/mcse_loo.rds b/tests/testthat/reference-results/mcse_loo.rds index 964e3ad01e110376e119a3cd73363cf976a38eee..20de2a2943454f982cf349b97e5640ae029ed7a3 100644 GIT binary patch literal 47 ycmb2|=3oE==I#ec2?+^F35jVb2}x{5l0O<|T&$b@%kWuKy(NR{p@M00Ky?6G+7I&p literal 55 zcmb2|=3oE==I#ec2?+^l35iKb32CfGk`d0%cS>{{cC4>bjkFC;_~UEV9S7qzksbrz#ER0I>n2YSFdMkrvCp$lxY%w0n} zol}3i=j{E>cjot-nLG2jzw?W9peTw*S@W$Z9v?UP?)ZWGc+S|4FocIqIvz4Q2zne0 zO^R|0fD%so+TOqLM&%$B3aUPj%*uyziKZxP9*(o3tSNi*WHLnpHcmrJU`gyVE_T=@ zkx7uNaoe5qa~bmG#^v!UnK)jlcgGLsGGZRc|b54yrq4;ZpkWSoVNHtm!c0DU$(xN=xsozmLGpFysARRsYNSL zpud5d*}r6g&we!UicLn$uiv2lIa|E%d-b7#$(4H5qLs)v)?v%)lC#J-G0GvdeHt=O zdNoOC15v+rK6F1l%0T(FWTf;9kGXFJ|sdtj-k$$$oyZz@UU`zL2fNtG!QZ>T$R%Z436(EU1mKFFb9+KkG=8(kah-KSgcjeAbG3g0?Lg5%$d2{D>q&Pk~Js& z)ZcXiro>)E_vZqpv|*m98v$nDxn)099Rp0yhMts=K_J(4XI|)>0+>VJtH;zd0u}Sd z=>;|!fH^Tn*sb&dOyh!U#|N^3w7+hCwQxFM4u~A=C%g}&$99E>c6b3v)SRI1i-SNS z9D60*I~T;wuAcCCLl|H#WsN#py&vzp>2QL66Og6f*f7`nAdqYebN=*V9~8d4Lhy5{ z4CIVVE1Ni*0(mDC(My~ukmDTpn$B$99%MeOqrg5Zt2N?OtYDclJD!a-}mAzQUcdYZ@jjiUU{yO&0J00@4NQSkrr>0^n)-&3sG~C7Oq-ULK zdxHD>rjNTdngS)|KcKZ~=^&@DxO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;Jx~t2#Vm-Ze za{U9mPFm*K*5|mtciNbHBPmc^_AOeMng+59ihA~Ynf!mLW$?OtuTP6~$MHGz*!KcY zQgANe8PbGj=tOviG~pT2glEVnJVToB44nzj(2?*A9SG0Rk?;&@!ZV}^&yXfOLkGe$ zbS6AQn(z$W2+xovJVOV&G zD=z+cV9g$s@7a{(hm|f<9cC1)x7lg_~vOK0aVrXJpL`z8=SHESxfzX3Ke?fFIf202#&HbcSBMrq}dzzPW zsP#NOIp$^^%1U$Tq~4DM)jmhVb8?j6OPi1C$H(%3F7<2lhgt8^)#hE($6yv$(sXQCba&C-02uE zQOQLABB2uDDo==xTPsVD$V5seNv2kaV!1@>#wBx8LiGd>T0Eu${}KP63nA|f18hVQ z&ojCq%dW}`nd=4FPo-NwFZ&Sdx}~S?ZNQe@c69bE$R=*zkgw1{R(IXAb;m@=Mt}Jv zPnrqY62~c_U+jWxWu502VKI=^_}B~!^2KpBQ9lc!uz#noaJ>)KRmqYkHIO~T|B>gS zgRE>zORpN>@uIq8L2Xd?QBC#y755=~c$J5yE+5Y~dZxW17P4E?8*`PLaC}O4_T_ny z%~~lgwLb*eB9G-l^a*6kjyt=)djje@_O*na-2vH(R{dkD9s8Fw8qbzOc7v6(e55;M z4>a*F*GIj$?`~@F_kXdk6fD-}YQ>ovQl-53K+H}eS#-2nBn=AkeVQKAFUDCJxlW>`awaB0f!!o# zA6luBt3(R%8kt1>AL=nK`0u&K7I!IM(Oe1l(ivOfqR@22T*BjPsKKQ7@;yl67}ekJ q!L;GO78ov%S1OX!j46kyn0RHJJRxStu%)Sq@8nPB%ycvk3jhG;*mD5@ diff --git a/tests/testthat/reference-results/moment_match_loo_2.rds b/tests/testthat/reference-results/moment_match_loo_2.rds index 23c68012028d60de2a326c75e8cdc12a5b4ce481..9cea1fc5f653901a9640bb3f53dcd4747ed8b8f7 100644 GIT binary patch literal 1740 zcmV;-1~d5|iwFP!000001Lc-`R8&PA$1l4eESEPN)buR)sFYeCWP+8|E`NMQ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TIa6RC)E@htt8d8hY6v!4_3n_aIy!Ty=&1A6nsSi5#smh8fMR`b-_U-3H0yU#WMh5LJE zjJf|B1qzD4M_ZDTL3&Pp_fZd{|8La{UVrz{^%^s1kS07sd%`ocBRoS}!ZUOtJVToB3~9nMbRaxKJC5h4A71<^cjG~n?SI*? z+7%K9w6&V<@W^3k#e0SG19Cn?a_bRUvBetjWlMRRWJUto*WNv;!^a9#RrP+obyYVg zX{{f1!C?d_=si^+w)RIQfoXyM=nqu5A@1(4W0O$6=*=iqqCMI(=8A&4WDCk`y1O0+ zd4jW+zi6mGzD0R%*-Mu_HGq?B4ju;q3IFW=X6_5-w-rBuZI$6qiU{xMXfjsP3R*%gm>VO&PDwg^>4#swj!ix+zy7%dXD~ zT<8JWPsO|T7O%#-X63i{6R>6XoSZ)ovYYlLWXsf$)n0dR-ai?#5vQMIiFZS`&~94L zkpqw|t8qUP90^&qm*p^jZ+{$T8TN~781`@X7Hsvxx;$R=qzbaf9e(0DX(225q^U;< z@OXaBDgPFz{h+FH$%hXh`}uk|bxk&&Z}c1+SrlYHNvY42Z^!Z5I@2#Nf^6D4VUf*o z$mYAP6`+qHTl|Hi^E(w#+jh7q_}qTTmNx6Us8;M>SZ_F21la_0M}O&S!y%j7;BdJ% z?Ad*HQiH!&#lBFmSeU96M`}ow^6UdKIfY9iB1|G~P>}D__!y7T%v4&Lw5h~;riCwz z&oq@-oaRceXZpDkjBns}Xv1y7TEbOD3R8z%CXH2Ykt$4e5-pZ8k+CxDCNlZZa)ne8 zE)#B)h?M`M9^-;v&Pg>^xJ&+m=1REd&e$9mg~lW15}t#a8ccf6--9TcQM`N)#tr|o mzzAuKTo$Kfj5$of#K@ziv5`ZD`Nk%`lfMCz5_GK&3jhGo#b)~e diff --git a/tests/testthat/reference-results/moment_match_var_and_cov.rds b/tests/testthat/reference-results/moment_match_var_and_cov.rds index 262ec5602a8e335f413efb2560febc3592b648c7..11fb6c3b19972c7a97f3abb9bdf809f717d5f70f 100644 GIT bin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