推 weiching0323:don't waste your time! 03/30 16:05
double x[14]=
{9,20,11,30,17,15};
Univar X(6,x);
X.print(0);
double TP,TN,T,Z;
Univar RP,RN;
Wilcoxon_signed_rank(X,16,RP,RN,TP,TN,T,Z);
RP.print(0);
RN.print(0);
cout.precision(4);
cout << TP <<" "<< TN <<" "<< T <<" "<< Z <<" "<< endl;
double P_value = 2.0*S_nor_CDF(Z);
cout << " P_value= " << P_value << endl;
cout << "Parametric Approach"<<endl;
double t=X.t_stat(16);
cout << "t_stat="<< t << endl;
P_value=t_2_tailed_prob(t,13);
cout << "P_value for t test="<< P_value<< endl<< endl;
Univar Y(30);
Y.nor_ran(50,3);
Y.print(2);
Wilcoxon_signed_rank(Y,48,RP,RN,TP,TN,T,Z);
RP.print(0);
RN.print(0);
cout.precision(4);
cout << TP <<" "<< TN <<" "<< T <<" "<< Z <<" "<< endl;
P_value = 2.0*S_nor_CDF(Z);
cout << " P_value= " << P_value << endl;
cout << "Parametric Approach"<<endl;
t=Y.t_stat(48);
cout << "t_stat="<< t << endl;
P_value=t_2_tailed_prob(t,29);
cout << "P_value for t test="<< P_value<< endl<< endl;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.136.161.80