cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Tod0931
Level I

对已知数据列进行抽样,统计其均值分布的脚本

从已知数据列中进行放回(或不放回)抽样,再统计每个样本的均值及分布,这个脚本如何编辑?例如,有2000个数据,每次随机抽取20个数据计算其均值,一共抽取100次,计算这100个样本的均值以及分布状况;

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XIII

Re: 对已知数据列进行抽样,统计其均值分布的脚本

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;

runs = 100;
//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

hogi_0-1766783776928.png

View solution in original post

3 REPLIES 3
jthi
Super User

Re: 对已知数据列进行抽样,统计其均值分布的脚本

What do you mean by calculating distribution?

-Jarmo
hogi
Level XIII

Re: 对已知数据列进行抽样,统计其均值分布的脚本

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;

runs = 100;
//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

hogi_0-1766783776928.png

Tod0131
Level I

Re: 对已知数据列进行抽样,统计其均值分布的脚本

Thanks!

Recommended Articles