从已知数据列中进行放回(或不放回)抽样,再统计每个样本的均值及分布,这个脚本如何编辑?例如,有2000个数据,每次随机抽取20个数据计算其均值,一共抽取100次,计算这100个样本的均值以及分布状况;
Here is a script to take 100 subsets and calculate the mean:
dt = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" ); :Latitude << Format("Best"); dt << Select Where( Is Missing( :Latitude ) ) << Delete Rows;<BR /><BR />runs = 100;<BR />//runs= 100000; results = new table("results", add rows (runs), new column ("mean")); rows = index (1, nrows(dt)); for each({i},index(1,runs), myRows = Random Shuffle( rows)[1::20]; data = dt[myRows, "Latitude"]; results[i,"mean"]=Mean(data); ); my Mean = Col Mean(:mean); Show(myMean);
... and the mean of the means.
And with this script, you can use the Distribution platform to fit the 100 mean values with "all" available distributions:
dist = results << Distribution(Continuous Distribution(Column( :mean )); ); dist << Fit All
What do you mean by calculating distribution?
Thanks!