In: Statistics and Probability
The dataset "chickwts" you can access in R
Weight Feed
1 179 horsebean
2 160 horsebean
3 136 horsebean
4 227 horsebean
5 217 horsebean
6 168 horsebean
Let X1, .... X6 be random variables for the 6 different feedtypes. Let
xj =∑ xij /n
and
s2 =∑ (xij -xj )^2 / n
be estimators for the mean and variance of the chickweights for each of the feedtypes. Find the values of thee estimators for each. Assume these random variables are independent. use your estimates for expected value and variance to assign constants c1..c6 such that
E(c1X1 + ...c6X6) = 300
Separately select constants such that, d1, ... d6
Var(d1X1 +...d6X6) = 2500
Are these constants the same? Could they ever be?
All R commands are shown in bold.
Determine the levels of feed.
levels(chickwts$feed)
[1] "casein" "horsebean" "linseed" "meatmeal" "soybean" "sunflower"
Mean and variance of the chickweights for each of the feedtypes are
> mean(chickwts$weight[chickwts$feed ==
"casein"])
[1] 323.5833333
> mean(chickwts$weight[chickwts$feed ==
"horsebean"])
[1] 160.2
> mean(chickwts$weight[chickwts$feed ==
"linseed"])
[1] 218.75
> mean(chickwts$weight[chickwts$feed ==
"meatmeal"])
[1] 276.9090909
> mean(chickwts$weight[chickwts$feed ==
"soybean"])
[1] 246.4285714
> mean(chickwts$weight[chickwts$feed ==
"sunflower"])
[1] 328.9166667
Variance of each feedtypes are
> var(chickwts$weight[chickwts$feed ==
"casein"])
[1] 4151.719697
> var(chickwts$weight[chickwts$feed ==
"horsebean"])
[1] 1491.955556
> var(chickwts$weight[chickwts$feed ==
"linseed"])
[1] 2728.568182
> var(chickwts$weight[chickwts$feed ==
"meatmeal"])
[1] 4212.090909
> var(chickwts$weight[chickwts$feed ==
"soybean"])
[1] 2929.956044
> var(chickwts$weight[chickwts$feed ==
"sunflower"])
[1] 2384.992424
We can assign any random values to c1..c5 and then calculate c6 such that E(c1X1 + ...c6X6) = 300
Let c1 = c2 = c3 = c4 = c5 = 0.2
then,
0.2 * (323.5833333 + 160.2 + 218.75 + 276.9090909 + 246.4285714) + c6 328.9166667 = 300
=> 245.1741991 + c6 328.9166667 = 300
=> c6 = (300 - 245.1741991) / 328.9166667 = 0.1667
Thus, c1 = c2 = c3 = c4 = c5 = 0.2 and c6 = 0.1667 makes
E(c1X1 + ...c6X6) = 300
Similarly, we can assign any random values to d1..d5 and then calculate d6 such that Var(d1X1 +...d6X6) = 2500
Let d1 = d2 = d3 = d4 = d5 = 0.2
Var(d1X1 +...d6X6) = 2500
=> d12 Var(X1) + ... + d62 Var(X1) = 2500
then, 0.04 * (4151.719697 + 1491.955556 + 2728.568182 + 4212.090909 + 2929.956044) + d6 2384.992424 = 2500
=> 620.5716155 + d6 2384.992424 = 2500
=> c6 = (2500 - 620.5716155) / 2384.992424 = 0.788
Thus, d1 = d2 = d3 = d4 = d5 = 0.2 and d6 = 0.788 makes
Var(d1X1 +...d6X6) = 2500
No, these constants are not same.