[quote=“tcapretto, post:2, topic:10858”]
`Thank you for your help.
I installed pymc with: ‘pip install pymc’`
then I imported:
import arviz as az
import bambi as bmb
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import pymc as pm
print(“Bambi:”, bmb.version)
print(“PyMC:”, pm.version)
gives:
Bambi: 0.9.1
PyMC: 4.3.0
then following the Bambi first example from the Bambi documentation:
Comparison of two means (T-test):
bambinos.github Comparison of two means (T-test) — Bambi 0.9.1 documentation)
a = np.random.normal(6, 2.5, 160)
b = np.random.normal(8, 2, 120)
df = pd.DataFrame({“Group”: [“a”] * 160 + [“b”] * 120, “Val”: np.hstack([a, b])})
df.sample(10)
model_1 = bmb.Model(“Val ~ Group”, df)
results_1 = model_1.fit()
this still gives:
‘cannot pickle ‘fortran’ object’ error.
If instead I
import pymc3 as pm
print(“Bambi:”, bmb.version)
print(“PyMC3:”, pm.version)
I get:
Bambi: 0.9.1
PyMC: 3.11.5
and then run the model, I still get the same error.
mayby I am not installing pymc correctly and the two versions are interferring with each other?
I have since gone on to run other models on Bambi successfully, but when I return to this example above from the Bambi website it fails with the aforementioned error.
If I modify the model by setting the intercept to zero it then works!:
model_2 = bmb.Model(“Val ~ 0+Group”, df)
results_2 = model_2.fit()
but why the first model, designated model1(model_1 = bmb.Model(“Val ~ Group”, df)) on the Bambi website fails on my computer I do not know. Comparing two means is a useful model.
Putting this all together I am not sure if its just this example model that is at fault, or that my install is mixed up between pymc3 and pymc4. I was using pymc3 since the learning examples seem to be mostly pymc3, however I would be happy to migrate to pymc4 if the code transition is not too difficult.
Any ideas as to why the Bambi documentation example model 1 is failing? would give confidence to using other Bambi models. Thank you for expertise and guidance on the above. DD