credible-interval

Extract posterior estimate and credible intervals for random effect for lme4 model in R

时光总嘲笑我的痴心妄想 提交于 2021-02-10 12:41:07
问题 I need to extract the posterior estimates and intervals for a random effect from my model. For illustrative purposes, a similar dataset to the one I am using would be the ChickWeight dataset in base R. The way I extract the posterior estimates and intervals for my fixed effects is like so: #load package library(lme4) #model m.surv<-lmer(weight ~ Time + Diet + (1|Chick), data=ChickWeight) #load packages library(MCMCglmm) library(arm) #set up for fixed effects sm.surv<-sim(m.surv) smfixef.surv

Extract posterior estimate and credible intervals for random effect for lme4 model in R

瘦欲@ 提交于 2021-02-10 12:40:00
问题 I need to extract the posterior estimates and intervals for a random effect from my model. For illustrative purposes, a similar dataset to the one I am using would be the ChickWeight dataset in base R. The way I extract the posterior estimates and intervals for my fixed effects is like so: #load package library(lme4) #model m.surv<-lmer(weight ~ Time + Diet + (1|Chick), data=ChickWeight) #load packages library(MCMCglmm) library(arm) #set up for fixed effects sm.surv<-sim(m.surv) smfixef.surv

Bayesian interval of 5 fitted values

落花浮王杯 提交于 2019-12-12 22:04:00
问题 I conducted a Bayesian analysis by running Winbugs from R and derived the fitted values and their Bayesian intervals. Here is the related Winbugs output where mu[i] is the i-th fitted value. node mean 2.5% 97.5% mu[1] 0.7699 0.6661 0.94 mu[2] 0.8293 0.4727 1.022 mu[3] 0.7768 0.4252 0.9707 mu[4] 0.6369 0.4199 0.8254 mu[5] 0.7704 0.5054 1.023 What I want to do is to find the Bayesian interval for the mean of these 5 fitted values. Any idea how? 回答1: The answer of Chris Jackson is correct,

ggplot specify position of vertical segments for categorical x r

独自空忆成欢 提交于 2019-12-11 08:20:49
问题 I am plotting row data and I added a segment of the credible intervals and a black point for the fitted values statistically calculated. My problem is that I would like to have these lines (and the black point) slightly moved (horizontally) respect to the row data. I tried jitter and all the possible combinations of it, the results are terrible because I get the values of y start and end from different columns...hence with jitter the lines are not anymore horizontal. I tried to add a fixed

Highest Density Interval (HDI) for Posterior Distribution Pystan

拈花ヽ惹草 提交于 2019-12-05 07:08:55
问题 I am seeing that in Pystan, an HDI function can be used to provide a 95% credible interval surrounding the posterior distribution. However, they say it will only work for unimodal distributions. If my model may have a multimodal distribution (up to 4 peaks), is there a way I can find the HDI in Pystan? Thanks! 回答1: I wouldn't consider this a Stan/PyStan-specific issue. The Highest Density Interval is by definition a single interval and therefore inappropriate for characterizing multimodal