After optimization Cholesky of Hessian can fail
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
After optimization Cholesky of Hessian can fail. Since this likely due to a numerical inaccuracy, instead of error and fail, it would be better to add some jitter, give a warning and provide a result. When using the coming PSIS diagnostic and correction it doesn't matter if jitter causes extra variation in draws.
Reproducible Steps:
Data in http://www.stat.columbia.edu/~gelman/regression/
earnings_all <- read.csv("Earnings/data","earnings.csv")
earnings_all$positive <- earnings_all$earn > 0
# only non-zero earnings
earnings <- earnings_all[earnings_all$positive, ]
M_1 <- stan_glm(earn ~ height + male, data = earnings, algorithm="optimizing")
Current Output:
Optimization terminated normally:
Convergence detected: relative gradient magnitude is below tolerance
Error in chol.default(-H) :
the leading minor of order 4 is not positive definite
Error in out$theta_tilde[, mark] %*% t(R_inv) :
requires numeric/complex matrix/vector arguments
Expected Output:
Optimization terminated normally:
Convergence detected: relative gradient magnitude is below tolerance
Warning: Hessian is close to a singular (up to to the numerical accuracy). Addded 1-e10 jitter.
RStan Version:
The version of RStan you are running (e.g., from packageVersion("rstan"))
[1] ‘2.17.3’
R Version:
The version of R you are running (e.g., from R.version.string)
[1] "R version 3.4.4 (2018-03-15)"
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 by reproducing the stan_glm(..., algorithm="optimizing") example with the supplied earnings data and inspect the chol.default(-H) failure. Done means the Hessian case produces a warning about jitter and returns a result instead of failing with the matrix error.
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