stan-dev / rstanarm

rstanarm R package for Bayesian applied regression modeling
https://mc-stan.org/rstanarm
GNU General Public License v3.0
389 stars 134 forks source link

Error using reloo with stan_clogit #399

Closed sschloss1 closed 5 years ago

sschloss1 commented 5 years ago

Summary:

Attempts to use reloo() called via loo(...,k_threshold=...) with a stan_clogit() object produce an error.

Description:

When I call loo() on an object created with stan_clogit() and need to rerun some observations (using the k_threshold argument), I get this error: Error in ptr() : Not a closure: special.

I get exactly the same error on two different datasets/models. Debugging, it looks like the error is in log_lik.stanreg() and specifically in ll_args.stanreg(). Any help greatly appreciated, thanks.

Reproducible Steps:

#example from stan_clogit help
dat <- infert[order(infert$stratum), ] # order by strata
post <- stan_clogit(case ~ spontaneous + induced + (1 | education), 
                    strata = stratum,
                    data = dat,
                    subset = parity <= 2,
                    QR = TRUE,
                    chains = 2, iter = 1500) # for speed only
loo(post,k_threshold=.7)

RStanARM Version:

2.18.9

R Version:

3.6.1

Operating System:

Ubuntu 18.04.3

sschloss1 commented 5 years ago

I realized that I wasn't using the latest rstanarm version, and this problem no longer exists in 2.19.2. Closed.

jgabry commented 5 years ago

Thanks for reporting and also checking the latest release. Glad it’s working for you now!