6
scale <- 1.0; shape <- 2.0;
7
# mean and variances of the distribution of sample averages:
8
avg.exp <- scale*gamma(1+1/shape);
9
avg.var <- (scale^2*gamma(1+2/shape) - avg.exp^2)/10;
10
# generate the entire data:
11
data <- matrix(rweibull(n=10000, shape=shape, scale=scale), nrow=10);
12
# get the sample averages:
13
avg <- colMeans(data);
14
# generate random normal samples:
15
normX <- seq(from=min(avg), to=max(avg), length=1000);
16
normY <- dnorm (normX, mean = avg.exp, sd = sqrt(avg.var));
17
dist.hist <- hist(avg, plot=FALSE, breaks="Sturges");
18
# calculate the ylims appropriately:
19
ylim <- c(0,max(c(dist.hist$density, normY)));
22
plot(dist.hist, ylim=ylim, freq=FALSE, lty="solid", density=-1, xlab="Sample Averages", main="Weibull")
23
lines (x=normX, y=normY, type="l", col="red")
27
.rk.rerun.plugin.link(plugin="rkward::plot_weibull_clt", settings="drawnorm.state=1\nfunction.string=hist\nhistogram_opt.addtoplot.state=\nhistogram_opt.barlabels.state=\nhistogram_opt.density.real=-1.00\nhistogram_opt.doborder.state=1\nhistogram_opt.freq.state=0\nhistogram_opt.histbordercol.color.string=\nhistogram_opt.histbreaksFunction.string=Sturges\nhistogram_opt.histlinetype.string=solid\nhistogram_opt.rightclosed.state=1\nhistogram_opt.usefillcol.state=\nnAvg.real=10.00\nnDist.real=1000.00\nnormlinecol.color.string=red\nnormpointtype.string=l\nplotoptions.add_grid.state=0\nplotoptions.asp.real=0.00\nplotoptions.main.text=\nplotoptions.pointcolor.color.string=\nplotoptions.pointtype.string=\nplotoptions.sub.text=\nplotoptions.xaxt.state=\nplotoptions.xlab.text=\nplotoptions.xlog.state=\nplotoptions.xmaxvalue.text=\nplotoptions.xminvalue.text=\nplotoptions.yaxt.state=\nplotoptions.ylab.text=\nplotoptions.ylog.state=\nplotoptions.ymaxvalue.text=\nplotoptions.yminvalue.text=\nscale.real=1.0\nscalenorm.state=0\nshape.real=2.0", label="Run again")