stan-dev / stan-dev/rstanarm

Latest install of rstanarm stan_surv() fails with random effects.

Open
#588 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
401
Forks
136
PR merge metrics
No merged PRs in 30d

Description

Summary:

I downloaded rstanarm in my usual way and tried to run a stan_surv model with random effects and it errors.

Description:

When I run the example from stan_surv() that includes random I get the error:

Error : Exception: model_surv_namespace::model_surv: V_event[i_0__][i_1__] is 0, but must be greater than or equal to 1  (in 'model_surv' at line 648)

In addition: Warning messages:
1: In status < 0 || status > 3 :
  'length(x) = 40 > 1' in coercion to 'logical(1)'
2: In status < 0 || status > 3 :
  'length(x) = 40 > 1' in coercion to 'logical(1)'
3: In status < 0 || status > 3 :
  'length(x) = 40 > 1' in coercion to 'logical(1)'
4: In status < 0 || status > 3 :
  'length(x) = 40 > 1' in coercion to 'logical(1)'
failed to create the sampler; sampling not done
Error in check_stanfit(stanfit) : 
  Invalid stanfit object produced please report bug
Reproducible Steps:

I download rstanarm by running: git clone -b feature/survival https://github.com/stan-dev/rstanarm.git in the Terminal. I then run devtools::document() and Build the R package locally.

I then ran:

m_frail <- stan_surv(
  formula = Surv(eventtime, status) ~ trt + (1 | site), 
  data    = frail[1:40,], 
  basehaz = "exp", 
  chains  = 1,
  refresh = 0,
  iter    = 600,
  seed    = 123)

And got the error above. Other random effects model also fail.

RStanARM Version:

I am running rstanarm v2.21.3

R Version:

I am running R version v4.2.2

Operating System:

Your operating system (e.g., OS X 13.2.1)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied stan_surv() call with the frail[1:40,] data and random-effects formula. Trace the random-effects path into model_surv around the reported validation error at line 648; done means the example creates a valid fit without the V_event error or status warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.