# v5

**URL:** https://discourse.pymc.io/c/questions/v5/19.md?page=4

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

**Page:** 5

---

## [The observed variable in the Model Builder class appears to be instantiated twice. (pymc-extras)](https://discourse.pymc.io/t/the-observed-variable-in-the-model-builder-class-appears-to-be-instantiated-twice-pymc-extras/17066)

<div class="topic-metadata">

**Author:** [@roesta07](https://discourse.pymc.io/u/roesta07)\
**Replies:** 0\
**Last updated:** [June 3, 2025, 1:26pm UTC](https://discourse.pymc.io/t/the-observed-variable-in-the-model-builder-class-appears-to-be-instantiated-twice-pymc-extras/17066 "2025-06-03T13:26:07Z")

</div>

While following the Model Builder example from the official PyMC website (Using ModelBuilder class for deploying PyMC models — PyMC example gallery), I noticed that after sampling the model, the observed variable(y) appe…

---

## [Error with sample\_posterior\_predictive: "Cannot sample from half\_flat variable"](https://discourse.pymc.io/t/error-with-sample-posterior-predictive-cannot-sample-from-half-flat-variable/17065)

<div class="topic-metadata">

**Author:** [@rl100y](https://discourse.pymc.io/u/rl100y)\
**Replies:** 3\
**Last updated:** [June 3, 2025, 12:37pm UTC](https://discourse.pymc.io/t/error-with-sample-posterior-predictive-cannot-sample-from-half-flat-variable/17065 "2025-06-03T12:37:11Z")

</div>

Hi all, I am using pymc v5 installed via conda. I have a model with some improper priors (both HalfFlat and Flat), which I would like to use sample\_posterior\_predictive with. However, when I call sample\_posterior\_predic…

---

## [Truncated multivariate normal likelihood](https://discourse.pymc.io/t/truncated-multivariate-normal-likelihood/17032)

<div class="topic-metadata">

**Author:** [@Matthew\_Ward](https://discourse.pymc.io/u/Matthew_Ward)\
**Replies:** 10\
**Last updated:** [May 30, 2025, 8:42pm UTC](https://discourse.pymc.io/t/truncated-multivariate-normal-likelihood/17032 "2025-05-30T20:42:31Z")

</div>

Hello, I am trying to fit the mean and covariance of a 2D normal distribution to some data with the complication that my data is truncated. I only have observations within a window, although the underlying distribution …

---

## [How do I set a time-varying observation intercept in a state-space model](https://discourse.pymc.io/t/how-do-i-set-a-time-varying-observation-intercept-in-a-state-space-model/17000)

<div class="topic-metadata">

**Author:** [@sangrey](https://discourse.pymc.io/u/sangrey)\
**Replies:** 7\
**Last updated:** [May 30, 2025, 4:12pm UTC](https://discourse.pymc.io/t/how-do-i-set-a-time-varying-observation-intercept-in-a-state-space-model/17000 "2025-05-30T16:12:38Z")

</div>

Hello, How do I set a time-varying observation intercept in a state-space model? According to the comments on this question, it’s supported. I want to do this instead of using the RegressionComponent because I have a …

---

## [Calculation of joint density from pymc model](https://discourse.pymc.io/t/calculation-of-joint-density-from-pymc-model/17016)

<div class="topic-metadata">

**Author:** [@urikokp](https://discourse.pymc.io/u/urikokp)\
**Replies:** 1\
**Last updated:** [May 19, 2025, 6:36pm UTC](https://discourse.pymc.io/t/calculation-of-joint-density-from-pymc-model/17016 "2025-05-19T18:36:47Z")

</div>

Hello, I’m trying to compute the joint log density of a PyMC model with respect to different input data. As far as I understand, once observed is set in a PyMC model, it’s fixed and cannot be easily changed when evalua…

---

## [Error in Black Box Likelihood Function Example with PyMC](https://discourse.pymc.io/t/error-in-black-box-likelihood-function-example-with-pymc/16418)

<div class="topic-metadata">

**Author:** [@ktxx](https://discourse.pymc.io/u/ktxx)\
**Replies:** 4\
**Last updated:** [May 29, 2025, 3:30pm UTC](https://discourse.pymc.io/t/error-in-black-box-likelihood-function-example-with-pymc/16418 "2025-05-29T15:30:54Z")

</div>

Hello, I’m trying out the Using a “black box” likelihood function example, but I’m encountering an error and it’s not working as expected. Specifically, the error occurs with the following code: grad\_model.compile\_d…

---

## [Nutpie panel data events "moving"](https://discourse.pymc.io/t/nutpie-panel-data-events-moving/17046)

<div class="topic-metadata">

**Author:** [@KL\_Bean](https://discourse.pymc.io/u/KL_Bean)\
**Replies:** 7\
**Last updated:** [May 29, 2025, 2:43pm UTC](https://discourse.pymc.io/t/nutpie-panel-data-events-moving/17046 "2025-05-29T14:43:19Z")

</div>

pymc version: 5.21.1 nutpie version 0.14.3 When I try to incorporate event data into a model with multiple locations, and allow the coefficient to vary by location, I am noticing that the “date” of the event is shiftin…

---

## [Transitioning from pm.sample() to pm.fit()](https://discourse.pymc.io/t/transitioning-from-pm-sample-to-pm-fit/17018)

<div class="topic-metadata">

**Author:** [@eklim0407](https://discourse.pymc.io/u/eklim0407)\
**Replies:** 15\
**Last updated:** [May 28, 2025, 3:26pm UTC](https://discourse.pymc.io/t/transitioning-from-pm-sample-to-pm-fit/17018 "2025-05-28T15:26:23Z")

</div>

Hi, I am trying to switch my model from pm.sample() to pm.fit() for performance reasons. I have gotten my model to sample well with pm.sample() on a subset of my data–meaning there are 0 divergences, the r\_hats are all…

---

## [Problem in installing pymc-bart 0.9.0 package on PYMC V.5.22](https://discourse.pymc.io/t/problem-in-installing-pymc-bart-0-9-0-package-on-pymc-v-5-22/17013)

<div class="topic-metadata">

**Author:** [@Saurav\_Rukhaiyar](https://discourse.pymc.io/u/Saurav_Rukhaiyar)\
**Replies:** 6\
**Last updated:** [May 26, 2025, 11:51am UTC](https://discourse.pymc.io/t/problem-in-installing-pymc-bart-0-9-0-package-on-pymc-v-5-22/17013 "2025-05-26T11:51:37Z")

</div>

Collecting pymc-bart==0.9.0 Using cached pymc\_bart-0.9.0-py3-none-any.whl.metadata (4.6 kB) Collecting pymc\<=5.20.1,\>=5.16.2 (from pymc-bart==0.9.0) Using cached pymc-5.20.1-py3-none-any.whl.metadata (15 kB) Requirem…

---

## [pm.Minibatch Doc string](https://discourse.pymc.io/t/pm-minibatch-doc-string/17035)

<div class="topic-metadata">

**Author:** [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Replies:** 1\
**Last updated:** [May 24, 2025, 3:42am UTC](https://discourse.pymc.io/t/pm-minibatch-doc-string/17035 "2025-05-24T03:42:19Z")

</div>

I am (re)-learning to use ADVI with PYMC and was working through the example here : Introduction to Variational Inference with PyMC — PyMC example gallery In that example, the authors show a rather extensive docstring f…

---

## [Serializing models](https://discourse.pymc.io/t/serializing-models/12548)

<div class="topic-metadata">

**Author:** [@jan5](https://discourse.pymc.io/u/jan5)\
**Replies:** 2\
**Last updated:** [May 17, 2025, 11:07pm UTC](https://discourse.pymc.io/t/serializing-models/12548 "2025-05-17T23:07:10Z")

</div>

Hey guys, in my current project my goal is to create a variety of bayesian models (ranging from simple spline models to GPs) in pymc for my data and to compare the results eventually. As I want to keep track of all the …

---

## [Why doesn't pm.Potential prevent SamplingError from invalid Gamma parameters?](https://discourse.pymc.io/t/why-doesnt-pm-potential-prevent-samplingerror-from-invalid-gamma-parameters/17010)

<div class="topic-metadata">

**Author:** [@shoh](https://discourse.pymc.io/u/shoh)\
**Replies:** 1\
**Last updated:** [May 17, 2025, 9:36pm UTC](https://discourse.pymc.io/t/why-doesnt-pm-potential-prevent-samplingerror-from-invalid-gamma-parameters/17010 "2025-05-17T21:36:31Z")

</div>

Hello! I’m running into a problem when using pm.Gamma.dist(..., beta=k / predicted\_spectra) inside a custom model. Sometimes, predicted\_spectra contains negative values, which makes the beta parameter invalid and causes…

---

## [Why doesn't pymc.Multinomial support logit\_p parameterization?](https://discourse.pymc.io/t/why-doesnt-pymc-multinomial-support-logit-p-parameterization/16995)

<div class="topic-metadata">

**Author:** [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Replies:** 3\
**Last updated:** [May 15, 2025, 7:42pm UTC](https://discourse.pymc.io/t/why-doesnt-pymc-multinomial-support-logit-p-parameterization/16995 "2025-05-15T19:42:16Z")

</div>

pm.Categorical supports the logit\_p parameterization, which improves numerical stability by avoiding an explicit softmax when computing the log-likelihood (I presume it uses a stable log-sum-exp internally instead). The …

---

## [Am I doing the right model?](https://discourse.pymc.io/t/am-i-doing-the-right-model/16982)

<div class="topic-metadata">

**Author:** [@rodrigotakming](https://discourse.pymc.io/u/rodrigotakming)\
**Replies:** 2\
**Last updated:** [May 15, 2025, 7:32pm UTC](https://discourse.pymc.io/t/am-i-doing-the-right-model/16982 "2025-05-15T19:32:30Z")

</div>

In my dataset there is 4 columns (project\_id, responsible\_id, date\_reference, acquisitiontypes, number\_of\_tasks\_finished). What we call project is an client that has contract with us, and the responsible is the person fr…

---

## [Wierd problem installing PYMC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984)

<div class="topic-metadata">

**Author:** [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Replies:** 17\
**Last updated:** [May 13, 2025, 7:24pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984 "2025-05-13T19:24:51Z")

</div>

I was just starting a new project, like I normally do, and tried installing pymc like this: conda create -n multinom3 python=3.12 pymc=5.21.0 arviz jupyter -c conda-forge This is on windows 11. Note I pinned these ve…

---

## [Marginal Gaussian with y=None vs Latent Gaussian](https://discourse.pymc.io/t/marginal-gaussian-with-y-none-vs-latent-gaussian/16964)

<div class="topic-metadata">

**Author:** [@gdel](https://discourse.pymc.io/u/gdel)\
**Replies:** 1\
**Last updated:** [May 12, 2025, 1:28am UTC](https://discourse.pymc.io/t/marginal-gaussian-with-y-none-vs-latent-gaussian/16964 "2025-05-12T01:28:25Z")

</div>

In a time series model with regressors, I would like to model the trend with a Gaussian process. I see that I can describe the model either with a Marginal Gaussian process (with y=None and a small noise) or a Latent Gau…

---

## [Implementing a manual AR1 model](https://discourse.pymc.io/t/implementing-a-manual-ar1-model/12824)

<div class="topic-metadata">

**Author:** [@fvall](https://discourse.pymc.io/u/fvall)\
**Replies:** 5\
**Last updated:** [May 9, 2025, 1:15pm UTC](https://discourse.pymc.io/t/implementing-a-manual-ar1-model/12824 "2025-05-09T13:15:33Z")

</div>

Hi, I am new to pymc and I am trying to understand how to build time series models. I am starting with an AR1 model where I am trying to replicate what the already available AR distribution in pymc gives us. This is to …

---

## [Fitting with flat priors in bambi](https://discourse.pymc.io/t/fitting-with-flat-priors-in-bambi/16960)

<div class="topic-metadata">

**Author:** [@Martin\_Ingram](https://discourse.pymc.io/u/Martin_Ingram)\
**Replies:** 1\
**Last updated:** [May 4, 2025, 11:52pm UTC](https://discourse.pymc.io/t/fitting-with-flat-priors-in-bambi/16960 "2025-05-04T23:52:54Z")

</div>

Hi everyone, I hope this is the right venue to ask this question, let me know if I should ask it somewhere more bambi-specific! My question is pretty simple: I’d like to compare some of the estimates I get with bambi w…

---

## [Sampling from non-analytical distribution in C++](https://discourse.pymc.io/t/sampling-from-non-analytical-distribution-in-c/16919)

<div class="topic-metadata">

**Author:** [@miau-murk](https://discourse.pymc.io/u/miau-murk)\
**Replies:** 11\
**Last updated:** [May 4, 2025, 1:01am UTC](https://discourse.pymc.io/t/sampling-from-non-analytical-distribution-in-c/16919 "2025-05-04T01:01:21Z")

</div>

Hello everyone, I’m trying to solve the problem of sampling from a non-analytical distribution in C++. I have a .cpp function that calculates the energy and its gradient at a point, and I want to generate samples using …

---

## [Football (soccer) Modelling](https://discourse.pymc.io/t/football-soccer-modelling/16709)

<div class="topic-metadata">

**Author:** [@porterhouse](https://discourse.pymc.io/u/porterhouse)\
**Replies:** 2\
**Last updated:** [May 2, 2025, 7:22am UTC](https://discourse.pymc.io/t/football-soccer-modelling/16709 "2025-05-02T07:22:41Z")

</div>

Hi everyone, I am new here and wanted to reach out for any advice/resources around pymc modelling for football/soccer. I am currently learning about Bayesian process and pymc via this project and have managed to get a …

---

## [Using sample posterior predictive on new data](https://discourse.pymc.io/t/using-sample-posterior-predictive-on-new-data/16955)

<div class="topic-metadata">

**Author:** [@Alexander\_Grunewald](https://discourse.pymc.io/u/Alexander_Grunewald)\
**Replies:** 4\
**Last updated:** [April 30, 2025, 1:22pm UTC](https://discourse.pymc.io/t/using-sample-posterior-predictive-on-new-data/16955 "2025-04-30T13:22:13Z")

</div>

Hello! I am very new to PyMC and bayesian modeling in general. I am currently following some of the example code used in rethinking statistics in chapter 8 and I’m trying to replicate it in PyMC but I am running into dim…

---

## [Hierarchical Modeling Across Uneven TV Series Schedules with Blitz Marketing Effects](https://discourse.pymc.io/t/hierarchical-modeling-across-uneven-tv-series-schedules-with-blitz-marketing-effects/16924)

<div class="topic-metadata">

**Author:** [@sbellapu](https://discourse.pymc.io/u/sbellapu)\
**Replies:** 2\
**Last updated:** [April 29, 2025, 4:53pm UTC](https://discourse.pymc.io/t/hierarchical-modeling-across-uneven-tv-series-schedules-with-blitz-marketing-effects/16924 "2025-04-29T16:53:24Z")

</div>

We’re working on a hierarchical model to combine results from different TV series across a broadcast season. However, each show follows a different schedule some premiere in the Fall, others midseason, and they vary in e…

---

## [Problem with pymc softmax transformation producing unexpected results](https://discourse.pymc.io/t/problem-with-pymc-softmax-transformation-producing-unexpected-results/16953)

<div class="topic-metadata">

**Author:** [@uferc](https://discourse.pymc.io/u/uferc)\
**Replies:** 3\
**Last updated:** [April 28, 2025, 2:40pm UTC](https://discourse.pymc.io/t/problem-with-pymc-softmax-transformation-producing-unexpected-results/16953 "2025-04-28T14:40:42Z")

</div>

Hi all, I’m trying to build a PyMC model that estimates the variances for three multivariate normal distributions in a categorical decision-making task. To verify that the model can recover parameters, I first generated…

---

## [Feeding counts or frequencies as observed data for a categorical variable](https://discourse.pymc.io/t/feeding-counts-or-frequencies-as-observed-data-for-a-categorical-variable/16869)

<div class="topic-metadata">

**Author:** [@threepwood](https://discourse.pymc.io/u/threepwood)\
**Replies:** 6\
**Last updated:** [April 28, 2025, 10:08am UTC](https://discourse.pymc.io/t/feeding-counts-or-frequencies-as-observed-data-for-a-categorical-variable/16869 "2025-04-28T10:08:44Z")

</div>

Total beginner here and not that familiar with the theory so I might be completely off base. I am trying to model some data that is basically occurrence counts over integers. I’m starting off a graphical model from the l…

---

## [Slow Sampling after recent updates? PYMC MMM v5](https://discourse.pymc.io/t/slow-sampling-after-recent-updates-pymc-mmm-v5/16944)

<div class="topic-metadata">

**Author:** [@Osan\_Bekar](https://discourse.pymc.io/u/Osan_Bekar)\
**Replies:** 4\
**Last updated:** [April 28, 2025, 8:24am UTC](https://discourse.pymc.io/t/slow-sampling-after-recent-updates-pymc-mmm-v5/16944 "2025-04-28T08:24:03Z")

</div>

Hey everyone, have you experienced slower sampling (5 mins instead of 1.5 mins) since the recent updates? I know there’s been similar topics in previous versions but wanted to make sure I’m not missing out on more up-t…

---

## [Allocate\_budget\_to\_maximize\_response Takes a lot of time to work](https://discourse.pymc.io/t/allocate-budget-to-maximize-response-takes-a-lot-of-time-to-work/14888)

<div class="topic-metadata">

**Author:** [@TheJarmanitor](https://discourse.pymc.io/u/TheJarmanitor)\
**Replies:** 5\
**Last updated:** [April 25, 2025, 6:23pm UTC](https://discourse.pymc.io/t/allocate-budget-to-maximize-response-takes-a-lot-of-time-to-work/14888 "2025-04-25T18:23:26Z")

</div>

I’m following the examples in order to do a POC for my job. I was doing fine until doing budget allocation. The allocate\_budget\_to\_maximize\_response functions has been running for hours and hasn’t given any results. The…

---

## [How to model an AR process with exogenous shocks?](https://discourse.pymc.io/t/how-to-model-an-ar-process-with-exogenous-shocks/16931)

<div class="topic-metadata">

**Author:** [@Royce](https://discourse.pymc.io/u/Royce)\
**Replies:** 2\
**Last updated:** [April 24, 2025, 7:30am UTC](https://discourse.pymc.io/t/how-to-model-an-ar-process-with-exogenous-shocks/16931 "2025-04-24T07:30:08Z")

</div>

The model is roughly as follows: δit=ϕ⋅δi,t−1+β⋅Xit+wit,wit∼N(0,σ2) My idea is to modify the existing AR model, for example by replacing the innovation term ϵt∼N(0,σ2) with ϵt∼N(X⋅β,σ2) But I’m not sure how to adjust…

---

## [Simulator params with different shapes](https://discourse.pymc.io/t/simulator-params-with-different-shapes/16882)

<div class="topic-metadata">

**Author:** [@claire](https://discourse.pymc.io/u/claire)\
**Replies:** 1\
**Last updated:** [April 23, 2025, 9:04pm UTC](https://discourse.pymc.io/t/simulator-params-with-different-shapes/16882 "2025-04-23T21:04:41Z")

</div>

I am using sample\_smc to find the parameters of a black-box function using a Simulator RV. The parameters to the simulator function have different shapes, but when I try to do this is causes a numpy broadcast error. Thi…

---

## [Dimensionality problem with CustomDist](https://discourse.pymc.io/t/dimensionality-problem-with-customdist/16940)

<div class="topic-metadata">

**Author:** [@ccmmgg82](https://discourse.pymc.io/u/ccmmgg82)\
**Replies:** 0\
**Last updated:** [April 23, 2025, 7:44pm UTC](https://discourse.pymc.io/t/dimensionality-problem-with-customdist/16940 "2025-04-23T19:44:13Z")

</div>

Hello!! I am relatively new to PyMC, but I have an issue with a model I am trying to estimate. I was hoping someone could help, as I am relatively new to PyMC. The model is: def logp(value: TensorVariable, c: Tensor…

---

## [How to parameterize and identify an IRT 2-PL model? (pymc-bot test)](https://discourse.pymc.io/t/how-to-parameterize-and-identify-an-irt-2-pl-model-pymc-bot-test/16922)

<div class="topic-metadata">

**Author:** [@bob-carpenter](https://discourse.pymc.io/u/bob-carpenter)\
**Replies:** 5\
**Last updated:** [April 22, 2025, 9:23pm UTC](https://discourse.pymc.io/t/how-to-parameterize-and-identify-an-irt-2-pl-model-pymc-bot-test/16922 "2025-04-22T21:23:07Z")

</div>

@pymc-bot I would like to write an item-response theory 2-parameter logistic (IRT-2PL) model with hierarchical priors for the three effects: student ability, item difficulty, and item discriminativeness. I would like ad…

[Previous page](https://discourse.pymc.io/c/questions/v5/19.md?page=3)

[Next page](https://discourse.pymc.io/c/questions/v5/19.md?page=5)
