Skip to content

Commit

Permalink
updated chapter 84
Browse files Browse the repository at this point in the history
  • Loading branch information
winterwang committed Jan 8, 2020
1 parent c02e5b2 commit 58f0532
Show file tree
Hide file tree
Showing 122 changed files with 12,105 additions and 9,164 deletions.
40 changes: 38 additions & 2 deletions 12-Bayesian-stats.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,17 @@ gelman.plot(Simulated)



```{r OpenBUGSPractical04110000, cache=TRUE, message=FALSE, warning=FALSE, echo=FALSE}
```{r OpenBUGSPractical04110000, cache=FALSE, message=FALSE, warning=FALSE, echo=TRUE, eval=FALSE}
Dat <- list(
y = c(1, 3, 6, 8, 11, 15, 17, 19),
n = c(20, 20, 20, 20, 20, 20, 20, 20),
x = c(30, 32, 34, 36, 38, 40, 42, 44),
N = 8
)
inits <- function (){
list (beta0=rnorm(1), beta1=runif(1) )
}
post.jags <- jags(
data = Dat,
inits = inits,
Expand Down Expand Up @@ -2951,7 +2961,33 @@ print(post.jags)
# samplesHistory("beta1", mfrow = c(1,1), ask = FALSE)
```

```
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 2
Total graph size: 53
Initializing model
Inference for Bugs model at "/home/ccwang/Documents/LSHTMlearningnote/backupfiles/logistic-reg-model.txt", fit using jags,
2 chains, each with 502000 iterations (first 2000 discarded)
n.sims = 1000000 iterations saved
mu.vect sd.vect 2.5% 25% 50% 75% 97.5% Rhat n.eff
beta0 -13.892 2.090 -18.257 -15.237 -13.788 -12.449 -10.042 1.001 3900
beta1 0.375 0.056 0.272 0.337 0.373 0.412 0.493 1.001 3100
theta[6] 0.752 0.048 0.652 0.720 0.754 0.786 0.841 1.001 10000
deviance 25.722 2.020 23.760 24.283 25.095 26.499 31.199 1.001 9600
For each parameter, n.eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
DIC info (using the rule, pD = var(deviance)/2)
pD = 2.0 and DIC = 27.8
DIC is an estimate of expected predictive error (lower deviance is better).
```


<!-- ```{r OpenBUGSPractical0413, cache=TRUE, message=TRUE, warning=FALSE, echo=TRUE} -->
Expand Down Expand Up @@ -3285,7 +3321,7 @@ print(post.jags)

所以,藥物每增加劑量1mg,有療效的比值比是OR = 1.46 (95%CrI: 1.31, 1.63)。能夠達到95%患者都有療效的劑量是 45.02 mg (95% CrI: 42.7, 48.2 mg)。如果給予患者藥物劑量爲 35 mg,患者的疼痛能夠得到緩解(有療效)的概率是 32.3% (95% CrI: 22.7%, 42.3%)。跟着看到這裏的你是不是也覺得貝葉斯的結果和過程能夠更加豐富地回答我們想知道的問題呢?

```{r R-OpenBUGSPractical0425, cache=TRUE, fig.width=3.5, fig.height=3, fig.cap='Posterior density plots of ED95, OR, and P35.', fig.align='center', out.width='80%', message=TRUE, warning=FALSE}
```{r R-OpenBUGSPractical0425, cache=TRUE, fig.width=3.5, fig.height=5, fig.cap='Posterior density plots of ED95, OR, and P35.', fig.align='center', out.width='80%', message=TRUE, warning=FALSE}
#### PLOT THE DENSITY and HISTOGRAMS OF THE SAMPLED VALUES
par(mfrow=c(3,1))
Simulated <- coda::as.mcmc(post.jags)
Expand Down
139 changes: 81 additions & 58 deletions docs/ANOVA.html

Large diffs are not rendered by default.

140 changes: 84 additions & 56 deletions docs/Bayes-Definition.html

Large diffs are not rendered by default.

202 changes: 120 additions & 82 deletions docs/CLT.html

Large diffs are not rendered by default.

507 changes: 266 additions & 241 deletions docs/Hierarchical.html

Large diffs are not rendered by default.

724 changes: 375 additions & 349 deletions docs/MC-estimation.html

Large diffs are not rendered by default.

1,235 changes: 757 additions & 478 deletions docs/MCMC-methods.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/author.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/baseline-adjustment-using-ancova.html

Large diffs are not rendered by default.

126 changes: 75 additions & 51 deletions docs/bernoulli.html

Large diffs are not rendered by default.

126 changes: 75 additions & 51 deletions docs/binomial.html

Large diffs are not rendered by default.

Binary file modified docs/bookdown_files/figure-html/06-RobustStatistic-22-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/06-RobustStatistic-24-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/JAGS00-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0402-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0405-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0407-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical040808-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0411-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0412-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0415-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0417-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0418-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/OpenBUGSPractical0419-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/R-OpenBUGS15-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/R-OpenBUGS17-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/bookdown_files/figure-html/R-OpenBUGSPractical0425-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 88 additions & 56 deletions docs/causal-languages-因果推斷的語法.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/causal-mediation-analysis.html

Large diffs are not rendered by default.

138 changes: 83 additions & 55 deletions docs/chi-square-distribution.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/cluster-analysisunsupervised-learning-聚類分析.html

Large diffs are not rendered by default.

125 changes: 74 additions & 51 deletions docs/cox-比例風險模型.html

Large diffs are not rendered by default.

259 changes: 141 additions & 118 deletions docs/crude-and-stratified-rate-ratios.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/further-issues.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/generalized-estimating-equation.html

Large diffs are not rendered by default.

156 changes: 90 additions & 66 deletions docs/graphical-models-因果推斷的圖形模型.html

Large diffs are not rendered by default.

131 changes: 78 additions & 53 deletions docs/index.html

Large diffs are not rendered by default.

155 changes: 89 additions & 66 deletions docs/interaction.html

Large diffs are not rendered by default.

164 changes: 97 additions & 67 deletions docs/intro-Bayes.html

Large diffs are not rendered by default.

132 changes: 79 additions & 53 deletions docs/intro.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

154 changes: 89 additions & 65 deletions docs/likelihood-definition.html

Large diffs are not rendered by default.

215 changes: 120 additions & 95 deletions docs/llr.html

Large diffs are not rendered by default.

216 changes: 120 additions & 96 deletions docs/lm.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/missing-data-1.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/missing-data-2.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/multinomial-logistic-regression.html

Large diffs are not rendered by default.

181 changes: 102 additions & 79 deletions docs/nonparametric.html

Large diffs are not rendered by default.

156 changes: 90 additions & 66 deletions docs/normaldistr.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/ordinal-logistic-regression.html

Large diffs are not rendered by default.

126 changes: 75 additions & 51 deletions docs/poisson.html

Large diffs are not rendered by default.

220 changes: 123 additions & 97 deletions docs/principal-component-analysis-主成分分析.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/profile-log-likelihood.html

Large diffs are not rendered by default.

365 changes: 194 additions & 171 deletions docs/prospensity-score-傾向性評分.html

Large diffs are not rendered by default.

220 changes: 124 additions & 96 deletions docs/quadratic-llr.html

Large diffs are not rendered by default.

256 changes: 140 additions & 116 deletions docs/references.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

151 changes: 92 additions & 59 deletions docs/sample-size.html

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions docs/search_index.json

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/the-sandwich-estimator.html

Large diffs are not rendered by default.

632 changes: 328 additions & 304 deletions docs/不同實驗研究設計時適用的貝葉斯模型.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

131 changes: 76 additions & 55 deletions docs/估計和精確度-estimation-and-precision.html

Large diffs are not rendered by default.

127 changes: 75 additions & 52 deletions docs/信賴區間-confidence-intervals-1.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/假設檢驗.html

Large diffs are not rendered by default.

148 changes: 87 additions & 61 deletions docs/假設檢驗的構建-construction-of-a-hypothesis-test.html

Large diffs are not rendered by default.

141 changes: 85 additions & 56 deletions docs/假設檢驗的近似方法.html

Large diffs are not rendered by default.

1,099 changes: 658 additions & 441 deletions docs/共軛先驗概率-conjugate-priors.html

Large diffs are not rendered by default.

126 changes: 75 additions & 51 deletions docs/再訪-mcmc.html

Large diffs are not rendered by default.

183 changes: 100 additions & 83 deletions docs/分析策略.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/分析策略和模型檢查-model-checking-survival-analysis.html

Large diffs are not rendered by default.

226 changes: 125 additions & 101 deletions docs/前提和數據轉換-assumptions-and-transformations.html

Large diffs are not rendered by default.

212 changes: 120 additions & 92 deletions docs/基於秩次的非參數檢驗.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

161 changes: 97 additions & 64 deletions docs/多元模型分析-multivariable-models.html

Large diffs are not rendered by default.

403 changes: 215 additions & 188 deletions docs/多元模型分析矩陣標記與其意義.html

Large diffs are not rendered by default.

251 changes: 137 additions & 114 deletions docs/廣義線性迴歸入門.html

Large diffs are not rendered by default.

256 changes: 140 additions & 116 deletions docs/建模和模型的檢查.html

Large diffs are not rendered by default.

174 changes: 99 additions & 75 deletions docs/排列置換法-permutation-procedures.html

Large diffs are not rendered by default.

153 changes: 89 additions & 64 deletions docs/探索數據和簡單描述.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/時間事件數據的高級分析法.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

126 changes: 75 additions & 51 deletions docs/期望-expectation-或均值-or-mean-和-方差-variance.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/條件邏輯迴歸-conditional-logistic-regression.html

Large diffs are not rendered by default.

249 changes: 139 additions & 110 deletions docs/模型比較和擬合優度.html

Large diffs are not rendered by default.

371 changes: 197 additions & 174 deletions docs/檢查你的模型-model-checking-glm.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/正態誤差模型-normal-error-models.html

Large diffs are not rendered by default.

141 changes: 84 additions & 57 deletions docs/比較-comparisons.html

Large diffs are not rendered by default.

133 changes: 75 additions & 58 deletions docs/流行病學中的邏輯迴歸.html

Large diffs are not rendered by default.

168 changes: 90 additions & 78 deletions docs/混雜的調整交互作用和模型的可壓縮性.html

Large diffs are not rendered by default.

169 changes: 96 additions & 73 deletions docs/爲什麼我們要用貝葉斯統計學方法.html

Large diffs are not rendered by default.

147 changes: 85 additions & 62 deletions docs/率的廣義線性迴歸-poisson-glm-for-rates.html

Large diffs are not rendered by default.

241 changes: 132 additions & 109 deletions docs/生存分析入門.html

Large diffs are not rendered by default.

127 changes: 75 additions & 52 deletions docs/生存分析的其他手段.html

Large diffs are not rendered by default.

272 changes: 148 additions & 124 deletions docs/生存數據中的回歸模型.html

Large diffs are not rendered by default.

136 changes: 80 additions & 56 deletions docs/相關-association.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/穩健統計方法入門.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/競爭風險模型-competing-risk.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/統計推斷的概念.html

Large diffs are not rendered by default.

131 changes: 77 additions & 54 deletions docs/線性迴歸的模型診斷.html

Large diffs are not rendered by default.

277 changes: 151 additions & 126 deletions docs/縱向研究數據-longitudinal-data-1.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/縱向研究數據-longitudinal-data-2.html

Large diffs are not rendered by default.

184 changes: 104 additions & 80 deletions docs/縱向研究數據-longitudinal-data-3.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/自助重抽法-the-bootstrap.html

Large diffs are not rendered by default.

225 changes: 124 additions & 101 deletions docs/計數型因變量-poisson-regression.html

Large diffs are not rendered by default.

192 changes: 108 additions & 84 deletions docs/評價模型的表現-assessing-model-performance.html

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/貝葉斯和概率論的比較.html

Large diffs are not rendered by default.

546 changes: 287 additions & 259 deletions docs/貝葉斯定理的應用單一參數模型.html

Large diffs are not rendered by default.

273 changes: 147 additions & 126 deletions docs/貝葉斯廣義線性回歸.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

123 changes: 73 additions & 50 deletions docs/貝葉斯生存分析-bayesian-survival-analysis.html

Large diffs are not rendered by default.

214 changes: 123 additions & 91 deletions docs/貝葉斯等級回歸模型.html

Large diffs are not rendered by default.

167 changes: 95 additions & 72 deletions docs/配對實驗數據的分析法.html

Large diffs are not rendered by default.

146 changes: 86 additions & 60 deletions docs/重要概念複習.html

Large diffs are not rendered by default.

337 changes: 179 additions & 158 deletions docs/隨機回歸系數模型-random-coefficient-model.html

Large diffs are not rendered by default.

284 changes: 154 additions & 130 deletions docs/隨機截距模型-random-intercept-model.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages.bib
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,13 @@ @Manual{R-Matrix
note = {R package version 1.2-18},
url = {https://CRAN.R-project.org/package=Matrix},
}
@Manual{R-mcmcplots,
title = {mcmcplots: Create Plots from MCMC Output},
author = {S. McKay Curtis},
year = {2018},
note = {R package version 0.4.3},
url = {https://CRAN.R-project.org/package=mcmcplots},
}
@Manual{R-mstate,
title = {mstate: Data Preparation, Estimation and Prediction in Multi-State
Models},
Expand Down

0 comments on commit 58f0532

Please sign in to comment.