From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search


Window target factor analysis.


[rho,angl,q,skl] = wtfa(spec,tspec,window,p,options)


Calculates the angle between a set of target responses and a set of measured responses within sampled-windows of the measured responses. A PCA model is calculated from the samples included in each window. The resulting PCA loadings are then compared to the target responses via an angle calculation. A smaller angle indicates a more likely presence of the given target.

Unless squelched using the options input, a plot is created of the angle as a function of sample window position. Note that the output values near the end of the record (less than the half width of the window) are plotted as dashed lines and the window center is output in the variable skl.

This routine is based on work in: Lohnes, M.T., Guy, R.D., and Wentzell, P.D., "Window Target-Testing Factor Analysis: Theory and Application to the Chromatographic Analysis of Complex Mixtures with Multiwavelength Flourescence Detection", Anal. Chim. Acta, 389, 95-113 (1999).


  • spec = an M by N data matrix of measured responses
  • tspec = an K by N matrix of target responses
  • win = the window width window (must be > 1)
  • p = the number of principal components, PCs, for modeling each window of samples:
p >= 1: (integer) number PCs is a constant p,
0 < p < 1: sets a relative criterion for selecting number of PCs in each window i.e. only the first set of PCs that together capture >=p\*100Found of the variance in the window are used, or
p < 0: sets an absolute value for number of PCs i.e. factors with singular values <|p| are not used. EWFA (see EWFA) can be used as a guide for setting p when p<0.

Optional Inputs

  • options = optional input of options (see below).


  • rho = the cosines between tspec and the p component PCA model in each window
  • angl = the arccos of rho (acos(rho))
  • q = the Q residuals from the PCA model (higher value indicates a poorly fitting PCA model)
  • skl = the window center


options = a structure array with the following fields:

  • plots: [ 'none' | {'angle'} | 'rho' | 'q' ], governs plotting,
'none' squelches any plotting,
'angle' plots projection angle {default},
'rho', plots direction cosine, and
'q' plots Q residuals.
  • scale: [ ], is a M element time scale to plot against

See Also

evolvfa, ewfa, pca