edu.ucla.stat.SOCR.analyses.command.volume
Class VolumeMultipleRegression

java.lang.Object
  extended by edu.ucla.stat.SOCR.analyses.command.volume.VolumeMultipleRegression

public class VolumeMultipleRegression
extends java.lang.Object


Constructor Summary
VolumeMultipleRegression()
           
 
Method Summary
static int byteArrayToInt(byte[] b, int offset)
          Convert the byte array to an int starting from the given offset.
static double[] getNextInputDataBuffer(int data_type, int xLength, boolean flush)
          This method READS IN a bufferSize chunk of all input volumes and returns it as a double[]
static byte[] intToBytes(int v)
          Convert an int to an array of 4 bytes.
static boolean isRegressorValid(java.util.HashSet<java.lang.String> validRegressors, Regressor newRegressor)
          this method helps the parseRegressors method above in particular, it takes a list of validated regressor variables and a not-yet-validated regressor variable if the new variable is valid, this method returns true if not, then it returns false; the criteria for validity is described in the description of parseRegressors
static byte[] longToBytes(long v)
          Convert a long to an array of 8 bytes.
static void main(java.lang.String[] args)
           
static boolean parseRegressors(java.util.StringTokenizer st)
          check regressor list for interactions in particular, each interaction variable must be composed of individual regressor variables that are also included in the regressor list; for instance, if we have an interaction variable A*B*C, we must have (minimally): -regressors A,B,C,A*B,B*C,A*C,A*B*C
static void putNextOutputDataBuffer(double[] constantIntercept_P_B_R_T, double[] pValue, double[] beta, double[] rPartCor, double[] tStat, int independentLength, boolean writeResultsOrDefaults, boolean flush)
          This method WRITES OUT bufferSize chunks of all output volumes
static void setByteOrder(javax.imageio.stream.MemoryCacheImageInputStream dis, java.lang.String byteorder)
          This method sets the Bite-Order for a MemoryCacheImageInputStream
static void setByteOrder(javax.imageio.stream.MemoryCacheImageOutputStream dos, java.lang.String byteorder)
          This method sets the Bite-Order for a MemoryCacheImageOutputStream
static byte[] shortToBytes(short v)
          Convert a short to an array of 2 bytes.
static void skipNextInputDataBuffer(int data_type, int xLength, boolean flush)
          This method SKIPS in reading data from the bufferSize chunk of all input volumes
static char swapChar(byte[] b, int offset)
          Returns the char resulting from swapping 2 bytes at a specified offset in a byte array.
static double swapDouble(byte[] b, int offset)
          Returns the double resulting from reversing 8 bytes at a specified offset in a byte array.
static double swapDouble(double v)
          Returns the double resulting from reversing 8 bytes of a specified double.
static float swapFloat(byte[] b, int offset)
          Returns the float resulting from reversing 4 bytes at a specified offset in a byte array.
static float swapFloat(float v)
          Returns the float resulting from reversing 4 bytes of a specified float.
static int swapInt(byte[] b, int offset)
          Returns the int resulting from reversing 4 bytes at a specified offset in a byte array.
static int swapInt(int v)
          Returns the int resulting from reversing 4 bytes of a specified int.
static long swapLong(byte[] b, int offset)
          Returns the long resulting from reversing 8 bytes at a specified offset in a byte array.
static long swapLong(long l)
          Returns the long resulting from reversing 8 bytes of a specified long.
static short swapShort(byte[] b, int offset)
          Returns the short resulting from swapping 2 bytes at a specified offset in a byte array.
static short swapShort(short s)
          Returns the short resulting from swapping 2 bytes of a specified short.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VolumeMultipleRegression

public VolumeMultipleRegression()
Method Detail

main

public static void main(java.lang.String[] args)

parseRegressors

public static boolean parseRegressors(java.util.StringTokenizer st)
check regressor list for interactions in particular, each interaction variable must be composed of individual regressor variables that are also included in the regressor list; for instance, if we have an interaction variable A*B*C, we must have (minimally): -regressors A,B,C,A*B,B*C,A*C,A*B*C


isRegressorValid

public static boolean isRegressorValid(java.util.HashSet<java.lang.String> validRegressors,
                                       Regressor newRegressor)
this method helps the parseRegressors method above in particular, it takes a list of validated regressor variables and a not-yet-validated regressor variable if the new variable is valid, this method returns true if not, then it returns false; the criteria for validity is described in the description of parseRegressors


setByteOrder

public static void setByteOrder(javax.imageio.stream.MemoryCacheImageInputStream dis,
                                java.lang.String byteorder)
This method sets the Bite-Order for a MemoryCacheImageInputStream

Parameters:
dis - - MemoryCacheImageInputStream
byteorder - - String representation of byteorder. Options are big (java.nio.ByteOrder.BIG_ENDIAN) little (java.nio.ByteOrder.LITTLE_ENDIAN) system (default system byteorder, java.nio.ByteOrder.nativeOrder())

setByteOrder

public static void setByteOrder(javax.imageio.stream.MemoryCacheImageOutputStream dos,
                                java.lang.String byteorder)
This method sets the Bite-Order for a MemoryCacheImageOutputStream

Parameters:
dis - - MemoryCacheImageOutputStream
byteorder - - String representation of byteorder. Options are big (java.nio.ByteOrder.BIG_ENDIAN) little (java.nio.ByteOrder.LITTLE_ENDIAN) system (default system byteorder, java.nio.ByteOrder.nativeOrder())

getNextInputDataBuffer

public static double[] getNextInputDataBuffer(int data_type,
                                              int xLength,
                                              boolean flush)
This method READS IN a bufferSize chunk of all input volumes and returns it as a double[]

Parameters:
data_type - - type of the input data
xLength - - number of volumes/subjects in the second-column (file-names) in the Design-matrix
flush - - boolean variable indicating whether the buffer should be flushed as the stream keeps in memory all the data it has read from disk. This will free up memory, but too frequent calls (frequent flushing will slow down the process!)

putNextOutputDataBuffer

public static void putNextOutputDataBuffer(double[] constantIntercept_P_B_R_T,
                                           double[] pValue,
                                           double[] beta,
                                           double[] rPartCor,
                                           double[] tStat,
                                           int independentLength,
                                           boolean writeResultsOrDefaults,
                                           boolean flush)
This method WRITES OUT bufferSize chunks of all output volumes

Parameters:
constantIntercept_P_B_R_T - contains the pValue, Beta, R_PartCorr and TStat parameters of the intercept in the GLM
pValue - is a Probability value outputed by (MultiLinearRegressionResult) Result object
beta - is a beta/regression value outputted by (MultiLinearRegressionResult) Result object
rPartCor - is a partial-correlation outputted by (MultiLinearRegressionResult) Result object
tStat - is a T-statistics as outputed by (MultiLinearRegressionResult) Result object
independentLength - - integer value representing the number of Independent X Variables
writeResultsOrDefaults - - true==results; false=Default
flush - - Boolean variable indicating whether the buffer should be flushed as teh ...keeps in memory all the data it has read from disk. This will free up memory, but too frequent calls (flush==true) will slow down the process!

skipNextInputDataBuffer

public static void skipNextInputDataBuffer(int data_type,
                                           int xLength,
                                           boolean flush)
This method SKIPS in reading data from the bufferSize chunk of all input volumes

Parameters:
data_type - - type of the input data
xLength - - number of volumes/subjects in the second-column (file-names) in the Design-matrix
flush - - boolean variable indicating whether the buffer should be flushed as the stream keeps in memory all the data it has read from disk. This will free up memory, but too frequent calls (frequent flushing will slow down the process!)

swapShort

public static short swapShort(byte[] b,
                              int offset)
Returns the short resulting from swapping 2 bytes at a specified offset in a byte array.

Parameters:
b - the byte array
offset - the offset of the first byte
Returns:
the short represented by the bytes b[offset+1], b[offset]

swapInt

public static int swapInt(byte[] b,
                          int offset)
Returns the int resulting from reversing 4 bytes at a specified offset in a byte array.

Parameters:
b - the byte array
offset - the offset of the first byte
Returns:
the int represented by the bytes b[offset+3], b[offset+2], ..., b[offset]

swapLong

public static long swapLong(byte[] b,
                            int offset)
Returns the long resulting from reversing 8 bytes at a specified offset in a byte array.

Parameters:
b - the byte array
offset - the offset of the first byte
Returns:
the long represented by the bytes b[offset+7], b[offset+6], ..., b[offset]

swapFloat

public static float swapFloat(byte[] b,
                              int offset)
Returns the float resulting from reversing 4 bytes at a specified offset in a byte array.

Parameters:
b - the byte array
offset - the offset of the first byte
Returns:
the float represented by the bytes b[offset+3], b[offset+2], ..., b[offset]

swapDouble

public static double swapDouble(byte[] b,
                                int offset)
Returns the double resulting from reversing 8 bytes at a specified offset in a byte array.

Parameters:
b - the byte array
offset - the offset of the first byte
Returns:
the double represented by the bytes b[offset+7], b[offset+6], ..., b[offset]

swapChar

public static char swapChar(byte[] b,
                            int offset)
Returns the char resulting from swapping 2 bytes at a specified offset in a byte array.

Parameters:
b - the byte array
offset - the offset of the first byte
Returns:
the char represented by the bytes b[offset+1], b[offset]

swapShort

public static short swapShort(short s)
Returns the short resulting from swapping 2 bytes of a specified short.

Parameters:
s - input value for which byte reversal is desired
Returns:
the value represented by the bytes of s reversed

swapInt

public static int swapInt(int v)
Returns the int resulting from reversing 4 bytes of a specified int.

Parameters:
v - input value for which byte reversal is desired
Returns:
the value represented by the bytes of v reversed

swapLong

public static long swapLong(long l)
Returns the long resulting from reversing 8 bytes of a specified long.

Parameters:
l - input value for which byte reversal is desired
Returns:
the value represented by the bytes of l reversed

swapFloat

public static float swapFloat(float v)
Returns the float resulting from reversing 4 bytes of a specified float.

Parameters:
v - input value for which byte reversal is desired
Returns:
the value represented by the bytes of v reversed

byteArrayToInt

public static int byteArrayToInt(byte[] b,
                                 int offset)
Convert the byte array to an int starting from the given offset.

Parameters:
b - The byte array
offset - The array offset
Returns:
The integer

swapDouble

public static double swapDouble(double v)
Returns the double resulting from reversing 8 bytes of a specified double.

Parameters:
v - input value for which byte reversal is desired
Returns:
the value represented by the bytes of v reversed

shortToBytes

public static byte[] shortToBytes(short v)
Convert a short to an array of 2 bytes.

Parameters:
v - input value
Returns:
the corresponding array of bytes

intToBytes

public static byte[] intToBytes(int v)
Convert an int to an array of 4 bytes.

Parameters:
v - input value
Returns:
the corresponding array of bytes

longToBytes

public static byte[] longToBytes(long v)
Convert a long to an array of 8 bytes.

Parameters:
v - input value
Returns:
the corresponding array of bytes