projpred tests failing with posterior 1.6.0
fweber144 opened this issue · 3 comments
fweber144 commented
With posterior 1.6.0, I get an error in projpred's unit tests that doesn't occur with posterior 1.5.0. This seems to be related to loo::E_loo()
, that's why I'm posting here and not on posterior's issue tracker. Reprex (I've updated this reprex to avoid the need to load a binary file):
# From `?loo::E_loo`:
library("loo")
library("rstanarm")
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
d <- data.frame(
weight = c(ctl, trt),
group = gl(2, 10, 20, labels = c("Ctl","Trt"))
)
fit <- stan_glm(weight ~ group, data = d, refresh = 0)
yrep <- posterior_predict(fit)
log_ratios <- -1 * log_lik(fit)
r_eff <- relative_eff(exp(-log_ratios), chain_id = rep(1:4, each = 1000))
psis_object <- psis(log_ratios, r_eff = r_eff, cores = 2)
E_loo(yrep, psis_object, type = "mean", log_ratios = log_ratios)
#> Error in posterior::pareto_khat(r_theta, tail = "right", ndraws_tail = tail_len_i)$khat: $ operator is invalid for atomic vectors
Created on 2024-07-04 with reprex v2.1.0
jgabry commented
I just submitted a loo to CRAN yesterday that should be compatible with the
new posterior. Which version of loo did this error come from?
…On Thu, Jul 4, 2024 at 12:15 AM Frank Weber ***@***.***> wrote:
With posterior 1.6.0, I get an error in projpred's unit tests that doesn't
occur with posterior 1.5.0. This seems to be related to loo::E_loo(),
that's why I'm posting here and not on *posterior*'s issue tracker (input
file available here
<https://github.com/user-attachments/files/16094142/khat_issue.zip>):
load("khat_issue.rda")
y_lat_E <- loo::E_loo(
t(refmodel$ref_predfun(refmodel$fit, excl_offs = FALSE)),
psis_object = psisloo,
log_ratios = -loglik_forPSIS
)#> Error in posterior::pareto_khat(r_theta, tail = "right", ndraws_tail = tail_len_i)$khat: $ operator is invalid for atomic vectors
Created on 2024-07-04 with reprex v2.1.0 <https://reprex.tidyverse.org>
—
Reply to this email directly, view it on GitHub
<#271>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3PQQYP7B5KNYCVBOHGL63ZKTR7DAVCNFSM6AAAAABKK3MHKGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM4TAMBTGQ2DEMY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
fweber144 commented
This was with loo v2.7.0 from CRAN. I just saw that v2.8.0 is out; the issue does not occur with v2.8.0 anymore. Thanks!
jgabry commented
Ok great, thanks Frank!
…On Thu, Jul 4, 2024 at 11:39 AM Frank Weber ***@***.***> wrote:
This was with loo v2.7.0 from CRAN. I just saw that v2.8.0 is out; the
issue does not occur with v2.8.0 anymore. Thanks!
—
Reply to this email directly, view it on GitHub
<#271 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3PQQ4QSATWOGOOFHZPATTZKWCGJAVCNFSM6AAAAABKK3MHKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBZGM4TINBYHA>
.
You are receiving this because you commented.Message ID:
***@***.***>