Java Statistical Classes

jsc.datastructures
Class PairedData

java.lang.Object
  |
  +--jsc.datastructures.PairedData

public class PairedData
extends Object

This class represents two samples, X and Y, of paired (related) data. The data are supplied in the form of two arrays, x and y, of real (double) values.

Version:
1.0
Author:
A. J. Bertie.

Constructor Summary
PairedData(double[][] data)
          Construct the paired data structure from a matrix with two columns.
PairedData(double[] x, double[] y)
          Construct the paired data structure from two arrays.
 
Method Summary
 double[] differences()
          Subtracts the elements of array y from corresponding elements of array x and returns the array of differences.
 int getN()
          Return number of paired data values.
 double[] getX()
          Return sample x data.
 double[] getY()
          Return sample y data.
 String toString()
          Returns a string representation of the object in the form of a table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PairedData

public PairedData(double[] x,
                  double[] y)
Construct the paired data structure from two arrays. The structure is formed from the paired data of the two samples stored in two arrays of equal length.

Parameters:
x - the data of sample X.
y - the data of sample Y.
Throws:
IllegalArgumentException - if length of arrays are not equal or zero.

PairedData

public PairedData(double[][] data)
Construct the paired data structure from a matrix with two columns. Samples X and Y are in the first and second columns respectively.

Parameters:
data - the data matrix of sample X.
Throws:
IllegalArgumentException - if number of pairs is zero.
ArrayIndexOutOfBoundsException - if a row of the data matrix contains < 2 values.
Method Detail

differences

public double[] differences()
Subtracts the elements of array y from corresponding elements of array x and returns the array of differences.

Returns:
the array x - y.

getN

public int getN()
Return number of paired data values.

Returns:
number of pairs.

getX

public double[] getX()
Return sample x data.

Returns:
sample x.

getY

public double[] getY()
Return sample y data.

Returns:
sample y.

toString

public String toString()
Returns a string representation of the object in the form of a table.

Overrides:
toString in class Object
Returns:
string representation of the object.

Java Statistical Classes

Copyright © Andrew James Bertie, 2005, all rights reserved. Updated 12th Aug 2005