Question

Please answer this question in both mathematically and with R. I need R code also.. Its urgent...3.14 For the variables in Table 3.4, define z 3y1 y2 2y3 (3,-1,2)y. Find z and sz in two ways: (a) Evaluate z for each row of Table 3.4 and find Z and s directly from 21,22,., 210 using (3.1) and (3.5). (b) Use zay and s2- aSa, as in (3.54) and (3.55).The sample mean of a random sample of n observations Y1, уг, . . . , yn ls given by the ordinary arithmetic average yi 7nThe variance of the population is defined as var(y-ơ2-E(y- )2. This is the average squared deviation from the mean and is thus an indication of the extent to which the values of y are spread or scattered. It can be shown that σ2-E(y2)- The sample variance is defined as (3.4) 7-1 which can be shown to be equal to (3.5) n-lThe sample mean of z can be found either by averaging the n values z1 - ayi,z2- дуг, . . . ,Zn _ ayn or as a linear combination of y, the sample mean vector of y1, y2, . .. , Vn: zi a у. (3.54) The result in (3.54) is analogous to the univariate result (3.3), z- ay, where zi - aVi,i 1,2 Similarly, the sample variance of Zi alyi, 2 1, 2, . n, can be found as the sample variance of 21, 22,... , 2n or directly from a and S, where S is the sample covariance matrix ofYu Уг, . . . , yni 2 Zi- 2 (3.55) TlTable 3.4 Calcium in Soil and Turnip Greens Location Number yıy2 уз 35 3.5 2.80 35 4.9 2.70 40 30.0 4.38 102.8 3.21 6 2.7 2.73 20 2.8 2.81 35 4.6 2.88 35 10.9 2.90 35 8.0 3.28 30 16 3.20 4 10

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) R code:

y1=c(35,35,40,10,6,20,35,35,35,30)
y2=c(3.5,4.9,30,2.8,2.7,2.8,4.6,10.9,8,1.6)
y3=c(2.80,2.70,4.38,3.21,2.73,2.81,2.88,2.90,3.28,3.20)
z=3*y1-y2+2*y3
mean(z)
sum(z^2)
s=(sum(z^2)-10*mean(z)^2)/9
s

Output:

> mean(z)
[1] 83.298
> sum(z^2)
[1] 78823.5
> s=(sum(z^2)-10*mean(z)^2)/9
> s
[1] 1048.659
10 1 0 ~i 83.298 10 Σ2 = 78823.5 10

(b)

R code:

y1=c(35,35,40,10,6,20,35,35,35,30)
y2=c(3.5,4.9,30,2.8,2.7,2.8,4.6,10.9,8,1.6)
y3=c(2.80,2.70,4.38,3.21,2.73,2.81,2.88,2.90,3.28,3.20)
s11=(sum(y1^2)-10*mean(y1)^2)/9
s22=(sum(y2^2)-10*mean(y2)^2)/9
s33=(sum(y3^2)-10*mean(y3)^2)/9
s12=(sum(y1*y2)-10*mean(y1)*mean(y2))/9
s13=(sum(y1*y3)-10*mean(y1)*mean(y3))/9
s23=(sum(y2*y3)-10*mean(y2)*mean(y3))/9
M=matrix(c(s11,s12,s13,s12,s22,s23,s13,s23,s33),nrow=3,ncol=3)
Mean_z=c(3,-1,2)%*%c(mean(y1),mean(y2),mean(y3))
var_z=c(3,-1,2)%*%M%*%c(3,-1,2)
Mean_z
var_z

Output:

> Mean_z
[,1]
[1,] 83.298
> var_z
[,1]
[1,] 1048.659

Add a comment
Know the answer?
Add Answer to:
Please answer this question in both mathematically and with R. I need R code also.. Its...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT