I encountered a similar problem recently, I am new to python, sorry if my question is too sample.
I also have a 2 by 2 within-subject design. let's say that one is called "moral", the other is "id" .
m_within_subj_L = hddm.HDDMRegressor(datL_match2, "v ~ C(id)*C(moral)", include = ['t','a', 'v','z'],keep_regressor_trace=True, p_outlier = 0.05)
After running the above code, following was shown:
Adding these covariates:
['v_Intercept', 'v_C(id)[T.self]', 'v_C(moral)[T.moral]', 'v_C(id)[T.self]:C(moral)[T.moral]']
then I run the following code
# estimate the posterior, sampling 5000 times, discard the first 200
m_within_subj_L.sample(5000, burn=200)
Then I tried to get the parameter "v" for each:
v_Intercept,v_id,v_moral,v_id_moral = m_within_subj_L.nodes_db.ix[['v_Intercept',
'v_C(id)[T.self]',
'v_C(moral)[T.moral]',
'v_C(id)[T.self]:C(moral)[T.moral]'],'nodes']
but get an error:
v_Intercept,v_id,v_moral,v_id_moral = m_within_subj_L.nodes_db.ix[['v_Intercept',
'v_C(id)[T.self]',
'v_C(moral)[T.moral]',
'v_C(id)[T.self]:C(moral)[T.moral]'],'nodes']
Traceback (most recent call last):
File "<ipython-input-63-9c984221c78f>", line 4, in <module>
'v_C(id)[T.self]:C(moral)[T.moral]'],'nodes']
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\indexing.py", line 75, in __getitem__
return self._getitem_tuple(key)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\indexing.py", line 784, in _getitem_tuple
return self._getitem_lowerdim(tup)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\indexing.py", line 908, in _getitem_lowerdim
section = self._getitem_axis(key, axis=i)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\indexing.py", line 1018, in _getitem_axis
return self._get_label(key, axis=axis)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\indexing.py", line 93, in _get_label
return self.obj._xs(label, axis=axis)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\generic.py", line 1740, in xs
return self[key]
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\frame.py", line 1997, in __getitem__
return self._getitem_column(key)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\frame.py", line 2004, in _getitem_column
return self._get_item_cache(key)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\generic.py", line 1350, in _get_item_cache
values = self._data.get(item)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\internals.py", line 3290, in get
loc = self.items.get_loc(item)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\indexes\base.py", line 1947, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas\index.pyx", line 137, in pandas.index.IndexEngine.get_loc (pandas\index.c:4154)
File "pandas\index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas\index.c:4018)
File "pandas\hashtable.pyx", line 675, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:12368)
File "pandas\hashtable.pyx", line 683, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:12322)
KeyError: 'nodes'
I also tried this code as suggested in this post
v_Intercept,v_id,v_moral,v_id_moral = m_within_subj_L.nodes_db.node[['v_Intercept',
'v_C(id)[T.self]',
'v_C(moral)[T.moral]',
'v_C(id)[T.self]:C(moral)[T.moral]'],'nodes']
but also returned an error:
v_Intercept,v_id,v_moral,v_id_moral = m_within_subj_L.nodes_db.node[['v_Intercept',
'v_C(id)[T.self]',
'v_C(moral)[T.moral]',
'v_C(id)[T.self]:C(moral)[T.moral]'],'nodes']
Traceback (most recent call last):
File "<ipython-input-65-06fbb44ee34d>", line 4, in <module>
'v_C(id)[T.self]:C(moral)[T.moral]'],'nodes']
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\series.py", line 624, in __getitem__
return self._get_with(key)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\series.py", line 637, in _get_with
return self._get_values_tuple(key)
File "C:\Program Files\Anaconda2\lib\site-packages\pandas\core\series.py", line 682, in _get_values_tuple
raise ValueError('Can only tuple-index with a MultiIndex')
ValueError: Can only tuple-index with a MultiIndex
Not, I am not sure how to get the value of parameter.