Questions tagged [pymc]

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

83 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
1 answer
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 ...
jbuddy_13's user avatar
  • 2,501
8 votes
0 answers
501 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 ...
cwharland's user avatar
  • 360
7 votes
0 answers
389 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, ...
udushu's user avatar
  • 223
6 votes
1 answer
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 ...
Daniel Liberali's user avatar
5 votes
0 answers
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 ...
Roger Stuckey's user avatar
5 votes
0 answers
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 ...
fsociety's user avatar
  • 1,144
4 votes
0 answers
917 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 ...
Valery Kustov's user avatar
4 votes
0 answers
569 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 ...
Anil Gaddam's user avatar
4 votes
0 answers
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 ...
Dmitry Smirnov's user avatar
3 votes
0 answers
72 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} ...
sachinruk's user avatar
  • 1,353
3 votes
0 answers
306 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 ...
sachinruk's user avatar
  • 1,353
3 votes
0 answers
618 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 ...
Tom Bennett's user avatar
3 votes
0 answers
109 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 ...
KPLauritzen's user avatar
3 votes
0 answers
209 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 ...
Dan's user avatar
  • 173
3 votes
0 answers
285 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, ...
Dalek's user avatar
  • 115
3 votes
0 answers
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 ...
Michael Schubert's user avatar
2 votes
0 answers
14 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. ...
Galen's user avatar
  • 7,128
2 votes
0 answers
136 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 (...
hyoda's user avatar
  • 43
2 votes
0 answers
78 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 ...
MK1300's user avatar
  • 41
2 votes
0 answers
77 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 ...
Mark's user avatar
  • 277
2 votes
0 answers
39 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 ...
PedroSebe's user avatar
  • 2,663
2 votes
0 answers
187 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. ...
MachineLearner's user avatar
2 votes
0 answers
75 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,...
MurderOfCrows's user avatar
2 votes
0 answers
142 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 ...
Anthonydouc's user avatar
2 votes
0 answers
538 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 ...
ImScientist's user avatar
2 votes
0 answers
241 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 ...
user3368526's user avatar
2 votes
0 answers
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 ...
Aditya Bhargava's user avatar
2 votes
0 answers
444 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' ...
tmo's user avatar
  • 205
2 votes
0 answers
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 ...
njBernstein's user avatar
2 votes
0 answers
59 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$ ...
Vladislavs Dovgalecs's user avatar
2 votes
0 answers
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 ...
thierry's user avatar
  • 121
2 votes
0 answers
60 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. ...
Mike's user avatar
  • 21
2 votes
0 answers
188 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 ...
cowboyvspirate's user avatar
2 votes
0 answers
855 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 ...
Shobhit's user avatar
  • 133
2 votes
0 answers
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 ...
marekc's user avatar
  • 21
2 votes
0 answers
311 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 ...
trianta2's user avatar
  • 159
2 votes
0 answers
625 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 ...
srmulcahy's user avatar
2 votes
0 answers
457 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 ...
user22396's user avatar
1 vote
0 answers
65 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 ...
ehudk's user avatar
  • 141
1 vote
0 answers
104 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 ...
jb505's user avatar
  • 31
1 vote
0 answers
104 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 ...
dgketchum's user avatar
  • 121
1 vote
0 answers
303 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 ...
KBoghe's user avatar
  • 31
1 vote
0 answers
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: ...
Algo's user avatar
  • 123
1 vote
0 answers
63 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. ...
inginging's user avatar
1 vote
0 answers
81 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 ...
user2395059's user avatar
1 vote
0 answers
332 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 ...
gc5's user avatar
  • 1,207
1 vote
0 answers
186 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: ...
user3058197's user avatar
1 vote
0 answers
170 views

Implementation of an integral formula for an a posteriori estimate in pymc3

I am trying to fit a model according to some data. The data I have are supposed to obey the following formula: $$\mu_g(t) = (\mu_0 + \frac{\alpha_g}{\delta_g})\exp(-\delta_g t) + \frac{\alpha_g}{\...
bela83's user avatar
  • 111
1 vote
0 answers
408 views

Bayesian fitting with very noisy data

I am trying to fit a response curve through noisy data. The curve is supposed to model a saturating return, which takes the analytical form: $$ x \to y(x) = \alpha( 1- e^{-\frac{x}{\beta}})$$ where $...
Learning is a mess's user avatar
1 vote
0 answers
123 views

What would be a good sampler from pymc3 for highly skewed data

I have a gamma distributed data which is highly skewed - alpha=0.15, beta=0.001. I would like to perform mcmc to find the delta between two gamma distributions. I get the following error: I suspect ...
yprei's user avatar
  • 11