511 questions
0
votes
0
answers
47
views
How to display a single deterministic output of a Bayesian regression model using ArviZ
Let’s say I have a dataset of X and Y with 100 observations from each. I developed a Bayesian simple linear regression model from X to Y, using PyMC, like this:
Y = Alpha + Beta * X + Epsilon
As you ...
1
vote
1
answer
283
views
How to use PyMC, PyMC-Marketing, and NumPyro together when they require conflicting JAX versions?
I’m trying to build a probabilistic model in Python that requires using PyMC, PyMC-Marketing, and NumPyro in the same script.
My environment: Python 3.12, Windows 64-bit
Installed packages:
pymc (...
1
vote
0
answers
64
views
How can I fix model parametrization for truncated normal distribution in pymc?
I am trying to setup a Bayesian metanalysis of report rates of events. My target estimate is the probability that participants will report X in each study. Every participant provides ~20-40 response, ...
0
votes
1
answer
184
views
Pytensor compilation failed during linking stage on macOS
When trying to run a simple PyMC example on ARM macOS 15.4 using a fresh conda-forge conda-environment the run fails with a compilation error: pytensor.link.c.exceptions.CompileError: Compilation ...
1
vote
0
answers
33
views
Time dependant ODE parameters / varaibles in PyMC and Sunode
I have an ODE function ode(y,t,theta, influent) where influent is an array of values at different times (experimental data for input to system).
I have this in my main ode function (not as important):
...
1
vote
1
answer
144
views
Use Bayesian PyMC linear model on out-of-sample data
I am trying to fit a linear model to data using Bayesian inference technique. For this, I thought of using PyMC. Naturally, after training a model, I want to test its performance on new data and that'...
0
votes
1
answer
59
views
Predictions of coupled PyMC linear bayesian models for new inputs
I would like to model two observables, O_2 and O_3 using bayesian linear regression: O_2 ~ m_2 * O_1 + q_2 and O_3 ~ m_3 * O_2 + q_3. I would like to couple them via O_2. I am using the PyMC framework ...
1
vote
1
answer
74
views
Unable to get DiscreteMarkovChain to work in PyMC
I am trying to fit a two-state regime-switching model using PyMC.
The full model is given below.
The exact details of the model are not important (if you're curious anyways, I'm trying to fit a ...
0
votes
1
answer
297
views
Pymc TypeErorr: RandomVariable.make_node() got an unexpected keyword argument 'sd'
i hope you are having a better day than i do. I am developing a project that is due within a week and the codebase that i am working on is no longer working. It was working completely fine a month ago ...
1
vote
0
answers
103
views
Databricks notebook cell gets hung up but code completes
Have been running into an issue when running a pymc-marketing model in a Databricks notebook. The cell that fits the model gets hung up and the progress bar stops moving, however the code completes ...
1
vote
0
answers
338
views
Fail when trying to sample model from PyMC
I'm learning about Bayesian modeling and PyMC, and I'm trying to build my first model. I have structured my model as follows:
with pm.Model(coords={"obs_id": range(len(df))}) as model:
p ...
1
vote
0
answers
50
views
How to pass deterministic variables and observtions to pymc.Metropolis()
I am trying to recreate this tutorial by Austin Rochford about Non-parametric bayesian models from 2016 which can be found here.
The tutorial uses pymc3 and theano which are no longer supported and ...
0
votes
1
answer
65
views
MAP estimate versus Mean of Posterior Disagree
Shouldn't the MAP estimate be close to the center of the histogram of the trace samples?
I see close agreement between the find_MAP estimate and the histogram of the trace variables when modeling my ...
0
votes
1
answer
73
views
How can I parameterize lags parameters for each independent variable in my model in PyMC (5.10.0)?
I am new to PyMC and I am using the 5.10.0 version. I am running a simple Media Mix Model and I need to parameterize the individual lags between the independent(media activity) and the dependent(sales ...
1
vote
0
answers
269
views
Unable to run pm.sample() function using PyMC Python library even though I re-installed the libraries
I am trying to run a Bayesian Linear Regression , but I am unable to create a posterior distribution using the sample() function from pymc. The code is as follows
import pandas as pd
from random ...
1
vote
0
answers
156
views
Extract values from sample with trace
I'm trying to reproduce an old code that uses PyMC
with pm.Model() as bayes_model:
#priors
phi = pm.Normal("phi", mu=0, sigma=20, shape=2)
sigma = pm.Exponential("sigma"...
1
vote
0
answers
42
views
I tried changing the preprocessing part of the pymc code but when I unscales the data it uses the default standardscaler(). how can I change the code
I was using the following code for transformation in pymc marketing package,
class StandardizeTarget:
target_transformer: Pipeline
@preprocessing_method_y
def standardize_target_data(self, data: pd....
1
vote
0
answers
783
views
Bayesian framework: Plot prior predictive and posterior predictive distribution with arviz
I'm attempting to replicate the example in Figure 1.5 from this source, which illustrates the prior predictive and posterior predictive distributions. However, I'm facing difficulty comprehending what ...
2
votes
2
answers
997
views
Calculating Highest Density Interval (HDI) for 2D array of data points
I have two arrays, x and y, which determine the position and a third one, z, which provides the value of the radiation at such position.
I want to calculate and plot the HDI of 90% over the plot of ...
0
votes
2
answers
168
views
How to construct correlation matrix from pymc.LKJCorr?
I want to construct a correlation matrix explicitly from using the pymc.LKJCorr distribution class, but I don't trust my understanding of the pymc.expand_packed_triangular. Here is a minimal working ...
0
votes
1
answer
143
views
How to pass Deterministic variables to Metropolis (PyMC)?
I was trying out the examples in the book : Probabilistic-Programming-and-Bayesian-Methods-for-Hackers.
Towards the end of chapter 2 I got stuck at the block of code below.
It purpose is to determine ...
1
vote
0
answers
175
views
Trouble implementing Bayesian model comparison with multiple experts' estimates using informative priors in PyMC
I am struggling to implement Bayesian model comparison in a specific case and would greatly appreciate some help. I want to compare multiple models, which are represented by normal distributions. Each ...
0
votes
1
answer
348
views
pymc5 - findig aic|bic|loo for model comparison
I have run a bayesian model (regression) using pymc5.
I would like to get a score indicator (AIC|BIC or LOO) to compare different models.
I am a newcomer to pymc and I don't understand how to get this ...
0
votes
1
answer
138
views
Pymc Input dimension mis-match
I am having an error in Pymc that I can't understand.
I think is related to dimensions of the of a dot product (see logit_p = pm.Deterministic("logit_p", X_data * beta)
), but I double ...
1
vote
0
answers
948
views
How to use the posterior predictive distribution for checking a model from PyMC
I am trying to understand how to use a posterior predictive check (PPC) after building a bayesian model using the PyMC library. I've never done this before and I don't quite understand how I should ...