mcmc

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

pymc with observations on multiple variables

左心房为你撑大大i 提交于 2021-01-28 08:25:50
问题 I'm using an example of linear regression from bayesian methods for hackers but having trouble expanding it to my usage. I have observations on a random variable, an assumed distribution on that random variable, and finally another assumed distribution on that random variable for which I have observations. How I have tried to model it is with intermediate distributions on a and b , but it complains Wrong number of dimensions: expected 0, got 1 with shape (788,). To describe the actual model,

MCMCglmm ordinal model in R

可紊 提交于 2020-03-05 06:05:51
问题 I'm trying to explain changes in tree vitality from 1 to 3 (1=green, 2=damage, 3=dry) using climatic variables in an MCMCglmm model. Unfortunately, I am struggling with two questions: 1. How do I interpret the summary of the MCMCglmm model? I see which variables are significant, but what does it mean? Does this mean that with increasing precipitation the vitality gets to 1 (green)? I plotted the posterior means of the model and looks like precipitation and diameter have no influence on the

MCMCglmm ordinal model in R

 ̄綄美尐妖づ 提交于 2020-03-05 06:05:43
问题 I'm trying to explain changes in tree vitality from 1 to 3 (1=green, 2=damage, 3=dry) using climatic variables in an MCMCglmm model. Unfortunately, I am struggling with two questions: 1. How do I interpret the summary of the MCMCglmm model? I see which variables are significant, but what does it mean? Does this mean that with increasing precipitation the vitality gets to 1 (green)? I plotted the posterior means of the model and looks like precipitation and diameter have no influence on the

Multivariate linear regression in pymc3

自古美人都是妖i 提交于 2020-02-01 09:03:12
问题 I've recently started learning pymc3 after exclusively using emcee for ages and I'm running into some conceptual problems. I'm practising with Chapter 7 of Hogg's Fitting a model to data. This involves a mcmc fit to a straight line with arbitrary 2d uncertainties. I've accomplished this quite easily in emcee , but pymc is giving me some problems. It essentially boils down to using a multivariate gaussian likelihood. Here is what I have so far. from pymc3 import * import numpy as np import

Simple Dynamical Model in PyMC3

試著忘記壹切 提交于 2020-01-12 10:20:13
问题 I'm trying to put together a model of a dynamical system in PyMC3, to infer two parameters. The model is the basic SIR, commonly used in epidemiology : dS/dt = - r0 * g * S * I dI/dt = g * I ( r * S - 1 ) where r0 and g are parameters to be inferred. So far, I'm unable to get very far at all. The only examples I've seen of putting together a Markov chain like this yields errors about recursion being too deep. Here's my example code. # Time t = np.linspace(0, 8, 200) # Simulated observation

PyMC: How can I describe a state space model?

夙愿已清 提交于 2020-01-05 12:12:26
问题 I used to code my MCMC using C. But I'd like to give PyMC a try. Suppose X_n is the underlying state whose dynamics following a Markov chain and Y_n is the observed data. In particular, Y_n has Poisson distribution with mean depending on X_n and a multidimensional unknown parameter theta X_n | X_{n-1} has distribution depending on theta How should I describe this model using PyMC? Another question: I can find conjugate priors for theta but not for X_n. Is it possible to specify which

PyMC: How can I describe a state space model?

▼魔方 西西 提交于 2020-01-05 12:12:24
问题 I used to code my MCMC using C. But I'd like to give PyMC a try. Suppose X_n is the underlying state whose dynamics following a Markov chain and Y_n is the observed data. In particular, Y_n has Poisson distribution with mean depending on X_n and a multidimensional unknown parameter theta X_n | X_{n-1} has distribution depending on theta How should I describe this model using PyMC? Another question: I can find conjugate priors for theta but not for X_n. Is it possible to specify which