# Questions tagged [pymc]

PyMC is a Python library for performing Bayesian inference using MCMC. It is a Python equivalent to JAGS and BUGS.

85 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2k views

### PyMC3 implementation of Bayesian MMM: poor posterior inference

Google released a whitepaper on Media Mix Modelling (MMM) in 2017; vanilla MMM (established in the 1960s) uses multivariate regression. It's a decent mechanism to understand which of your marketing ...
• 3,374
512 views

### Bayes Net Parameter Learning in pymc

My goal is to infer the conditional probability tables (CPT) from the classic rain, sprinker, wet grass problem. Normally in this problem we know the CPTs and, given an observation like "the grass is ...
• 360
421 views

### Robust Gamma Regression

I am modeling some spectroscopic data where the response of the instrument to the size of the input is strictly positive and non-linear. Gamma regression seems like a good choice to explain the data, ...
• 223
1k views

### Modelling Time Series of Ratios

I’m having difficulties dealing with a time series of relations between two numbers. I have two time series, essentially a count of "successes" and "trials". What I'm interested in, though, is the ...
1k views

### Bayesian model selection in PyMC

I'm trying to do model selection using PyMC (v2.2), but having difficulty assessing the models using various Information Criteria and/or Bayes Factor. My model is similar to a typical regression, with ...
165 views

### Determining stability in a time series via probabilistic modeling

I recently started to read Probabilistic Programming and Bayesian Methods for Hackers and really got interested in the topic and PyMC. I especially like the example of the first chapter where ...
• 1,174
948 views

### Modeling a Correlated Bivariate Beta Distributions in PyMC3

My goal is to perform a bayesian A/B test of probabilities of success in two groups considering a hypothesis about non-zero covariance between those probabilities. Bivariate beta distribution I am ...
575 views

### LDA implementaion in pymc3

I am implementing LDA with pymc3 using the referred code for pymc from the post Latent Dirichlet Allocation in PyMC I am trying to use it for pymc3 bt having problems defining ...
2k views

### Is this correct hierarchical Bernoulli model?

I have a question about correctness of a model that I used for a fairly simple experiment. I'm not sure if it should go to stackoverflow or crossvalidated, because I feel like my question is both ...
74 views

### Bayesian Survival function

