作者ko7751 (雨茜)
看板FJU-STAT95B
標題[正經] ya
時間Tue Apr 27 16:14:42 2010
#include <C:\devcpp\all.h>
double Chi2_CDF(double x)
{ return X2_CDF(x,8);
}
int main()
{
long int i, j;
srand((unsigned)time(NULL));
cout.setf(ios::fixed); cout.precision(10);
// $$$$$$$$ Start your program here $$$$$$$$$$$$$$$$$$$$$
Matrix X;
X.read_from_file("C:\\devcpp\\RC.dat",3);
X.print(0);
X.X2_test().print(3);
double X2=X.X2_test();
cout<<"critical Value alfa =0.05"<<endl;
cout<<root_of(Chi2_CDF,0.95,8)<<endl;
cout<<"C.V. alfa =0.005"<<endl;
cout<<root_of(Chi2_CDF,0.995,8)<<endl;
cout<<"P_value="<<endl;
cout.precision(10);
cout<<1.0-Chi2_CDF(X2)<<endl;
Univar Chi2;
for(i=0;i<10000;i++)
{
double X2 = X.random_RC().X2_test();
Chi2.push_back(X2);
}
//Chi2.freq_dist();
cout<<"Monte Carlo P_value="<<endl;
cout.precision(6);
cout<<1.0-Chi2.emp_CDF(X2)<<endl;
Univar x=time_axis(0,50,1);
multi_dis G(x);
G.push_freq_dist(Chi2.freq_dist());
G.print_to_file("c:\\devcpp\\O.dat",4);
// $$$$$$$ End of your program $$$$$$$$$$$$$$$$$$$$$$$$$
cin.get();
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.136.161.83
噓 weiching0323:別搶我工作!!!!!!!!!!!!!! 04/27 16:15
→ ko7751:我在搶救男友!!!! 04/27 16:15
推 abidog:究竟誰才有受過最專業的統計訓練 04/27 16:15