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
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 ...
JCV's user avatar
  • 123
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 ...
T_S's user avatar
  • 21
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 ...
nikoliazekter's user avatar
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 ...
T_S's user avatar
  • 21
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. ...
Galen's user avatar
  • 7,168
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
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
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 ...
Readler's user avatar
  • 151
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 ...
Galen's user avatar
  • 7,168
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 ...
Azamat Bagatov's user avatar
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. ...
CuriousKernel's user avatar
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 ...
jbuddy_13's user avatar
  • 2,507
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 ...
Jerry's user avatar
  • 176
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 ...
jb505's user avatar
  • 31
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 ...
dgketchum's user avatar
  • 121
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? ...
Henri's user avatar
  • 233
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 ...
KBoghe's user avatar
  • 31
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 ...
arcodey's user avatar
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 ...
Alejandro Andrade's user avatar
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
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." ...
jbuddy_13's user avatar
  • 2,507
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 ...
Luxspes's user avatar
  • 301
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 ...
Oliver's user avatar
  • 290
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 ...
Mike's user avatar
  • 73
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 ...
Mike's user avatar
  • 73
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/...
Mike's user avatar
  • 73
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 ...
Nip's user avatar
  • 561
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/...
Oren Matar's user avatar
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: ...
WDpad159's user avatar
  • 101
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
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 ...
jbuddy_13's user avatar
  • 2,507
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 ...
leo31's user avatar
  • 1
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 ...
NealJMD's user avatar
  • 101
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 ...
50k4's user avatar
  • 113
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
2 votes
1 answer
206 views

Explanation of differential equation solution in survival analysis proof

I follow all the steps in the below derivation until the third to last line, "solving this differential equation for the survival analysis function shows that..." Questions I never took ...
jbuddy_13's user avatar
  • 2,507
0 votes
0 answers
84 views

How are differential equations and stochastic differential equations different?

In the simplest terms, how are differential equations and stochastic differential equations different? As far as I can tell, SDEs are PDEs or ODEs, where the derivative of some function wrt itself is ...
jbuddy_13's user avatar
  • 2,507
3 votes
3 answers
668 views

difference of means of non-normal data using Bayesian model

I have two distributions, group 'c1' and 'c2' that are not normally distributed, but rather log-normal: Now, I'd like to compare the means between 'c1' and 'c2' using bayesian methods, as described ...
hadron's user avatar
  • 131
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 ...
jbuddy_13's user avatar
  • 2,507
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,507
2 votes
1 answer
907 views

Meaning of design matrix in context of Bayesian B-Spline regression?

I'm learning about modeling B-Splines using PyMC3. The design matrix of splines (apparently) can become quite complicated, so it's easier to delegate this construction to an API, Patsy. In the context ...
jbuddy_13's user avatar
  • 2,507
3 votes
1 answer
404 views

Spline regression via PyMC3

I've looked through PyMC3 documentation and haven't seen any tutorials/resources on learning to use Splines w/ PyMC3. Could anyone recommend a resource? I see that Stan tutorials are available. I ...
jbuddy_13's user avatar
  • 2,507
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
0 votes
1 answer
270 views

Confused about the necessity of multplying the covariance function by a scaling factor in Gaussian Process modeling

I was reviewing examples of implementing GP-based model with PyMC3. I noticed some examples will multiply the covairance function by a factor, which is in turn modeled as a random variable, while ...
victorx's user avatar
  • 215
3 votes
1 answer
131 views

Estimating the number of apples in an apple tree using MCMC

I'm trying to estimate the number of apples in an apple tree by repeatedly kicking the tree and counting how many apples fall down. This process, I believe, is called removal sampling. The only ...
Pål GD's user avatar
  • 87
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
1 vote
1 answer
636 views

Sequential updating in Bayesian Inference - pymc3

I am trying to implement the following research paper in pymc3 - https://people.ok.ubc.ca/pgill/research/cricketsim.pdf. In short, this research paper tries to model cricket matches and simulate the ...
SinByCos's user avatar
  • 113
1 vote
0 answers
64 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
0 votes
0 answers
46 views

Combination of bayesian models in pymc3

Simplified problem is: I noted down peoples’ physiological parameters (age, BMI, resting heart rate, etc.) and asked them to perform exercises. From that I measured their HRmax and how well they ...
Andrey's user avatar
  • 1

1
2 3 4 5 6