Questions tagged [pymc]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
272 views

pymc3: Updating the standard error prior

I am estimating a Bayesian multiple regression using continuous data on both the dependent variable and the regressors. My goal is to iteratively estimate the coefficient distributions as more data ...
0 votes
1 answer
831 views

Comparing top level group effects using a 3-level hierarchical regression

I would like to detect group effects (if any) along with statistical confidences. I have a hierarchical data set structured as follows: Drug Groups ...
0 votes
0 answers
9 views

Statistical Integration of Bayesian and Frequentist Approaches: Weighing Methodology

I'm uncertain about where to post this question. I'm currently working with geotechnical data (soil parameters) and aiming to obtain realistic and safer parameter values. To achieve this goal, I've ...
7 votes
2 answers
6k views

Bayesian recurrent neural network with keras and pymc3/edward

I have a very simple toy recurrent neural network implemented in keras which, given an input of N integers will return their mean value. I would like to be able to modify this to a bayesian neural ...
0 votes
0 answers
34 views

How to take a negative ranged prior using pymc package?

I was trying to fit bayesian linear regression using pymc package. But for certain model coefficients I need to choose the prior as a negative ranged distribution (for example negative halfnormal) so ...
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 ...
3 votes
1 answer
35 views

Estimating posterior of proportion of positives in population from per-observation probabilities

I have a sample from some population of 0s and 1s and need to estimate the posterior of the proportion of 1s in this population. But the catch is: for each observation in the sample I only have ...
2 votes
2 answers
590 views

A hierarchical Bayesian model in pymc3 [closed]

Suppose we have the following model: $X$ unobserved $Y$ such that $Y|X \sim \mathcal{N}(X,\sigma^2)$, observed $Z$ such that $Z|X \sim \mathcal{B}(1,X)$, observed and suppose, given observed data $...
2 votes
1 answer
91 views

Why do we need to scale the variables in a Bayesian model?

In a Bayesian MMM model using pymc3 the variables are scaled. It is said that scaling helps in improving the efficiency of the MCMC algorithm. Also, it is stated that setting priors for the non-scaled ...
2 votes
0 answers
15 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. ...
13 votes
2 answers
10k views

What is pm.Potential in PyMC3?

I'm going through the Price Is Right example in chapter 5 of Probabilistic Programming & Bayesian Methods for Hackers. It reads: Example: Optimizing for the Showcase on The Price is Right ...
2 votes
2 answers
302 views

Reason behind only using internal knots when defining basis splines

In the spline regression tutorials of pymc and bambi they first define the knots using quantiles, but for building the design matrix they don't use the boundary knots and only keep the internal knots. ...
3 votes
1 answer
3k views

Metropolis-Hastings acceptance rate confusion

