=================================以下開始複製=================================
#include <C:\devcpp\all.h>
double CHI2( double x )
{ return gam_den( x, 3.0/2, 2.0 );
}
int main()
{
long int i, j;
srand((unsigned)time(NULL));
cout.setf(ios::fixed); cout.precision(10);
// $$$$$$$$ Start your program here $$$$$$$$$$$$$$$$$$$$$
Matrix Y;
Y.read_from_file("c:\\devcpp\\anova.dat",2);
Y.print(3);
Univar sum_of_rank, sample_size, T_stat;
Kruskal_Wallis_Test(
Y, sum_of_rank, sample_size, T_stat
);
Y.print(3); sum_of_rank.print(1); sample_size.print(0);
T_stat.print(4);
cout.precision(6);
double P_value = 1.0 - X2_CDF(T_stat,3);
cout << "P_value = " << P_value << endl;
Univar KW;
for(i=0; i < 10000; i++)
{
Matrix Y2(21,1); Y2.uni_ran(10,30);
Y2.append_column(Y.col(1));
Kruskal_Wallis_Test(
Y2, sum_of_rank, sample_size, T_stat
);
KW.push_back(T_stat);
}
KW.freq_dist();
Univar KW2;
for(i=0; i < 10000; i++)
{
Matrix Y2(21,1); Y2.bin_ran(10000,0.5);
Y2.append_column(Y.col(1));
Kruskal_Wallis_Test(
Y2, sum_of_rank, sample_size, T_stat
);
KW2.push_back(T_stat);
}
KW.freq_dist();
Univar x = time_axis(0,20,1);
multi_dis G(x);
G.push_freq_dist(KW.freq_dist());
G.push_freq_dist(KW2.freq_dist());
G.push_function(CHI2);
G.print_to_file("c:\\devcpp\\G.dat",5);
/* Matrix Y3(21,1); Y3.bin_ran(1000,0.5);
Y3.print(1);*/
// $$$$$$$ End of your program $$$$$$$$$$$$$$$$$$$$$$$$$
cin.get();
return 0;
}
====================================複製結束==================================
--
▄ ▄ ████ ◤︵◣
六丁愛維尼* ▍ -◣ ◥██◤ ▊
˙ ▲ ◥ ◢█◣
▏ ◢███◣
◥ ╰◤ ▃▏ ▂ ◢█████◣
▋ /◥ ◤ ◥◤◥████◣
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.136.161.81
※ 編輯: weiching0323 來自: 140.136.161.81 (05/25 16:15)