Nt1310 Unit 3 Assignment 2

115 Words1 Pages
*Q2 part a clear set obs 20 forvalues i=1/50 { set seed `i' gen Fx`i'=uniform() gen x`i'=-4*log(1-Fx`i') } set obs 50 forvalues i=1/50 { egen meana`i'=mean(x`i') } gen meana=. forvalues i=1/50 { replace meana=meana`i' in `i' } *Q2 part b hist meana set obs 50 forvalues i=1/50 { set seed `i' gen Fy`i'=uniform() gen y`i'=-4*log(1-Fy`i') egen meanb`i'=mean(y`i') } gen meanb=. forvalues i=1/50 { replace meanb=meanb`i' in `i' } hist meana, start(2) width(0.5) hist meanb, start(2) width(0.5) *Q2 part c *Note that the mean and standard deviation for this case would be 4 gen LHSA=4-(4/(20^.5)) gen RHSA=4+(4/(20^.5)) gen LHSB=4-(4/(50^.5)) gen RHSB=4+(4/(50^.5)) gen out1=cond(meanaRHSA,1,0) gen out2=cond(meanbRHSB,1,0)

More about Nt1310 Unit 3 Assignment 2