Skip to main content

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
16 views

PyMC model from aggregated data

I am starting with probabilistic programming and PyMC and seems that stuck with the first step. I am trying to figure out something very simple and then add complexity. Appreciate if you can help me ...
irriss's user avatar
  • 121
0 votes
0 answers
30 views

Negative Binomial GLM - Overflow in the link function

I am trying to create a GLM to model some count data. I am using the pymc package in python. The set up is what I believe to be the usual set up: $$Y \sim NB(\mu,k) $$ $$E(Y\vert\mathbf{X}) = \mu $$ $$...
TNoms's user avatar
  • 95
0 votes
0 answers
21 views

Sampling from large Bayesian network of particular form

I want to know whether there is an efficient way of sampling from this special kind of Bayesian networks of the following form (like thousands or millions of variables in principle). Here is a picture ...
swish's user avatar
  • 135
0 votes
0 answers
19 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
  • 153
0 votes
0 answers
64 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
51 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
259 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
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. ...
Galen's user avatar
  • 9,411
2 votes
0 answers
174 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
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 ...
ehudk's user avatar
  • 151
6 votes
1 answer
523 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
  • 9,411
2 votes
1 answer
655 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
402 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
171 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
  • 3,382
0 votes
0 answers
64 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
160 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
115 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
609 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
  • 243
1 vote
0 answers
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 ...
KBoghe's user avatar
  • 31
0 votes
1 answer
209 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
133 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
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 ...
MK1300's user avatar
  • 41
2 votes
1 answer
89 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
  • 3,382
0 votes
0 answers
40 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
3 votes
2 answers
729 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
  • 310
2 votes
1 answer
155 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
  • 103
2 votes
1 answer
319 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
  • 103
2 votes
1 answer
3k 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
  • 103
1 vote
1 answer
127 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
2k 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
207 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
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 ...
Mark's user avatar
  • 277
2 votes
1 answer
183 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
  • 3,382
0 votes
0 answers
113 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
75 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
273 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
229 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
  • 3,382
0 votes
0 answers
89 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
  • 3,382
3 votes
3 answers
723 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
750 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
  • 3,382
9 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
  • 3,382
2 votes
1 answer
1k 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
  • 3,382
3 votes
1 answer
422 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
  • 3,382
2 votes
0 answers
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 ...
PedroSebe's user avatar
  • 2,680
2 votes
0 answers
200 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
285 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
  • 225
3 votes
1 answer
135 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 ...
John Kemeny's user avatar
2 votes
0 answers
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,...
MurderOfCrows's user avatar
1 vote
1 answer
722 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
2 3 4 5 6