Open e5c opened 4 years ago
Woops, I must have not implemented it and forgotten to write a test to catch that.
This is hopefully easy to fix for a future release. But in the meantime you should be able to get the same result from the parameter summary object? Or taking the median of the relevant parameters in the trace?
Something like rstanarm::summary(my_model)
or rstan::summary(my_model$stanfit)
? I can't remember whether my_model$stan_summary
includes or excludes the random effects.
@sambrilleman Yes they're included in my_model$stan_summary
and I can access them that way. Good to know re. a fix for future release, thanks!
In case it's ok to add onto this thread (I'll happily post elsewhere with this question, e.g. Discourse, if you can lmk if that's more appropriate): when using loo
and posterior_survfit
with the above multilevel_model
(and all other multilevel models) I get this warning:
> loo_ml <- loo(multilevel_model, k_threshold = 0.7)
Warning message in model.frame.default(Terms, data, xlev = xlevs, drop.unused.levels = drop.unused.levels, :
“variable 'LocationName' is not a factor”
and
> mm_ps_treatment0 <- posterior_survfit(multilevel_model, ids = treatment0, standardise = TRUE, times = 0)
# (here there are so many warnings that i just turn them off)
Could you explain what this warning indicates?
Thanks, Eliza
It probably means that in the data / model frame used in the model estimation the grouping variable (LocationName
) what a factor
variable. But in the prediction data it isn't getting converted to a factor
but must be a string
or integer
or something. It still works, but since the prediction variable isn't of the same class as variable used in the model fitting R issues a warning.
Where you say here there are so many warnings that i just turn them off
... are they all the same warning as the previous one? (i.e. something like Warning message in model.frame.default(Terms, data, xlev = xlevs, drop.unused.levels = drop.unused.levels, “variable 'LocationName' is not a factor”
).
It would help to have a reproducible example to help debug. But I realise it you might not be able to share the data. If not, can you create a small fake dataset that generates the same issue?
Btw, if you are able to post a reprex to demonstrate those warnings, it would be handy if you are able to post it as a separate issue. It will be easier to track the issues that way (i.e. the fix for ranef
can be separate from the fix for the warnings about the grouping factor). Cheers!
Hopefully the missing ranef()
method is resolved by this commit: https://github.com/stan-dev/rstanarm/commit/d8fea177ddc95671bfb8d8be7060b44c0de839cb
But it will have to be tested before closing this issue (I can't currently build rstanarm so can't test it yet).
(I can't currently build rstanarm so can't test it yet).
Hmm you still can't build it even after the survival branch was updated from master? Not sure if @bgoodri is monitoring this conversation, but @sambrilleman you might try reaching out to him separately. I don't know why rstanarm won't build, but I think it should.
It might build from source on R for Windows 4.0 now that the LTO stuff is in. I haven't been able to do it on the Windows computer in my office for 32bit (64bit works if you pass --no-multiarch), although both 32bit and 64bit somehow work on CRAN.
On Mon, Aug 10, 2020 at 2:08 PM Jonah Gabry notifications@github.com wrote:
(I can't currently build rstanarm so can't test it yet).
Hmm you still can't build it even after the survival branch was updated from master? Not sure if @bgoodri https://github.com/bgoodri is monitoring this conversation, but @sambrilleman https://github.com/sambrilleman you might try reaching out to him separately. I don't know why rstanarm won't build, but I think it should.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstanarm/issues/440#issuecomment-671505627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ2XKUU3YBM5N557ZAHYWTSAAZRLANCNFSM4NSFXJ3Q .
@jgabry @bgoodri ok thanks both - I will give this another crack tonight.
Summary:
Hello, I was hoping to see if
ranef()
is available in any branch (or will be soon) for multilevelstan_surv
objects? The documentation states that it is there but calling it errors out (I'm on rstanarm 2.19.1):In case it's helpful, here's the model formula:
RStanARM Version:
2.19.1
R Version:
3.6.3
Operating System:
OS X 10.14.2