h1.toy(x)
h2.toy(x)
1
.h1()
operates on a vector: for dataframes, use
H1.toy()
which is a wrapper for apply(D1, 1, h1)
. NB If the definition of h1.toy()
or h2.toy()
is
changed, then function hbar.toy()
must be changed to match.
This cannot be done automatically, as the form of hbar.toy()
depends on the distribution of X
. The shibboleth is whether
E_X()
commutes with h_1()
; it does in this case but does
not in general (for example, consider
$h(x,\theta)=c(1,x,x^2)$ and $X\sim
N(m,V)$. Then $E_X(h(x,\theta))$ will
be $(1,m,m^2+V,\theta)$; note the V).
H1.toy