Question: STA 4821 Homework 4 (Dumb Exercise, cont.) 30 Points The following BASIC code generates 10,000 values of a random variable Y, which is the sum
STA 4821 Homework 4 (Dumb Exercise, cont.) 30 Points The following BASIC code generates 10,000 values of a random variable Y, which is the sum X1 + X2. In each case, assume that X1 and X2 are independent realizations of the same random variable X. The program calculates the sample average, the sample variance, and the fraction of sample values Y that lie in the interval (a, b]. Adapt this simulation program (you may use BASIC or any other language) to calculate the values required to fill in the table for E(Y), V(Y), and P ( a < Y b) , where a and b are specified in Homework 0. In each case, show all theoretical calculations for E(Y), V(Y), and P ( a < Y b) . 100 FOR I = 1 TO 10000 generate X1 and X2 150 200 300 400 500 600 2 3 4 E(Y) theory simulation X Case 1 Y = X1 + X2 S1 = S1 + Y S2 = S2 + Y^2 IF (Y > a) AND (Y <= b) THEN C = C + 1 NEXT I PRINT S1/10000, S2/10000-(S1/10000)^2, C/10000 X ~ U(0,1) ( t < 0) 0 f x (t ) = 2 t 2 e ( t 0) 0 f x(t) = 2t 0 P(X=0.4) = 0.8 P(X=0.9) = 0.2 (t < 0 ) ( 0 t 1) (t > 1 ) V(Y) theory simulation P ( a < Y b) theory simulation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
