### Example 2: NormTwoSample

The same data is used for this example as for the initial example.

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

```
import com.imsl.stat.*;

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);
}
}
```

#### Output

```x1mean-x2mean  = -50.476190476190496
X1 mean = 91.85714285714285
X2 mean = 142.33333333333334
pooledVar = 434.6326530612244
95% CI for the mean is -73.01001962529507 -27.942361327085916
95% CI for the ueq mean is -73.01001962529507 -27.942361327085916
T Test Results
T default = 14.0
t = -4.8043615047163355
p-value = 2.8025836567727923E-4
stdev x1 = 20.87605144201182
stdev x2 = 20.826665599658526
```