//datas: indicates the differences of the pairs
package Statistics;
public class ComputingPairedTT {
// private float[] datas = {4,4,1,2,-3,5,3,2,-4,2,1,-1,2,7,0,7,6,3,4,-1};
private float[] datas = {-2,-1,1,0,-6,-6,-5,-10,-4};
public double ComputingSD(double mean){
float sum = 0;
for (int i =0; i < datas.length ; i++){
sum += (datas[i] - mean) * (datas[i] - mean);
}
return Math.sqrt(sum / (datas.length - 1) );
}
public double ComputingTT(){
double m = ComputingMean();
double se = ComputingSE(ComputingSD(m));
return m / se;
}
public double ComputingSE(double sd){
return sd / Math.sqrt(datas.length);
}
public double ComputingMean(){
float sum = 0;
for (int i = 0; i < datas.length ; i++){
sum += datas[i];
}
return sum/datas.length ;
}
public static void main(String[] args){
ComputingPairedTT csd = new ComputingPairedTT();
double mean = csd.ComputingMean();
System.out.println(mean);
double c = csd.ComputingSD(mean);
System.out.println(c);
double se = csd.ComputingSE(c);
System.out.println(se);
double tt = csd.ComputingTT();
System.out.println(tt);
}
}
Hi all, This Blog is an English archive of my PhD experience in Imperial College London, mainly logging my research and working process, as well as some visual records.
Thursday, 23 August 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment