Difference between revisions of "Two Independent Sample T-Test"
(One intermediate revision by one other user not shown) | |||
Line 32: | Line 32: | ||
(TwoIndependentTResult) data.modelTwoIndependentT(methodA, methodB); | (TwoIndependentTResult) data.modelTwoIndependentT(methodA, methodB); | ||
//* modelTwoIndependentT: | //* modelTwoIndependentT: | ||
− | order of first and second | + | order of first and second arguments does NOT matter. */ |
if (result != null) { | if (result != null) { | ||
Line 62: | Line 62: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | |||
+ | {{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=Two_Independent_Sample_T-Test}} |
Latest revision as of 19:10, 21 January 2007
/* July 2006. Annie Che <chea@stat.ucla.edu>. UCLA Statistics. Source of example data: Mathematical Statistics and Data Analysis, John Rice, Second Edition. Page 390, example A, determination of the laten heat of fusion of ice. */ package edu.ucla.stat.SOCR.analyses.example; import java.util.HashMap; import edu.ucla.stat.SOCR.analyses.data.Data; import edu.ucla.stat.SOCR.analyses.result.TwoIndependentTResult; public class TwoIndependentTExample { public static void main(String args[]) { double[] methodA = {79.98, 80.04, 80.02, 80.04, 80.03, 80.03, 80.04, 79.97, 80.05, 80.03, 80.02, 80.00, 80.02}; double[] methodB = {80.02, 79.94, 79.98, 79.97, 79.97, 80.03, 79.95, 79.97}; // you'll need to instantiate a data instance first. Data data = new Data(); // then use the following line to get the result. try { TwoIndependentTResult result = (TwoIndependentTResult) data.modelTwoIndependentT(methodA, methodB); //* modelTwoIndependentT: order of first and second arguments does NOT matter. */ if (result != null) { // Getting the model's parameter estiamtes and statistics. double meanX = result.getMeanX(); double meanY = result.getMeanY(); // sum of variance of x and variance of y. double sampleVar = result.getSampleVariance(); int degreesFreedome = result.getDF(); double tStat = result.getTStat(); String pValue = result.getPValue(); System.out.println("meanX = " + meanX); System.out.println("meanY = " + meanY); System.out.println("sampleVar = " + sampleVar); System.out.println("degreesFreedome = " + degreesFreedome); System.out.println("tStat = " + tStat); System.out.println("pValue = " + pValue); } } catch (Exception e) { System.out.println(e); } } }
Translate this page: