Facemorph.Stats
Class Functions

java.lang.Object
  extended by Facemorph.Stats.Functions

public class Functions
extends java.lang.Object

A set of static statistical funtcions


Nested Class Summary
static class Functions.StatisticsException
           
 
Constructor Summary
Functions()
           
 
Method Summary
static double dotProduct(double[] left, double[] right)
          Return the inner (dot) product for two vectors
static double magnitude(double[] vec)
           
static void main(java.lang.String[] args)
           
static double[] multiply(double[] vec, double scalar)
           
static void multiplyInPlace(double[] vec, double scalar)
           
static void multiplyInPlace(double[] vec, double[] vec2)
           
static double[] normalize(double[] vec)
           
static void normalizeInPlace(double[] vec)
           
static double rSqr(double[] y, double[] yhat)
          Calcuate the R^2 (coefficient of determination) for an estimator
static double[] scale(double[] v, double s)
           
static void scaleInPlace(double[] v, double s)
           
static double[] subtract(double[] lhs, double rhs)
           
static double[] subtract(double[] lhs, double[] rhs)
           
static double SumSquaredResiduals(double[] y, double[] yhat)
          Calculate the sum of squared residuals between predicted and actual values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

rSqr

public static double rSqr(double[] y,
                          double[] yhat)
Calcuate the R^2 (coefficient of determination) for an estimator

Parameters:
y - the original values of the variable
yhat - the estimated values of the variable by some measure
Returns:

SumSquaredResiduals

public static double SumSquaredResiduals(double[] y,
                                         double[] yhat)
Calculate the sum of squared residuals between predicted and actual values

Parameters:
y - the original values of the dependent
yhat - the estimated values by the regression
Returns:
sum of squared residuals

dotProduct

public static double dotProduct(double[] left,
                                double[] right)
Return the inner (dot) product for two vectors

Parameters:
left - first vector
right - second vector
Returns:
inner product
Throws:
BigMatException - if the two vectors are no the same length

scale

public static double[] scale(double[] v,
                             double s)

scaleInPlace

public static void scaleInPlace(double[] v,
                                double s)

normalize

public static double[] normalize(double[] vec)

normalizeInPlace

public static void normalizeInPlace(double[] vec)

subtract

public static double[] subtract(double[] lhs,
                                double[] rhs)

subtract

public static double[] subtract(double[] lhs,
                                double rhs)

magnitude

public static double magnitude(double[] vec)

multiplyInPlace

public static void multiplyInPlace(double[] vec,
                                   double[] vec2)

multiplyInPlace

public static void multiplyInPlace(double[] vec,
                                   double scalar)

multiply

public static double[] multiply(double[] vec,
                                double scalar)

main

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