package com.imsl.test.example.stat; import com.imsl.stat.*; /** *

* Performs a difference in means test with incremental updates. *

*

* The same data is used for this example as for the example * {@link NormTwoSampleEx1}.

*

* This example demonstrates how the analysis can be applied to subsets of the * original data set using different update methods. These techniques may be * useful when analyzing data sets too large to fit into memory.

* * @see Code * @see Output */ public class NormTwoSampleEx2 { public static void main(String args[]) { // Bring in first group of observations on x1 and x2. // 2 observations first and then 1 observation. double[] x1blk = {72.0, 75.0}; double[] x2blk = {111.0, 118.0}; NormTwoSample n2samp = new NormTwoSample(x1blk, x2blk); // Use different update methods. double[] x1blk1 = {77.0}; double[] x2blk1 = {128.0}; n2samp.updateX(x1blk1); n2samp.updateY(x2blk1); // Second group. double[] x1blk2 = {80.0, 104.0, 110.0, 125.0}; double[] x2blk2 = {138.0, 140.0, 150.0, 163.0}; n2samp.update(x1blk2, x2blk2); // Third group. double[] x2blk3 = {164.0, 169.0}; n2samp.updateY(x2blk3); double mean = n2samp.getDiffMean(); System.out.println("x1mean-x2mean = " + mean); System.out.println("X1 mean = " + n2samp.getMeanX()); System.out.println("X2 mean = " + n2samp.getMeanY()); double pVar = n2samp.getPooledVariance(); System.out.println("pooledVar = " + pVar); double loCI = n2samp.getLowerCIDiff(); double upCI = n2samp.getUpperCIDiff(); System.out.println("95% CI for the mean is " + loCI + " " + upCI); loCI = n2samp.getLowerCIDiff(); upCI = n2samp.getUpperCIDiff(); System.out.println("95% CI for the ueq mean is " + loCI + " " + upCI); System.out.println("T Test Results"); double tDF = n2samp.getTTestDF(); double tT = n2samp.getTTest(); double tPval = n2samp.getTTestP(); System.out.println("T default = " + tDF); System.out.println("t = " + tT); System.out.println("p-value = " + tPval); double stdevX = n2samp.getStdDevX(); double stdevY = n2samp.getStdDevY(); System.out.println("stdev x1 = " + stdevX); System.out.println("stdev x2 = " + stdevY); } }