Sqrtvarbatch means sqrtnum batch end return mean

This preview shows page 16 - 17 out of 17 pages.

sqrt(var(batch _ means)) / sqrt(num _ batch); end return (mean _ ckpts, stdev _ ckpts); end tdist = TDist(num _ batch-1); 16
tq = quantile(tdist, .975); lams = [.5, .9, .95, .99]; widths _ common = zeros(length(lams), length(ckpts)); for ii = 1:length(lams) (mean _ ckpts, stdev _ ckpts) = BatchMeansCommon(lams[ii], num _ batch, num _ period, widths _ common[ii, :] = tq * stdev _ ckpts / sqrt(num _ batch); figure(); title(string( "Number of Batches = " , num _ batch)); ylabel( "Estimate" ); xlabel( "Simulation Length" ); ax = gca(); errorbar(ckpts, mean _ ckpts, yerr = widths _ common[ii, :], label= "batch means" ); ax[:legend](loc= "upper right" ) savefig(string(pwd(), "/figures/batch-means-difference-common" , " _ lambda=" , convert(Int64, 100 * lams[ii]), ".pdf" )); figure(); title( "Improvement in width of confidence interval" ); ylabel( "Improvement" ); xlabel( "Simulate Length" ); plot(ckpts, widths[ii, :] - widths _ common[ii, :]); savefig(string(pwd(), "/figures/batch-means-width-improvement-common" , " _ lambda=" , convert(Int64, 100 * lams[ii]), ".pdf" )); end 17

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture