stan_surv — Rearranging the data produces different results
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 401
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
Summary:
stan_surv produces different results after rearranging (sorting) the observations despite using the same seed.
Description:
As per the summary. With the example data below, this issue happens with basehaz = "weibull" or basehaz = "bs", but not with basehaz = "exp" or basehaz = "weibull-aft".
Reproducible example:
library(survival)
library(rstanarm)
data(mgus)
surv <- stan_surv(Surv(futime, death) ~ mspike,
data = mgus,
basehaz = "weibull",
chains = 1,
seed = 1234)
mgus_order <- mgus[order(mgus$mspike), ]
surv_order <- stan_surv(Surv(futime, death) ~ mspike,
data = mgus_order,
basehaz = "weibull",
chains = 1,
seed = 1234)
all.equal(as.matrix(surv), as.matrix(surv_order))
summary(surv, digits = 5)
summary(surv_order, digits = 5)
Relevant output from the last two summary functions
Estimates:
mean sd 10% 50% 90%
(Intercept) -10.16572 0.64438 -10.98888 -10.15258 -9.35997
mspike -0.11383 0.16630 -0.33068 -0.12206 0.09692
weibull-shape 1.19092 0.06669 1.10818 1.18821 1.27728
Estimates:
mean sd 10% 50% 90%
(Intercept) -10.16413 0.69352 -11.03953 -10.13223 -9.30872
mspike -0.11555 0.16577 -0.32517 -0.12085 0.11076
weibull-shape 1.19101 0.07182 1.09859 1.19006 1.28189
RStanARM Version:
2.21.2
R Version:
3.6.3
Operating System:
macOS 10.14.6
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the stan_surv entry point and reproduce the example using the mgus data, comparing the original and sorted observations with basehaz="weibull" and "bs". Check that identical seeds produce equivalent results after sorting, while preserving the behavior reported for "exp" and "weibull-aft".
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