I ran a Bayesian model that have about 2700 parameters. Among these parameters, Adaptive Metropolis algorithm was implemented to estimate ~790 parameters in the I-group and Metropolis algorithm was ...
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 (...
2 votes
2 answers
2k views

Good non-informative priors for estimating the parameters of a Gaussian with MCMC (using PyMC)?

Say I want to estimate the mean $\mu \in [0, 10] $ of some Gaussian data $\mathbf{x}$ with known variance $\sigma^2 = 1$ using MCMC. Usually I'd use a prior like $\mu \sim \mathrm{Uniform}(0, 10)$ and ...
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 ...
0 votes
0 answers
11 views

Same relative spread of posterior means in Bayesian Linear Regression

I'm doing a Bayesian Linear Regression based on some marketing data, and pretty much following the tutorial outlined here. To summarise: I aim to predict revenue based on a bunch of different ...
2 votes
1 answer
472 views

Bayesian regression confidence intervals with Pymc3

This question is based on question 1 of the week 2 Statistical Rethinking problems, i.e. q1 here: https://github.com/rmcelreath/stat_rethinking_2022/blob/main/homework/week02.pdf I have a pandas data ...
5 votes
1 answer
348 views

How to interpret rank bar plot of a MCMC trace?

I am learning how to use PyMC for Bayesian inference. I coded up a random intercept $Y = \gamma + \sum_{j=1}^3 \beta_j \mathbb{I}_j + \epsilon$ and looked at the trace plots. Here is a ...
1 vote
0 answers
106 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 ...
2 votes
1 answer
143 views

PyMC3 Beta-Binomial fails to converge on actual parameter values

Something is not performing as expected with PyMC. I'm trying a simple Beta-Binomial conjugate prior model, trying to recover known parameters. Control data ...
0 votes
0 answers
51 views

Need help explaining Bayesian p-value plot

I'm working through Chapter 2 of BMCP and am having trouble understanding why the plot of a Bayesian p-value looks so unexpectedly "spiky" or multimodal. Here's my code ...
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 ...
1 vote
2 answers
211 views

Using Co-variates in Item Response Theory 3PL model?

I am using Item Response theory(IRT) using 3 Parameter Logistic Model(3PL) for Logic test. After training the model, I use the posterior means of the item parameters 𝛼, β and γ to estimate person ...
1 vote
0 answers
105 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 ...
2 votes
1 answer
425 views

Interpret plot_trace from PYMC

New to Bayesian Modeling and the python library PYMC. Got some confusing result. How would an expert on Bayesian modeling interpret these graphs? ...
1 vote
0 answers
306 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 ...
0 votes
1 answer
154 views

Interpreting posterior with Half-Normal shape

I am building a Marketing Mix Model in PyMC and am not sure how to interpret the posteriors, especially those with half-normal priors (sigma=1). I’ve chosen this prior because media could not have a ...
1 vote
0 answers
111 views

JAGS model to PyMC [closed]

I'm trying to translate a code that I have written in JAGS to PyMC but I'm getting stuck due to the recursion in the JAGS code that I can't figure out how to pass it to PyMC. The model in JAGS is ...
1 vote
1 answer
2k views

Pymc3 SamplingError: Initial evaluation of model at starting point failed

I am working on a Bayesian Cox Proportional Hazard model. I've started by implementing and running the Bayesian CPH example at https://docs.pymc.io/en/stable/pymc-examples/examples/survival_analysis/...
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 ...
2 votes
1 answer
87 views

Why is off-centered prior necessary for HMC sampler?

In this PyMC3 tutorial on Bayesian Mixed Effects Models, there is some Re-parameterization "to avoid chain divergences." ...
0 votes
0 answers
36 views

How to deal with low survey response rate and hypothetical question about influence of people not responding?

Background: Imagine you are running a survey, asking 1000 random people: "do you like blue marbles?" Now, 200 people respond. 150 say yes, 50 say no. If I had only sent that survey to only ...
1 vote
1 answer
140 views

Counterfactual Bayesian survival analysis in pymc

I am trying to determine mortality rates for untreated patients from an observational dataset where treatment has occurred (thus blocking the possibility of further untreated mortality). You can't ...
1 vote
1 answer
262 views

Weibull Proportional Hazard in pymc

I’m looking to create a Bayesian proportional hazard model where the baseline hazard is modeled by a Weibull distribution (or some similar continuous distribution). I’ve reviewed (and implemented) the ...
2 votes
2 answers
596 views

What type of prior to choose for one-hot encoded (dummy coded) variables in Bayesian logistic regression?

I'm going through Rethinking and Kruschke's Puppy book. After the examples I want to try myself with other data and have a problem. What if (unlike the examples in the book and online) categorical ...
4 votes
2 answers
1k views

Relationship between laplace and l1 regularization

It is well known that an L1 regularized linear regression is equivalent to a regression with a Laplace prior on the distribution of the coefficients. This is explained here: https://bjlkeng.github.io/...
1 vote
1 answer
124 views

Posterior distributions --- what's the correct way to see it?

When running models from a bayesian perspective — a regression for example — we get posterior distribution for every parameter/statistic we want, right? I’m wondering whether I should see this this ...
0 votes
0 answers
196 views

Mass matrix error with degree of freedom and scale parameters of Student T distribution?

I have been working using the following codes to acquire the Bayesian Fusion of StudentT distribution. Fusion code: ...
4 votes
0 answers
918 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 ...
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 ...
1 vote
2 answers
715 views

Why do Pareto/NBD models require custom likelihood functions in PyMC3 and Stan?

I'm interested in Bayesian modeling of customer lifetime value (CLV), preferably via PyMC3. I've found that research in this area started mid-to-late 1900's and has remained active since. It would ...
2 votes
1 answer
165 views

Inconsistent posterior estimates in Beta-Binomial likelihood vs Binomial in Bayesian, multilevel models?

In this Google Colab, I've simulated Binomial count data and compared the performance of Binomial-likelihood and Beta-Binomial-likelihood models. Both models have the same Beta prior on theta, the ...
1 vote
1 answer
229 views

Using pymc to solve the simple cancer problem

(Example of the cancer problem that I'm thinking of: http://www.yudkowsky.net/rational/bayes). I'm attempting to understand how to apply pymc in different circumstances. I was trying to solve the ...
3 votes
1 answer
1k views

Why use MCMC sampling when using conjugate priors?

I've been getting to grips with some Bayesian modelling, but one thing is confusing the heck out of me when I look at tutorials and worked-through problems online. I'm looking at a problem with a ...
0 votes
0 answers
92 views

Bayesian regression for the sum of Gaussians

I'm pretty new to Bayesian statistics and I want to use Bayesian regression on a 2D data set (frequency on x-axis and measurement data on the y-axis) to quantify the uncertainties. The model is a ...
0 votes
1 answer
73 views

How can we attribute observations to observers in a hierarchical Bayesian model?

I am trying to make a hierarchical Bayesian model of latent variables based on many observations by noisy oracles. I want to leverage the information of which observations are from which oracles, as I ...
1 vote
1 answer
303 views

Handling overflow warnings in pymc [closed]

Abstract I am getting numerical overflow warnings in pymc that are stalling the sampler. I'll first specify what the context is then ask more directed questions about the solution. The context ...
1 vote
1 answer
255 views

Observation dependency in pymc3 models

I have a model, which can be simplified conceptually to: $$ a \sim TruncNormal(\mu = 1.0, \sigma=0.01, min = 0.9, max = 1.1)$$ $$y = a \cdot sin(b) $$ I can make observations about $y$, but these ...
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: ...

1
2 3 4 5 6