Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
The idea of the program is: CIs are built for coefficient of variation of lognormal distribution. Coverage probabilities and mean interval widths of these CIs are calculated using simulation work. This is done in the following steps: (1) Assuming mu=1 and different values of sigma such that sigma=0.04996, 0.09975, 0.19804, 0.38525, I calculated the true value of lognormal distribution coefficient of variation using these sigmas to check later if these true values fall in the constructed CIs and calculate coverage probabilities and mean interval widths for different sigmas. (2) Outer loop to generate 5000 independent data sets from normal with mu=1 and the values of sigma mentioned in step (1) with sample sizes 15, 50, 100 to calculate sample variances and keep them in the matrix v. (3) (a) For each value of sample variance in matrix v, 5000 independent data sets were generated from normal with mu=1 and the values of sigma mentioned in step (1) with sample sizes 15, 50, 100 to calculate independent copy of sample variances (var2 in the program) rather than these calculated in step (2). (b) Calculate: FGlognor=sqrt(exp((v[i,]/var2)*(sigmasq))-1) and rank them from smallest to largest and pick only two values; low = # 125 and up= # 4875. If the true value of coefficient of variation falls between low and up, then count (in the program) is increased by one and the outer loop will be repeated for 5000 times. (4) After the outer loop is ended, the coverage probability is calculated by p (in the program) and also mean interval width (meanwid in the program). The results show that for each sample size, the coverage probability is exactly the same for different values of sigmas with different values of mean interval widths. For example, for n=15, the coverage probability=0.9476 with mean interval widths = 0.0414048, 0.0833589, 0.1710152, 0.3767665, 0.5040093 for sigma=0.04996, 0.09975, 0.19804, 0.38525 respectively. I checked the calculations of the program for small number of simulations (10 times) and they are correct. I tried different ways for generating data sets from normal (mu, sigma) but still the same results. I appreciate your help to discover the wrong part of the program. The following is the program: /*Prog to construct CI for COV of of lognormal dist. using Simple random sampling technique*/ proc iml; sigma=0.47238; sigmasq=sigma**2;/*the value of sigma in normal dist.*/ print sigmasq; mu=1; mun=exp(mu+(0.5*sigmasq));/*the value of mean in lognormal dist.*/ print mun; sigmasqn=exp((2*mu)+(2*sigmasq))-exp((2*mu)+(sigmasq));/*the value of sigmasquare in lognormal dist.*/ sigman=sqrt(sigmasqn);/*the value of sigma in lognormal dist.*/ print sigman; toi=sigman/mun; print toi; na=5000; nb=5000; n=15;/*number of observations in the matrix*/ print n; r=j(5000,1,0); s=j(5000,1,0); count=0; v=j(5000,1,0); *Generate 5000 data sets from normal dist. to calculate mean1, std1, estcov1; do t=1 to na; x1=j(n,1,0);/* allocate (n x 1) matrix*/ call randseed(12345); call randgen(x1, "Normal", mu, sigma); /* fill it*/ mean1=x1[:];/* calculate the mean of all elements of the matrix */ sumsq1=x1[##];/* calculate the sum of squares of all elements of the matrix */ var1=(1/(n-1))*(sumsq1-n*(mean1**2)); v[t,1]=var1; end; *Generate 5000 data sets from normal dist. to calculate independent copy of the statistics mean1, std1, estcov1; do i=1 to na; do k=1 to nb; x2=j(n,1,0);/* allocate (n x 1) matrix*/ call randseed(67891); call randgen(x2, "Normal", mu, sigma); /* fill it*/ mean2=x2[:];/* calculate the mean of all elements of the matrix */ sumsq2=x2[##];/* calculate the sum of squares of all elements of the matrix */ var2=(1/(n-1))*(sumsq2-n*(mean2**2)); FGlognor=sqrt(exp((v[i,]/var2)*(sigmasq))-1); r[k,1]=FGlognor; end;/*end of k loop*/ e=r; r[rank(r),]=e; low=r[125,]; up=r[4875,]; wid=up-low; s[i,]=wid; *Check if toi in the constructed FGCIs; if low<=toi then if toi<=up then count=count+1; end;/*end of i loop*/ p=count/5000; print p; q=1-p; print q; meanwid=s[:,]; print meanwid; quit; run;