The following BASIC code generates 10,000 values of a random variable X and calculates the sample average, the sample variance, and the fraction of sample values that lie in the interval (a, b]. Adapt this simulation program (you may use BASIC or any other language) to: 1. Calculate the values needed to fill in the table for E(X), V(X) and Xb) P(a ≤ < , where a and b are specified in Homework 0. Show all theoretical calculations. 2. For each case, on a separate page, draw the graph of the theoretical distribution function Fx(t), fill in the table describing Fx(t), and plot the simulation values given in the table on the same graph as the theoretical distribution function.
100 FOR i = 1 TO 10000
200 S1 = S1 + X 300 S2 = S2 + X^2 400 IF (X > a) AND (X <= b) THEN c = c + 1 500 NEXT i 600 PRINT S1/10000, S2/10000 –(S1/10000)^2, c/10000