Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slope credible intervals do not cover slope estimate #45

Open
stweb75 opened this issue Feb 12, 2025 · 0 comments
Open

Slope credible intervals do not cover slope estimate #45

stweb75 opened this issue Feb 12, 2025 · 0 comments

Comments

@stweb75
Copy link

stweb75 commented Feb 12, 2025

I have found the slope sign probabilities (slpSgnPosPr ...) easier to interpret than the slope Credible Interval (slpCI).
Nonetheless, the slpCI is often wrong in that the slope estimate (slp) is outside of the CI.

## Example 1; trend only model
library(Rbeast)
data(Nile)
out <- beast(Nile, season="none", dump.ci=TRUE)
plot(out)
# trend CI looks OK
plot(out[[7]][13]$Y, type="l", ylim=c(700,1200))
  lines(out[[7]][15]$CI[,1], lty=3)
  lines(out[[7]][15]$CI[,2], lty=3)
# slope outside slope CI at a few indices 
plot(out[[7]][16]$slp, type="l", ylim=c(-10,10))
  lines(out[[7]][18]$slpCI[,1], lty=3)
  lines(out[[7]][18]$slpCI[,2], lty=3)
which(out[[7]][18]$slpCI[,2] > out[[7]][16]$slp)  
which(out[[7]][18]$slpCI[,1] < out[[7]][16]$slp)'
## Example 2; trend + season model
data(googletrend_beach)
out <- beast(googletrend_beach, dump.ci=TRUE)
plot(out)
# trend CI looks OK
plot(out[[7]][13]$Y, type="l", ylim=c(55,75))
  lines(out[[7]][15]$CI[,1], lty=3)
  lines(out[[7]][15]$CI[,2], lty=3)
# season CI looks OK
plot(out[[8]][13]$Y, type="l", ylim=c(-20,30))
  lines(out[[8]][15]$CI[,1], lty=3)
  lines(out[[8]][15]$CI[,2], lty=3)
# season Y within CI  
which(out[[8]][15]$CI[,2] > out[[8]][13]$Y)  
which(out[[8]][15]$CI[,1] < out[[8]][13]$Y) 
# slope frequently outside slope CI
plot(out[[7]][16]$slp, type="l", ylim=c(-10,10))
  lines(out[[7]][18]$slpCI[,1], lty=3)
  lines(out[[7]][18]$slpCI[,2], lty=3)
which(out[[7]][18]$slpCI[,2] > out[[7]][16]$slp)  
which(out[[7]][18]$slpCI[,1] < out[[7]][16]$slp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant