$$q = \int_{-1}^{\infty} xe^{-x-1}\sin{x} \,dx$$
How can I use the Monte Carlo integration method to find out the estimate of q and its standard error, using n iid samples generated from Exp(1) ?
$$q = \int_{-1}^{\infty} xe^{-x-1}\sin{x} \,dx$$
How can I use the Monte Carlo integration method to find out the estimate of q and its standard error, using n iid samples generated from Exp(1) ?
Copyright © 2021 JogjaFile Inc.
Suggestion
Using $u=x+1$ gives
$$ q=\int^\infty_{-1}x e^{-(x+1)}\sin(x)\,dx =\int^\infty_0(x-1)e^{-x}\sin(x-1)\,dx$$
Try $$\hat{q}_n=\Big(\frac{1}{n}\sum^n_{k=1}(X_k-1)\sin(X_k-1)\Big)$$ as an estimate for $q$, and $$ \frac{1}{n-1}\sum^n_{k=1}((X_k-1)\sin(X_k-1)-\hat{q}_n)^2 $$ as an estimate of its variance. If you do the whole integration by parts (or do some numerical integration other than MC), the variance can be estimated by $$ \frac{1}{n}\sum^n_{k=1}((X_k-1)\sin(X_k-1)-q)^2 $$
Here us an short R code: