TITLE: Generalizations of the Robbins lemma and Gaussian integration by parts
QUESTION [10 upvotes]: This is getting no attention, so I'll try this here:

The Robbins lemma, named after Herbert Robbins, says that if $X\sim\operatorname{Poisson}(\lambda)$ and $g$ is a function for which $\operatorname{E}(|X g(X)|) < \infty,$ then $$\operatorname{E}(Xg(X)) = \lambda \operatorname{E}(g(X+1)).$$
"Gaussian integration by parts" is an identity that says that under suitable assumptions about the function $g$, if $X\sim N(0,\sigma^2),$ then $$ \operatorname{E}(Xg(X)) = \sigma^2\operatorname{E} (g\,'(X)). $$

Both of these propositions are used in empirical Bayes methods.
Both of these are of the form $$ \operatorname{E}(Xg(X)) = \operatorname{var}(X) \cdot \operatorname{E} ((Tg)(X)) $$
where $T$ is a linear operator on functions $g$.
QUESTION: Might there be, for each linear operator $T$, some probability distribution for which this holds? And might all of these be useful in empirical Bayes methods?
(P.S.) BETTER BUT LESS LOGICALLY PRECISE VERSION: Are both of these instances of some more general fact of interest?

REPLY [6 votes]: If I allow a probability distribution $P(X)=\delta(X)$ with ${\rm var}\,X=0$ then this solves the relation for any $T$ acting on functions $g(X)$ without a singularity at $X=0$, so that would be a trivial answer.
Let me therefore exclude the delta function distribution. Then there seems
seems to be a counterexample: take for $T$ the identity, and try $g=1$ and $g=X$; this gives the two equations
$$E(X)=E(X^2)-E(X)^2,\;\;E(X^2)=E(X)E(X^2)-E(X)^3$$
which have the only solution $E(X)=0$, $E(X^2)=0$, which is excluded.

REPLY [4 votes]: Note that  there always is a stupid answer. For any $T$  the Dirac delta at $0$ will do the trick.  However there are operators $T$ for which there does not exist a measure with nonzero variance.
Try the operator 
$$  Tg(x)=g'(x)-xg(x). $$
Suppose that there is a probability measure $\mu$ associated to it such that  $\newcommand{\bE}{\mathbb{E}}$ $\DeclareMathOperator{\var}{var}$
$$
\bE_\mu\big[ Xg(X)\big]= \var_\mu(X)\bE_\mu\big[ Tg(X)\big]. 
$$
$\newcommand{\si}{\sigma}$
 Set $\si^2:=\var_\mu[X]$. We deduce
$$(1+\si^2)\bE_\mu[Xg(X)\big]=\si^2\bE_\mu[g'(X)],\;\;\forall g. $$
If we take $g(x)=1$  we deduce $\bE[X]=0$.If we take $g(x)=x$ we deduce
$$ (1+\si^2)\si^2=(1+\si^2)\bE_\mu[X^2]=\si^2\bE_\mu[1]=\si^2 $$
which shows that $\si^2=0$ so $\mu$  must be the Dirac delta concentrated at the origin.