Hello,
In my model I am trying to input an list as an independent variable. I think the dependent variable should be for example the mean of every item in the list risen to some power that I’m trying to estimate.
For example the forward model might look like:
a=[ 0.5, 0.2, 0.1]
x=[ [0,.1,.1,.2,.2,.5,.2,.8,.7,.5,.6,1],
[.1,.2,.1,.1,.1],[1,1,1,1,0,0,0,0,0,0,0,5,5,.1]
y= [ ]
for i in len(x):
a=a[i]
x=x[i]
y.append(np.mean(x**a))
These are in a pandas Dataframe like so.
| a | __ x____ | _ y__ |
| .5 | [0,.1,.1,…] | 12 |
While x and y are observed, I’m trying to estimate a. However, if I try to use
with pm.Model() as risk_model:
# Data
y = pm.Data("outcome", df.y)
x=pm.Data("Dependent",df.x)
I get:
666 # `convert_observed_data` takes care of parameter `value` and
667 # transforms it to something digestible for Aesara.
--> 668 arr = convert_observed_data(value)
669
670 if mutable is None:
~/anaconda3/lib/python3.7/site-packages/pymc/aesaraf.py in convert_observed_data(data)
139 # otherwise, assume float:
140 else:
--> 141 return floatX(ret)
142 # needed for uses of this function other than with pm.Data:
143 else:
~/anaconda3/lib/python3.7/site-packages/pymc/aesaraf.py in floatX(X)
457 """
458 try:
--> 459 return X.astype(aesara.config.floatX)
460 except AttributeError:
461 # Scalar passed
ValueError: setting an array element with a sequence.
Any help is much appreciated