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 () YbPa ≤< , where a and b are specified in Homework 0. In each case, show all theoretical calculations for E(Y), V(Y), and ( ) YbPa ≤< .

100 FOR I = 1 TO 10000

generate X1 and X2

150 Y = X1 + X2 200 S1 = S1 + Y 300 S2 = S2 + Y^2 400 IF (Y > a) AND (Y <= b) THEN C = C + 1 500 NEXT I 600 PRINT S1/10000, S2/10000-(S1/10000)^2, C/10000

2019-01-19T08:42:56+00:00
Maths