I have managed to estimate the posterior of the latent variables of my model which can be stated as follows (adapted from https://docs.pymc.io/notebooks/bayes_param_survival_pymc3.html): \begin{align} ...
• 1,353
312 views

### Bayesian word2vec

I'm trying to implement word2vec in pymc3 as shown here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/udacity/5_word2vec.ipynb. Now I can implement everything with regards ...
• 1,353
623 views

### Hierarchical modelling - partial pooling with correlation

I am doing a Bayesian regression. I have groups of data $(y_1 ~X_1), (y_2~X_2),...$, where each $y$ and $X$ is a vector. The subscript is regarded as group number. The completely unpooled regression ...
• 758
110 views

### Can I use an unknown number of variables to model my time-series?

I have a bunch of data-sets showing the relationship between two observables, "force" and "time". See example plot You see the regularity of the features: There is a region of linearly increasing ...
• 221
212 views

### Pymc: Does this model call for Index, and if so, how would I use it?

I'm working on speeding up the mcmc for a hierarchical pymc model that is taking .2 seconds per iteration. It's the second model from this paper, modeling a soccer league using team-specific attack ...
• 193
286 views

### Defining constraint on prior with potential class

I have written an MCMC code in order to estimate parameters Xpos, Ypos, MASS and concentration with a set of input data gal_pos, ...
• 117
150 views

### Modelling samples with complex unsure distribution origin using PyMC

I've been learning PyMC for the last couple of days and have been trying to model the following problem: I have got a number of effectors that regulate targets with known values. For some targets the ...
16 views

### Lots of variability in the effective sample size but stable parameter estimates?

I ran 4 chains with NUTS and made a forest plot, but I cannot show the plot here. In words, what I am seeing is the there is a lot of variability in the effective sample size (ESS) in the chains. ...
• 9,452
179 views

### Bayesian meta-analysis: Why and how to weight individual study's contribution to overall effect?

I'm interested in performing a Bayesian meta-analysis, specifically, using a random-effects hierarchical model (as described here). Briefly, in this model we assume that the $k$th study's reported (...
• 43
82 views

### How can one estimate a new λ for a Poisson Distribution after changing circumstances?

To fit the question to a problem lets say you have a store in a mall where the rate of customers visiting the store can be modelled as a Poisson Distribution where λ = 3. Now lets say next month ...
• 41
78 views

### How to Build a Model with Correlation / Statistical Dependency for Bayesian A / B Testing

I use the Beta Binomial model for A/B testing. I wonder if there a way to build a model in PyMC which models correlation between the conversion rate of group A with ...
• 277
41 views

### Unexpected zero on posterior density of Dirichlet process mixture

I was reading this notebook from the PyMC3 documentation about Dirichlet Process Mixtures and, on the last figure, the estimated density reaches almost zero for a particular value, despite the ...
• 2,680
201 views

### Multivariate bayesian parameter estimation

I am implementing an example for pymc3 in python and I want to understand the mathematical formulation of this code. ...
79 views

### How can PyMC3 handle uncertainty in the number of parameters in a Dirichlet Distribution?

I'm taking a look at the following to familiarize myself with Bayesian Inference in PyMC3: https://towardsdatascience.com/estimating-probabilities-with-bayesian-modeling-in-python-7144be007815 In this,...
146 views

### Using information involving multiple model parameters as a prior

I am estimating a relatively simple linear equation of the following form: $$y = \beta_0 + \beta_1p + \beta_2t +\epsilon$$ I would like to take a bayesian modelling approach, and have existing ...
• 121
545 views

### Posterior sampling without using pm.Potential in pyMC3

I'm going through the Price Is Right example in chapter 5 of Probabilistic Programming & Bayesian Methods for Hackers and I have problems understanding the solution. I have tried to change the ...
250 views

### How to interpret forestplot with pymc on standard devisions of two groups

I'm using pyMC3 to do Bayesian estimation supersedes the t test (BEST) and I was wondering how to actually interpret this result. I see both groups have significantly different stds because the bar ...
• 121
56 views

### How to model 100% success probability for one group only in multi-factor model with a Bernoulli variable?

I am currently trying to do a Bayesian analysis of a data set from an experiment I conducted. The setup was something like this: Five participants Three tests, where each test is whether there is a ...
461 views

### Formulating a hierarchical Bayesian model for gambling (Pymc3)

I am quite new to Bayesian modeling and trying to wrap my head around how to choose hyperpriors and formulate the model. I am using Pymc3 My example data is gambling related. People play a 'balloon' ...
• 205
20 views

### Process monitoring: determining number of expected bad widgets in your sample. model set up

Set up: We are testing widgets. If a widget passed testing it moves out of the factory. If it failed we will test it up to 3 times. There are some number of widgets that will never pass even if we ...
60 views

### Learning ranking model leveraging multiple noisy pairwise constraints

I am trying to come up with a probabilistic model that (1) learns a pairwise ranking function (2) and leverage multiple noisy pairwise constraints. My problem setup has two parts: (1) There are $N$ ...
• 2,535
79 views

### MCMC Prior: concave quadratic functions

I am currently running into a problem with MCMC. I am using it to evaluate different amounts of clusters (n_clusters, in [2,300]) of a graph that is varying in time. I want to achieve a clustering ...
• 121
61 views

### Bayesian/Probabilistic Programming with PyMC: Am I doing this right?

I've been playing around with Bayesian / Probabilistic Programming with PyMC and others. I can't find a ton of great practical examples on the web so I created my own problem and tried to solve it. ...
• 121
189 views

### Bayesian A/B-test having trouble converging in PyMC

I'm calculating the estimated improvement of a group over another (in terms of clicks per user). Much like a A/B-test, but I'm using PyMC to be nice and Bayesian about it. This data and code works ...
871 views

### Issue with Categorical distribution in hierarchical modeling with PYMC

I am trying to implement a "hierarchical" model in PYMC in which the membership of observations to groups is not static (similar to the latent assignment of words to topics in Latent Dirichlet ...
• 133
1k views

### pyMC: implementing a joint distribution model

I'm attempting to model a multi-modal distribution that's affected by two separate distributions in pyMC and am having trouble implementing a joint or conditional distribution. Suppose I have N data ...
• 21
317 views

### how to determine if two dice are fair using pymc and roll data

My scenario is that I have two six-sided dice (D1 and D2), either of which may be fair or loaded (biased). I have samples of combined roll data (i.e. D1 + D2). I would like to view the posterior ...
632 views

### PyMC Robust Linear Regression with Measured Uncertainties

I posted this same question on Stack Overflow. I use least squares regression of data with measured errors in both x and y and use the reduced chi-square (mean square weighted deviation: mswd) as a ...
458 views

### How to implement multiple GP submodels in PYMC

I'm hoping someone can give me some guidance on implementing Gaussian processes (GP) with PYMC. In particular, I'm not sure how to use multiple GP submodels properly within a single pymc model. More ...
1 vote
96 views

### A Bayesian marginal structural model (IPW) in a single model

Inspired by Richard McElreath's "Full Luxury Bayes" in his Statistical Rethinking course, I wanted to implement a "Full Luxury Bayesian Marginal Structural Model". Briefly: MSMs ...
• 151
1 vote
164 views

### Modeling with count data as predictors and continuous as outcome variable (Bayesian)

Disclaimer: This is a long explanation but I feel like it was needed to give a thorough description of my problem. Let me know if this question is in the wrong place. I am relatively new to Bayesian ...
• 31
1 vote
117 views

### Uncertainty/Error Estimates from RMSE and Confusion Matrix

Would it be advisable to use the F1 score as an 'error', to represent both omission and commission error rates in this areal masking process? Would it be advisable to treat the RMSE and F1 as standard ...
• 121
1 vote
337 views

### Hierarchical Bayesian modeling with count data (PYMC): how to specify this model?

I'm completely new to Bayesian statistics and tried to get a grasp of the fundamentals for a specific case I'm working on. However, I feel like I've led myself down a blind alley and I'm still ...
• 31
1 vote
2k views

### How to generate posterior predictive samples with size different than the observed variable in pymc3?

I have a simple probabilistic model with Beta prior and Bernoulli likelihood: ...
• 123
1 vote
65 views

### How does pymc3 posterior simulation work in this simple case without having the full conditional distributions?

I'm trying to estimate the posterior distribution of the gamma parameters alpha and beta given that my data comes from a gamma distribution and the priors I chose come from two uniform distributions. ...
1 vote
82 views

### How to measure the terminal conversion rate of a population using Bayesian updating

I have a time-lagged, multi-step conversion funnel. For simplicity, lets assume it looks like this: Lead submit ----> Lead contact ----> Lead convert Where ...
1 vote
348 views

### Using a hierarchical model (on pymc3) to compute credible intervals for dependent proportions

I have a dataset composed of 2 conditions, each condition consists of 3 samples, each sample subdivided into different categories. I would like to compute 95% credible intervals for the proportions of ...
• 1,247
1 vote
189 views

### How to interpret posterior 'sd' term in GLM regression in pymc3

I made a linear regression model to predict hospitalizations given health comorbidities (heart failure, cancer, COPD, etc) as below using pymc3: ...
• 171
1 vote