WOLFRAM|DEMONSTRATIONS PROJECT

Estimating Conditional Expectations with Monte Carlo Simulation and Least Squares Regression

​
a
1
b
1
c
1
degree
2
new random sample
Conditional expectation of X given V
3
(X+Y+1)
is:
1
2
Root[
3
#1
+3
2
#1
+3#1-x+1&,1]
1<x≤8
1
2
(Root[
3
#1
+6
2
#1
+12#1-x+8&,1]+1)
8<x<27
Integrate
u$799296
1
0≤u$799296≤1∧0≤-u$799296+
3
x
-1≤1
0
True
3
2/3
x
Root
3
#1
+3
2
#1
+3#1-x+1&,1
3
2/3
x
1<x≤8
1-Root
3
#1
+6
2
#1
+12#1-x+8&,1
3
2/3
x
8<x<27
,{u$799296,-∞,∞},Assumptionsx≤1∨x≥27
True
Polynomial approximation: -0.00133472
2
x
+0.0676228x+0.03652
2
L
error: 0.030301
In this Demonstration we consider three random variables,
X
and
Y
, which are uniformly distributed on the interval [0,1] and
W=
3
(a+bX+cY)
, where
a
,
b
, and
c
are (user-specified) non-negative integers. The purpose is to compute the conditional expectation
E(X|W)
symbolically and by polynomial regression on data obtained from randomly generated sequences (
x
,
w
). The display shows the graphs of the conditional expectation function (red) and an estimate (green), explicit formulas giving the exact value of the conditional expectation and its polynomial estimate, and the
L
2
(square-integrable) error of the estimate, obtained by integrating the square of the difference between the true conditional expectation and the estimated one.
Use the controls to choose the values of
a
,
b
, and
c
and the degree of the polynomial to be used in the regression.