From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search


Generalized log transform.


ty = glog(y,lambda) %glog
ty = glog(y,lambda,y0) %extended glog
y = glog(ty,lambda,[],1) %INVERSE glog
y = glog(ty,lambda,y0,1) %INVERSE extended glog
[ty,lambda] = glog(y,[]) %OPTIMIZE: lambda
[ty,lambda,y0] = glog(y,[],nsd) %OPTIMIZE: lambda with extended glog


Generalized log transform is a weighted log following the equation:

ty = ln( (y-y0) + sqrt((y-y0)^2 + lambda) )

where lambda and y0 are experimentally determined constants. If the invflag input is passed as 1 (one), the function calculates the inverse transform using:

y = 0.5 * ( 2*y0 - lambda*exp(-ty) + exp(ty) )

OPTIMIZATION: If lambda is empty or omitted, an optimization is done. If y0 is zero or omitted also, a simple glog optimization is performed. If y0 is non-zero, then an extended glog optimization is performed where the passed y0 is interpreted as the number of standard deviations of estimated noise to use for the optimization (nsd = number of standard deviations). In general, optimizations should be done on a set of samples which are expected to be the same for a given experimental condition and should reflect a goodly portion of non-zero responses.

The glog method and the optimization is based on the paper:

NMR metabolomics data using the variance stabilising generalised logarithm transformation
Parsons, Ludwig, Günther, and Viant
BMC Bioinformatics 2007, 8:234 doi:10.1186/1471-2105-8-234
The electronic version of this article can be found online at:


  • y = Matrix of data (double) to transform.

Optional Inputs

  • lambda = Transform parameter. If omitted or empty, an optmization minimizing the difference between passed data is performed. The optimized lambda is returned as an output.
  • y0 = Offset for use in extended log (y0 is subtracted from y before calculating the transform) if omitted, empty, or zero, no offset is used (standard glog transform).
  • nsd = Passed in place of y0 ONLY when lambda is empty (indicating optimization mode). Represents the number of standard deviations of noise to use as an estimate for offset y0.
  • invflag = Flag governing calculation of the forward transform (when 0, zero) or the inverse transform (when 1, one).


  • ty = Transformed y.
  • lambda = The lambda used for transform.
  • y0 = The y0 used for transform.

See Also

arithmetic, logdecay