Questions tagged [pymc]
PyMC is a Python library for performing Bayesian inference using MCMC. It is a Python equivalent to JAGS and BUGS.
264
questions
0
votes
0
answers
12
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 ...
3
votes
1
answer
32
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
1
answer
48
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
12
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. ...
2
votes
0
answers
114
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 (...
1
vote
0
answers
59
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 ...
5
votes
1
answer
270
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 ...
2
votes
1
answer
373
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 ...
2
votes
2
answers
249
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. ...
2
votes
1
answer
136
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
41
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
...
0
votes
0
answers
87
views
Imputing/predicting all missing x and y values with pymc
I am having difficulty understanding how to impute x values with pymc where x values are missing while simultaneously using the model to predict missing y values. In previous situations using pymc, ...
0
votes
0
answers
136
views
Nesting Priors within Gaussian Process Model in PyMC
I'm new to Gaussian Processes, and I have some questions about the model.
I understand that when using GPs for regression, GPs are a prior distribution of a set of functions on some unknown regressive ...
1
vote
0
answers
81
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 ...
1
vote
0
answers
101
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
319
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
275
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
119
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
104
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 ...
2
votes
0
answers
70
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
82
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
31
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 ...
2
votes
2
answers
526
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 ...
1
vote
1
answer
128
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
241
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 ...
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/...
1
vote
1
answer
119
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 ...
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/...
0
votes
0
answers
188
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:
...
2
votes
0
answers
74
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 ...
2
votes
1
answer
152
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 ...
0
votes
0
answers
89
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
71
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
244
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:
...
2
votes
1
answer
185
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 ...
0
votes
0
answers
77
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 ...
3
votes
3
answers
620
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 ...
1
vote
2
answers
695
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 ...
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 ...
2
votes
1
answer
836
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 ...
3
votes
1
answer
387
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 ...
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 ...
2
votes
0
answers
177
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.
...
0
votes
1
answer
260
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 ...
3
votes
1
answer
125
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 ...
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,...
1
vote
1
answer
590
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 ...
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.
...