# Getting the current sample variable value so it can be used to compute the observed inputs in a secondary model likelihood

**URL:** <https://discourse.pymc.io/t/getting-the-current-sample-variable-value-so-it-can-be-used-to-compute-the-observed-inputs-in-a-secondary-model-likelihood/1414>\
**Category:** Questions\
**Created:** [June 22, 2018, 9:51pm UTC](https://discourse.pymc.io/t/getting-the-current-sample-variable-value-so-it-can-be-used-to-compute-the-observed-inputs-in-a-secondary-model-likelihood/1414 "2018-06-22T21:51:42Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Vital](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/vital/32/909_2.png) [@Vital](https://discourse.pymc.io/u/Vital)\
**Post date:** [June 23, 2018, 5:00pm UTC](https://discourse.pymc.io/t/getting-the-current-sample-variable-value-so-it-can-be-used-to-compute-the-observed-inputs-in-a-secondary-model-likelihood/1414/3 "2018-06-23T17:00:26Z")

</div>

Hello @junpenglao ! Thank you very much for your reply!

I have not been able to make that work because I need a function which can integrate under a theano vector.

However, in this post you shared there are people doing the same 🙂 :

That approach works: I can can integrate the specially if I apply an interpolation on the propopsed

> [@Using quad from scipy.integrate with pymc RVs as parameter](https://discourse.pymc.io/t/using-quad-from-scipy-integrate-with-pymc-rvs-as-parameter/613):
>
> I’m trying to write a custom random variable, in which I need to do numerical integration with pymc RVs as parameter. An example is stated as below: #define some pymc RVs a1=pm.Normal(‘a1’,mu=0,sd=1) a2=pm.Nromal(‘a2’,mu=0,sd=1) #the function to be integrated def f(x,p): retrun tt.power(x,p[0]\*p[1]) scipy.integrate.quad(f,0,1,args=[a1,a2]) However, quad would return an error since a1,a2 are not real number, and I can’t find something like a1.value() to get the current value of the random…

This seems like and old post: Maybe you know if someone has shared a working pymc3 code with a integration op for a y = f(x) function?

---

_[View the full topic](https://discourse.pymc.io/t/getting-the-current-sample-variable-value-so-it-can-be-used-to-compute-the-observed-inputs-in-a-secondary-model-likelihood/1414)._
