# Compute Mean and Variance for Random Choice

I have data

data={{179.1,63.,63.058},{319.,59.,58.765},{9310.7,62.,62.5512},{280.9,60.,60.33},
{18727.1,55.,55.4295},{453.4,66.,66.3213},{323.1,64.,64.0556},{3873.6,45.,45.4111},
{3243.8,68.,68.4577},{225.6,64.,64.4262},{2169.2,64.,64.7714},{599.9,50.,50.6418},
{2224.6,55.,55.0478},{11.2,53.,53.0255},{689.7,55.,54.8958},{309.4,67.,66.8753},{304.1,62.,62.0358},
{200.4,63.,63.1477},{978.9,67.,66.9423},{330.2,60.,59.8176},{642.2,64.,63.9326},{760.,52.,52.0627},
{1247.,41.,41.6266},{226.6,64.,64.3129},{21505.2,64.,64.5351},{12481.1,69.,70.0073},
{369.6,48.,48.1341},{3110.8,55.,55.2583},{3613.1,57.,57.8282},{977.,68.,67.825},{326.,68.,68.6339},
{252.3,60.,60.3246},{3902.8,41.,41.1936},{116.9,49.,49.112},{38.4,66.,65.7397},{978.8,40.,40.2495},
{6345.,61.,61.3724},{1182.,65.,65.7034},{4869.1,52.,52.6189},{73.6,63.,63.1238},{214.4,55.,54.8221},
{635.7,60.,60.4719},{91.6,62.,62.0529},{160.9,69.,68.9743},{7388.9,68.,69.1788},{81.6,48.,48.5237},
{3427.6,60.,60.3152},{7215.5,64.,64.263}};


From above data I select a sample of size 5, ten times. Using

data1 = RandomChoice[data, {10, 5}]


and compute Mean of each three as

data2 = Mean[RandomChoice[data, {10, 5}]]


Now I need to produce data3 as Mean of first values, Variance of second values and Mean of third values (e.g {a,b,c} 'a' is first value, 'b' is second and 'c' is third value in data). Don't know how to proceed, kindly help me in this regards.

Edit: The layout of output should be

{{Mean of first 10 values, Variance of first 10 values, Mean of first 10 values}, {Mean of second 10 values, Variance of second 10 values, Mean of secnd 10 values},...{Mean of fifth 10 values, Variance of fifth 10 values, Mean of fifth 10 values}}.

• {Mean@#[[All, 1]], Variance@#[[All, 2]], Variance@#[[All, 3]]} &@data1 like this, or if you're combining variance {Mean@#[[All, 1]], Variance@Flatten[#[[All, {2, 3}]]]} &@data1 May 28, 2015 at 18:09
• @Histograms I think both are not, because output should be in the form {{7377.46, 61.6, 61.9234}, {2101.14, 56.8, 57.0879}, {3596.62, 55.9, 56.3203}, {4024.1, 57.2, 57.6848}, {2191.48, 56.6, 56.9012}}
– SAAN
May 28, 2015 at 18:20
• Does this work {Mean[#[[All, 1]]], Variance[#[[All, 2]]], Mean[#[[All, 3]]]} & /@ RandomChoice[data, {10, 5}] ? I wasn't sure what layout you wanted before. Your layout in the edit is also inconsistent with what your sampling (you said you wanted a sample size of 5 ten times. If instead you want a sample size of 10, 5 times, change {10,5} to {5,10} May 28, 2015 at 18:57
• @Histograms Thanks, My initial thinking are same, but Mean[RandomChoice[data, {10, 5}]] de track me. Now I change data2 as well from your code.
– SAAN
May 29, 2015 at 4:38

MapThread[Compose, {{Mean, Variance, Mean}, Transpose[#]}] & /@ RandomChoice[data, {10, 5}]

{{1915.56, 132.3, 61.7223}, {466.92, 47.2, 60.1022}, {3570.78, 92.3,

p.s. you can read more about Compose in Is there a name for #1@#2&?. So it is not necessary, I just like it :)