twiecki / stopsignal

Hierarchical stop-signal model (Matzke et al, 2011) that allows estimation of SSRT and SSRT variability.
GNU Affero General Public License v3.0
6 stars 1 forks source link

Long RTs/SSDs lead to error #3

Open Gilles86 opened 10 years ago

Gilles86 commented 10 years ago

Hi again,

I have a task with relatively long RTs. For some subjects and some conditions the RTs/SSDs are more than 1000ms. It seems that for these subjects the stopsignal-library breaks down:

After 7.000000 retries, still no good fit found.

---------------------------------------------------------------------------
ZeroProbability                           Traceback (most recent call last)
<ipython-input-2-63e49e851d1c> in <module>()
     26 
     27 
---> 28         ss = stopsignal.StopSignal(ds, depends_on={'mu_go':['difficulty', 'color']})

/usr/local/lib/python2.7/dist-packages/stopsignal/stopsignal.pyc in __init__(self, data, **kwargs)
     73         self.std_depends = kwargs.get('std_depends', False)
     74 
---> 75         super(StopSignal, self).__init__(data, **kwargs)
     76 
     77     def create_ss_knode(self, knodes):

/usr/local/lib/python2.7/dist-packages/kabuki/hierarchical.pyc in __init__(self, data, is_group_model, depends_on, trace_subjs, plot_subjs, plot_var, group_only_nodes)
    346         self.db = None
    347 
--> 348         self._setup_model()
    349 
    350     def _setup_model(self):

/usr/local/lib/python2.7/dist-packages/kabuki/hierarchical.pyc in _setup_model(self)
    357 
    358         # constructs pymc nodes etc and connects them appropriately
--> 359         self.create_model()
    360 
    361     def __getstate__(self):

/usr/local/lib/python2.7/dist-packages/kabuki/hierarchical.pyc in create_model(self, max_retries)
    437         else:
    438             print "After %f retries, still no good fit found." %(tries)
--> 439             _create()
    440 
    441         # create node container

/usr/local/lib/python2.7/dist-packages/kabuki/hierarchical.pyc in _create()
    427         def _create():
    428             for knode in self.knodes:
--> 429                 knode.create()
    430 
    431         for tries in range(max_retries):

/usr/local/lib/python2.7/dist-packages/kabuki/hierarchical.pyc in create(self)
    166                 kwargs['doc'] = node_name
    167 
--> 168             node = self.create_node(node_name, kwargs, grouped_data)
    169 
    170             if node is not None:

/usr/local/lib/python2.7/dist-packages/stopsignal/stopsignal.pyc in create_node(self, node_name, kwargs, data)
     54         kwargs['value'] = new_data['rt']
     55         kwargs['issd'] = np.array(new_data['ssd'], dtype=np.int32)
---> 56         return self.pymc_node(name=node_name, **kwargs)
     57 
     58 class KnodeInhibitions(Knode):

/usr/local/lib/python2.7/dist-packages/pymc/distributions.pyc in __init__(self, *args, **kwds)
    269                 random = debug_wrapper(random)
    270             else:
--> 271                 Stochastic.__init__(self, logp=logp, random=random, logp_partial_gradients = logp_partial_gradients, dtype=dtype, **arg_dict_out)
    272 
    273     new_class.__name__ = name

/usr/local/lib/python2.7/dist-packages/pymc/PyMCObjects.pyc in __init__(self, logp, doc, name, parents, random, trace, value, dtype, rseed, observed, cache_depth, plot, verbose, isdata, check_logp, logp_partial_gradients)
    757         if check_logp:
    758             # Check initial value
--> 759             if not isinstance(self.logp, float):
    760                 raise ValueError(
    761                     "Stochastic " +

/usr/local/lib/python2.7/dist-packages/pymc/PyMCObjects.pyc in get_logp(self)
    914                     (self._value, self._parents.value))
    915             else:
--> 916                 raise ZeroProbability(self.errmsg)
    917 
    918         return logp

ZeroProbability: Stochastic srrt_like(green.hard)'s value is outside its support,
 or it forbids its parents' current values.

I tried upping the limit of mu_go in stopsignal.py, line 94 to 2e3, but that doesn't seem to help.

Any thoughts?

Thank you so much!

twiecki commented 10 years ago

Hmmm, sounds like outliers. Have you tried excluding very long and very short RTs?

Gilles86 commented 10 years ago

Hey,

This helps for some subjects. But then, when fitting the data in a hierarchal model, I now get an integration error after taking a lot of samples.

[---------------- 44% ] 8811 of 20000 complete in 1403.7 secgsl: qag.c:261: ERROR: could not integrate function Default GSL error handler invoked. Aborted (core dumped)

Can this exception be caught for problematic samples, so these can be skipped?

twiecki commented 10 years ago

Sorry for the slow response. I would figure out what parameter values cause it to crash (which would require some digging into the code).