Expectation over a list with nested-mapped expressions

I need expected values of a list where the random variable to take expectations over should be an input into expressions defined earlier. I suspect Set[] and SetDelayed[] tripped me. (Or Map and Table?)

I hope the intention is reasonably clear from the code: I am interested in expressions of six numbers in [0,1] where I suspect (model) that they have been measured with error (errors being independent and uniform here, but answers truncated to lie in the meaningful range anyway). I don't get the solution I expect, only an expression substituted into.

Input:

AList = {a1,a2,a3,a4,a5,a6}
answers := (Min[1,Max[# ,0]])& /@ (AList+errors)
deltasbetas = Expectation[dlist,errors\[Distributed]Table[UniformDistribution[],{6}]]

(note that errors are defined within Expectation, as I think it should be) Output:

{Min[1,Max[0,0.8 +UniformDistribution[{0,1}]]],Min[1,Max[0,0.7 +UniformDistribution[{0,1}]]],Min[1,Max[0,0.5 +UniformDistribution[{0,1}]]]/Min[1,Max[0,0.8 +UniformDistribution[{0,1}]]],Min[1,Max[0,0.4 +UniformDistribution[{0,1}]]]/Min[1,Max[0,0.7 +UniformDistribution[{0,1}]]]}
• what are AList and errors?
– rm -rf
Jul 13 '12 at 13:39
• I think you need to use TransformedDistribution ... but how?:)
– kglr
Jul 13 '12 at 14:41
• I think maybe you have to explicitly use something like {e1, e2, e3, e4, e5, e6} \[Distributed] UniformDistribution[{{0,1},{0,1},{0,1},{0,1},{0,1},{0,1}}] instead of just one errors variable. Jul 13 '12 at 14:56
• errors=Array[er,6] before you use errors; and then use errors \[Distributed] UniformDistribution[Table[{0, 1}, {6}] instead of errors \[Distributed] Table....
– kglr
Jul 13 '12 at 15:12
• @László, pls ignore the Thread comment. Regarding er going undefined, errors=Array[er,{6}] defines errors as a list with 6 elements with names er thru er. So, you can use the symbol errors instead of {e1,e2,...,e6}.
– kglr
Jul 13 '12 at 15:46

If there is no way to use a "list variable" for the random vector, an explicit list of scalars can be filled in with the right distribution, thanks to @Silvia:

underlying := {0.8, 0.7, 0.5, 0.4, 0.8, 0.7}
answers := (Min[1, Max[# , 0]]) & /@ (underlying + {e1, e2, e3, e4, e5, e6})
deltasbetas = Expectation[dlist,
{e1, e2, e3, e4, e5, e6} \[Distributed] UniformDistribution[Table[{0, 0.1}, {6}]]]

{0.85, 0.75, 0.647807, 0.600891}
• You are welcome :) Jul 13 '12 at 15:10

Using assumptions on the aList, namely, that all a[i]s are in the unit interval, we get symbolic results for Expectation:

aList = Array[a, {6}];
errors = Array[er, 6];
answers = (Min[1, Max[#, 0]]) & /@ (aList + errors);
deltasbetas = Expectation[dlist,
errors \[Distributed] UniformDistribution[Table[{0, 1}, {6}]],
Assumptions -> {And @@ Table[0 < a[i] <= 1, {i, 6}]}]

we get EDIT 1: For UniformDistribution[0,1/10]

Expectation[dlist,  errors \[Distributed]
UniformDistribution[Table[{0, 1/10}, {6}]], Assumptions -> {And @@ Table[0 < a[i] <= 1, {i, 6}]}]

we get Evaluating at underlying:

we get

{0.85, 0.75, 0.647807, 0.600891}

EDIT 2: Alternative specifications of the joint distribution under Expectation:

Expectation[dlist, errors \[Distributed]
ProductDistribution[Table[UniformDistribution[], {6}]],
Assumptions -> {And @@ Table[0 < a[i] <= 1, {i, 6}]}]

give the same result.

So does

trdist = TransformedDistribution[dlist,
errors \[Distributed] UniformDistribution[Table[{0, 1}, {6}]]];
Expectation[z, z \[Distributed] trdist,
Assumptions -> {And @@ Table[0 < a[i] <= 1, {i, 6}]}]
• Nice, thank you! So I can Manipulate the result be giving it values of aList (or a?) And still Plot the resulting list in terms of the range of the error distribution (simply numerically 1 in the example)? Jul 13 '12 at 16:30
• Only 40 more to 10k (which you should reach today). Congrats in advance! :)
– rm -rf
Jul 13 '12 at 18:43
• @R.M thank you!!
– kglr
Jul 13 '12 at 18:53