# Questions

**URL:** https://discourse.pymc.io/c/questions/6.md?page=3

[Latest](https://discourse.pymc.io/latest.md) · [Categories](https://discourse.pymc.io/categories.md) · [Tags](https://discourse.pymc.io/tags.md)

**Page:** 4

---

## [Pymc sum function returning zero](https://discourse.pymc.io/t/pymc-sum-function-returning-zero/17375)

<div class="topic-metadata">

**Author:** [@Hyperthetical](https://discourse.pymc.io/u/Hyperthetical)\
**Replies:** 1\
**Last updated:** [October 10, 2025, 1:12pm UTC](https://discourse.pymc.io/t/pymc-sum-function-returning-zero/17375 "2025-10-10T13:12:23Z")

</div>

I have been having a problem where I can’t get the pymc.math.sum function to return non-zero answers. In the following code the numpy version works, but the pymc version prints Sum{axes=None}.0 (and generates -inf in a l…

---

## [Gradient Issues During Budget Optimization](https://discourse.pymc.io/t/gradient-issues-during-budget-optimization/17357)

<div class="topic-metadata">

**Author:** [@fountainpen](https://discourse.pymc.io/u/fountainpen)\
**Replies:** 3\
**Last updated:** [October 8, 2025, 8:09pm UTC](https://discourse.pymc.io/t/gradient-issues-during-budget-optimization/17357 "2025-10-08T20:09:45Z")

</div>

This is a follow up to my previous post at Budget recommendations don't align with saturation curves - #3 by cetagostini I believe that the budget optimizer is failing to create sensible budgets due to extremely small g…

---

## [Pymc marketing sample\_posterior\_predictive (Bug)](https://discourse.pymc.io/t/pymc-marketing-sample-posterior-predictive-bug/17371)

<div class="topic-metadata">

**Author:** [@fountainpen](https://discourse.pymc.io/u/fountainpen)\
**Replies:** 0\
**Last updated:** [October 8, 2025, 5:53pm UTC](https://discourse.pymc.io/t/pymc-marketing-sample-posterior-predictive-bug/17371 "2025-10-08T17:53:50Z")

</div>

Version: 0.16.0 When using mmm.sample\_posterior\_predictive setting original\_scale=True will only affect ‘y’ variable like so if original\_scale: if hasattr(self, "target\_scale"): # Use the new computed scale…

---

## [Implementing multivariate skew normal likelihood in PyMC](https://discourse.pymc.io/t/implementing-multivariate-skew-normal-likelihood-in-pymc/17354)

<div class="topic-metadata">

**Author:** [@majf](https://discourse.pymc.io/u/majf)\
**Replies:** 2\
**Last updated:** [October 6, 2025, 3:13pm UTC](https://discourse.pymc.io/t/implementing-multivariate-skew-normal-likelihood-in-pymc/17354 "2025-10-06T15:13:05Z")

</div>

Hi, I’m trying to modify my multivariate normal model to use a skew normal distribution instead. Here’s my current code: with pm.Model() as cov\_model: mu = pm.Normal('mu', mu=0, sigma=1, shape=num\_features\_theta) …

---

## [How to display a single deterministic output of a Bayesian regression model using ArviZ](https://discourse.pymc.io/t/how-to-display-a-single-deterministic-output-of-a-bayesian-regression-model-using-arviz/17361)

<div class="topic-metadata">

**Author:** [@serdar](https://discourse.pymc.io/u/serdar)\
**Replies:** 7\
**Last updated:** [October 6, 2025, 5:53am UTC](https://discourse.pymc.io/t/how-to-display-a-single-deterministic-output-of-a-bayesian-regression-model-using-arviz/17361 "2025-10-06T05:53:53Z")

</div>

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 appreciate, there w…

---

## [Ordinal regression with non-normally distributed response variable](https://discourse.pymc.io/t/ordinal-regression-with-non-normally-distributed-response-variable/17356)

<div class="topic-metadata">

**Author:** [@leomein](https://discourse.pymc.io/u/leomein)\
**Replies:** 6\
**Last updated:** [October 2, 2025, 6:01pm UTC](https://discourse.pymc.io/t/ordinal-regression-with-non-normally-distributed-response-variable/17356 "2025-10-02T18:01:51Z")

</div>

Hi! I just read through Regression Models with Ordered Categorical Outcomes — PyMC example gallery and am thinking about applying such a model to my data (currently using logistic regression because the response can be …

---

## [Why do adstock.sample\_curve and new\_spend\_contributions have inconsistent time bounds?](https://discourse.pymc.io/t/why-do-adstock-sample-curve-and-new-spend-contributions-have-inconsistent-time-bounds/17327)

<div class="topic-metadata">

**Author:** [@fountainpen](https://discourse.pymc.io/u/fountainpen)\
**Replies:** 2\
**Last updated:** [September 16, 2025, 5:30pm UTC](https://discourse.pymc.io/t/why-do-adstock-sample-curve-and-new-spend-contributions-have-inconsistent-time-bounds/17327 "2025-09-16T17:30:35Z")

</div>

Why does adstock.sample\_curve measure periodicity as np.arange(0, self.l\_max), while new\_spend\_contributions measures with np.arange(-self.adstock.l\_max, self.adstock.l\_max + 1) So for adstock l\_max = 6, when using sampl…

---

## [Plot\_budget\_allocation creates misaligned axes](https://discourse.pymc.io/t/plot-budget-allocation-creates-misaligned-axes/17335)

<div class="topic-metadata">

**Author:** [@fountainpen](https://discourse.pymc.io/u/fountainpen)\
**Replies:** 3\
**Last updated:** [September 16, 2025, 2:18pm UTC](https://discourse.pymc.io/t/plot-budget-allocation-creates-misaligned-axes/17335 "2025-09-16T14:18:56Z")

</div>

The attached plot was made with plot\_budget\_allocation. As you can see the y axes do not align. Is this intentional, or should they match on the grid?

---

## [Parameters initialization](https://discourse.pymc.io/t/parameters-initialization/17328)

<div class="topic-metadata">

**Author:** [@Aguada](https://discourse.pymc.io/u/Aguada)\
**Replies:** 1\
**Last updated:** [September 16, 2025, 12:34pm UTC](https://discourse.pymc.io/t/parameters-initialization/17328 "2025-09-16T12:34:11Z")

</div>

@pymc-bot Hi everyone, I’m working on a PoC for an automotive equipment company using pymc-marketing to build a MMM model in Python. Our target variable is revenues, and the inputs are media channels plus control var…

---

## [Inconsistency in repo budget allocation example](https://discourse.pymc.io/t/inconsistency-in-repo-budget-allocation-example/17330)

<div class="topic-metadata">

**Author:** [@fountainpen](https://discourse.pymc.io/u/fountainpen)\
**Replies:** 3\
**Last updated:** [September 16, 2025, 12:21pm UTC](https://discourse.pymc.io/t/inconsistency-in-repo-budget-allocation-example/17330 "2025-09-16T12:21:30Z")

</div>

The mmm example case study here MMM End-to-End Case Study — Open Source Marketing Analytics Solution passes weekly budget divided by the number of channels to mmm.optimize\_budget. Why? The documentation for that functio…

---

## [Rationale & interpretation of \`plot\_direct\_contribution\_curves\`](https://discourse.pymc.io/t/rationale-interpretation-of-plot-direct-contribution-curves/16192)

<div class="topic-metadata">

**Author:** [@Jonas](https://discourse.pymc.io/u/Jonas)\
**Replies:** 2\
**Last updated:** [September 14, 2025, 12:01pm UTC](https://discourse.pymc.io/t/rationale-interpretation-of-plot-direct-contribution-curves/16192 "2025-09-14T12:01:48Z")

</div>

Hi, I have wondered about the rationale behind the direct contribution plot in general and the connection to fitted saturation curves in general. My understanding is that the scatter plot created by plot\_direct\_contrib…

---

## [How does one sample from a tempered posterior?](https://discourse.pymc.io/t/how-does-one-sample-from-a-tempered-posterior/17329)

<div class="topic-metadata">

**Author:** [@geomaturge](https://discourse.pymc.io/u/geomaturge)\
**Replies:** 1\
**Last updated:** [September 12, 2025, 8:00pm UTC](https://discourse.pymc.io/t/how-does-one-sample-from-a-tempered-posterior/17329 "2025-09-12T20:00:46Z")

</div>

Hello! I’m trying to sample from a tempered posterior distribution. As I understand, I should be doing this using pm.Potential, but no matter how I arrange things I can’t get the temperature parameter to have any effect …

---

## [Lagged Time Series with delayed and gradual effects](https://discourse.pymc.io/t/lagged-time-series-with-delayed-and-gradual-effects/17301)

<div class="topic-metadata">

**Author:** [@mikesmith5446](https://discourse.pymc.io/u/mikesmith5446)\
**Replies:** 12\
**Last updated:** [September 12, 2025, 3:39pm UTC](https://discourse.pymc.io/t/lagged-time-series-with-delayed-and-gradual-effects/17301 "2025-09-12T15:39:56Z")

</div>

I am trying to model an industrial process in which corn and water are mixed together and cooked in 2 large mixing tanks before flowing out to the next step of the process. There is a density meter on the outflow. The …

---

## [Working with Multi-index Coords](https://discourse.pymc.io/t/working-with-multi-index-coords/16113)

<div class="topic-metadata">

**Author:** [@dreycenfoiles](https://discourse.pymc.io/u/dreycenfoiles)\
**Replies:** 12\
**Last updated:** [September 8, 2025, 8:48pm UTC](https://discourse.pymc.io/t/working-with-multi-index-coords/16113 "2025-09-08T20:48:36Z")

</div>

Hello, I’ve got an ArviZ and PyMC combo question. I’ve been working with some uneven, long, data that I’m managing with multi-indexes. This workflow works pretty well except PyMC models can’t accept multi-indexes in the…

---

## [How to model very complicated likelihood automatically？](https://discourse.pymc.io/t/how-to-model-very-complicated-likelihood-automatically/17311)

<div class="topic-metadata">

**Author:** [@NFYG](https://discourse.pymc.io/u/NFYG)\
**Replies:** 2\
**Last updated:** [September 5, 2025, 3:50am UTC](https://discourse.pymc.io/t/how-to-model-very-complicated-likelihood-automatically/17311 "2025-09-05T03:50:49Z")

</div>

Let’s think about a likelihood which is non-trivial y=(x+\\mu+\\sigma\\epsilon)^2,\\ \\text{with}\\ \\epsilon\\sim\\mathcal{N}(0,1) I know this can be transformed into ChiSquared dist analytically. But we still will encounter …

---

## [Dealing with large unaffected cohort in parametric survival analysis](https://discourse.pymc.io/t/dealing-with-large-unaffected-cohort-in-parametric-survival-analysis/17315)

<div class="topic-metadata">

**Author:** [@ddg.palmer](https://discourse.pymc.io/u/ddg.palmer)\
**Replies:** 5\
**Last updated:** [September 5, 2025, 12:42am UTC](https://discourse.pymc.io/t/dealing-with-large-unaffected-cohort-in-parametric-survival-analysis/17315 "2025-09-05T00:42:42Z")

</div>

Hi there. I’m looking for some advice in better specifying my model, since it’s fitting to the data correctly, but not in the way that I want. I have a project fitting multiple survival models to epidemiological data, w…

---

## [Changing markers for some but not all data categories in a plot\_channel\_contribution\_grid plot](https://discourse.pymc.io/t/changing-markers-for-some-but-not-all-data-categories-in-a-plot-channel-contribution-grid-plot/17310)

<div class="topic-metadata">

**Author:** [@Wesley\_Young](https://discourse.pymc.io/u/Wesley_Young)\
**Replies:** 0\
**Last updated:** [September 3, 2025, 2:38am UTC](https://discourse.pymc.io/t/changing-markers-for-some-but-not-all-data-categories-in-a-plot-channel-contribution-grid-plot/17310 "2025-09-03T02:38:24Z")

</div>

So I am working with data with 12 different channels. Naturally with so many channels, making sure the charts that show all of these values simultaneously is readability is a concern. With that in mind, I am trying to wr…

---

## [Use linear programming in a model](https://discourse.pymc.io/t/use-linear-programming-in-a-model/17307)

<div class="topic-metadata">

**Author:** [@threepwood](https://discourse.pymc.io/u/threepwood)\
**Replies:** 4\
**Last updated:** [September 1, 2025, 4:50pm UTC](https://discourse.pymc.io/t/use-linear-programming-in-a-model/17307 "2025-09-01T16:50:04Z")

</div>

I realized that a fairly elaborate combinatorial computation involved in my model can be reduced to a linear program, and then solved very efficiently for particular parameter values. I was wondering if there is a way to…

---

## [Installation Issues](https://discourse.pymc.io/t/installation-issues/17230)

<div class="topic-metadata">

**Author:** [@sjedw](https://discourse.pymc.io/u/sjedw)\
**Replies:** 4\
**Last updated:** [August 29, 2025, 1:42am UTC](https://discourse.pymc.io/t/installation-issues/17230 "2025-08-29T01:42:30Z")

</div>

I’ve followed the installation instructions (conda create -c conda-forge -n pymc\_env “pymc\>=5”) and then activate the environment. I prefer spyder so I’ve been attempting to install spyder within the environment and run …

---

## [Why is sampling sometimes slow?](https://discourse.pymc.io/t/why-is-sampling-sometimes-slow/17277)

<div class="topic-metadata">

**Author:** [@bridgeland](https://discourse.pymc.io/u/bridgeland)\
**Replies:** 6\
**Last updated:** [August 26, 2025, 11:36pm UTC](https://discourse.pymc.io/t/why-is-sampling-sometimes-slow/17277 "2025-08-26T23:36:22Z")

</div>

When I sample the posterior of my rather complex model (via NUTS), I see a strange behavior. Typically one chain will sample quite slowly, and the other 3 will sample quickly, at the speed I have come to expect. Why …

---

## [Help with external variables for a MMM model](https://discourse.pymc.io/t/help-with-external-variables-for-a-mmm-model/17295)

<div class="topic-metadata">

**Author:** [@Wesley\_Young](https://discourse.pymc.io/u/Wesley_Young)\
**Replies:** 0\
**Last updated:** [August 25, 2025, 1:09pm UTC](https://discourse.pymc.io/t/help-with-external-variables-for-a-mmm-model/17295 "2025-08-25T13:09:41Z")

</div>

Hello, I am working on a portfolio project to show that I working to learn about MMM and rather than create a simulated dataset, I choose to use the date provided at the following Kaggel page: https://www.kaggle.com/d…

---

## [How to build a Multi-Output Gaussian Process for a Surrogate Model](https://discourse.pymc.io/t/how-to-build-a-multi-output-gaussian-process-for-a-surrogate-model/17226)

<div class="topic-metadata">

**Author:** [@samengel](https://discourse.pymc.io/u/samengel)\
**Replies:** 1\
**Last updated:** [August 24, 2025, 9:06pm UTC](https://discourse.pymc.io/t/how-to-build-a-multi-output-gaussian-process-for-a-surrogate-model/17226 "2025-08-24T21:06:27Z")

</div>

I am currently using PyMC to do Bayesian inference on a set of fitting parameters for a simulation, which has a vector response. I use Scikit-Learn to build the Gaussian process (GP) surrogate model and the black-box lik…

---

## [Computing likelihood multiple datasets](https://discourse.pymc.io/t/computing-likelihood-multiple-datasets/17253)

<div class="topic-metadata">

**Author:** [@TroubledStudent](https://discourse.pymc.io/u/TroubledStudent)\
**Replies:** 10\
**Last updated:** [August 16, 2025, 5:39pm UTC](https://discourse.pymc.io/t/computing-likelihood-multiple-datasets/17253 "2025-08-16T17:39:59Z")

</div>

Hello there, Excuse me if this wasn’t posted under the right forum/tag. I am currently using the PyMC built-in Metropolis-Hastings algorithm to estimate parameters of a given exponential model. I would like to use the…

---

## [Seeking Advice on my Model](https://discourse.pymc.io/t/seeking-advice-on-my-model/17245)

<div class="topic-metadata">

**Author:** [@steeeeevo](https://discourse.pymc.io/u/steeeeevo)\
**Replies:** 4\
**Last updated:** [August 12, 2025, 5:11pm UTC](https://discourse.pymc.io/t/seeking-advice-on-my-model/17245 "2025-08-12T17:11:39Z")

</div>

Hello and thank you for reading this. I’m looking for some general advice and some advice regarding my specific model. Any help you could provide would be very appreciated! Assumptions: 2 types of Lego kits We know…

---

## [How to define time-varying state\_intercept (Ct) in pymc-extras SSM?](https://discourse.pymc.io/t/how-to-define-time-varying-state-intercept-ct-in-pymc-extras-ssm/17174)

<div class="topic-metadata">

**Author:** [@wanyixin625](https://discourse.pymc.io/u/wanyixin625)\
**Replies:** 5\
**Last updated:** [August 3, 2025, 6:55am UTC](https://discourse.pymc.io/t/how-to-define-time-varying-state-intercept-ct-in-pymc-extras-ssm/17174 "2025-08-03T06:55:36Z")

</div>

Hi everyone, I would like to build a state-space model using pymc-extras. To simplify the question, here is a toy example where the latent state x\_t depends on: A and B are parameters to be estimated. 𝑃(𝑡) is a kno…

---

## [CausalPy - Intuition behind calculation of causal impact and treatment time inputs](https://discourse.pymc.io/t/causalpy-intuition-behind-calculation-of-causal-impact-and-treatment-time-inputs/17069)

<div class="topic-metadata">

**Author:** [@ykarle](https://discourse.pymc.io/u/ykarle)\
**Replies:** 8\
**Last updated:** [July 29, 2025, 11:59am UTC](https://discourse.pymc.io/t/causalpy-intuition-behind-calculation-of-causal-impact-and-treatment-time-inputs/17069 "2025-07-29T11:59:21Z")

</div>

Was following the below CausalPy tutorial for Interrupted Time Series and using it for a simple pre-post comparison. Pre-world consists of the old world which had a old model controlling the outputs and post-world cons…

---

## [Blocked sampling on subsets of vars](https://discourse.pymc.io/t/blocked-sampling-on-subsets-of-vars/17220)

<div class="topic-metadata">

**Author:** [@covertg](https://discourse.pymc.io/u/covertg)\
**Replies:** 5\
**Last updated:** [July 27, 2025, 9:16am UTC](https://discourse.pymc.io/t/blocked-sampling-on-subsets-of-vars/17220 "2025-07-27T09:16:49Z")

</div>

Is pymc capable of performing blocked sampling, where the blocks consist of subsets of the pymc variable? Here’s a concrete example that I was hoping to test: import pymc as pm import numpy as np D = 6 # define block …

---

## [Dependency issues with pymc-marketing installation](https://discourse.pymc.io/t/dependency-issues-with-pymc-marketing-installation/17224)

<div class="topic-metadata">

**Author:** [@AnnikaDenninger](https://discourse.pymc.io/u/AnnikaDenninger)\
**Replies:** 0\
**Last updated:** [July 25, 2025, 7:43am UTC](https://discourse.pymc.io/t/dependency-issues-with-pymc-marketing-installation/17224 "2025-07-25T07:43:35Z")

</div>

Morning, We have been having problems with the installation of pymc-marketing for three days. %pip install pymc-marketing throws the following error: ERROR: pip’s dependency resolver does not currently take into accou…

---

## [More elegant way to construct random effects model](https://discourse.pymc.io/t/more-elegant-way-to-construct-random-effects-model/17214)

<div class="topic-metadata">

**Author:** [@79885yhnert67h](https://discourse.pymc.io/u/79885yhnert67h)\
**Replies:** 1\
**Last updated:** [July 24, 2025, 2:48pm UTC](https://discourse.pymc.io/t/more-elegant-way-to-construct-random-effects-model/17214 "2025-07-24T14:48:02Z")

</div>

Hello, I’m new to PyMC (and Bayesian regression modeling in general) so it’s likely this question is covered in the docs, but I’m not sure exactly what keyword I need to search for. Basically, I am trying to sauce up a …

---

## [Using scan to loop across differenet length of vectors](https://discourse.pymc.io/t/using-scan-to-loop-across-differenet-length-of-vectors/8656)

<div class="topic-metadata">

**Author:** [@orduek](https://discourse.pymc.io/u/orduek)\
**Replies:** 16\
**Last updated:** [July 22, 2025, 8:04pm UTC](https://discourse.pymc.io/t/using-scan-to-loop-across-differenet-length-of-vectors/8656 "2025-07-22T20:04:19Z")

</div>

Continuing the latest thread, I thought this can also be a general question (here’s the latest discussion: https://discourse.pymc.io/t/reinforcement-learning-help-building-a-model/8442 In short, I build an RL model, tha…

[Previous page](https://discourse.pymc.io/c/questions/6.md?page=2)

[Next page](https://discourse.pymc.io/c/questions/6.md?page=4)
