Lamsel and Leverag: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
 
imported>Scott
 
Line 1: Line 1:
===Purpose===
===Purpose===


Determine indices of wavelength axes in specified ranges.
Calculates sample leverage.


===Synopsis===
===Synopsis===


:inds = lamsel(freqs,ranges,''out'')
:lev = leverag(x,''rinv'')


===Description===
===Description===


LAMSEL determines the indices of the elements of a wavelength or wavenumber axis within the ranges specified. Inputs are the wavelength or wavenumber axis freqs and an ''m'' by 2 matrix defining the wavelength ranges to select ranges.
LEVERAG calculates the sample leverage according to


An optional input ''out'' suppresses displaying information to the command window when set to 0.
<pre>lev(i,1) = x(i,:)\*inv(x'\*x)\*x(i,:)'</pre>


The output inds is a vector of indices of channels in the specified range(s) inclusive.
Note that the leverage calculation should include a term for calculation of the offset (''e.g.'' see Draper, N. and Smith, H., "Applied Regression Analysis, Second Edition", John Wiley & Sons, New York, N.Y., 1981), but the above formula contains the salient information. This, in effect, assumes that the data have been mean centered and the constant term related to estimating the offset has been ignored. If x'\*x is replaced by x'\*x/(m-1) where m is the number of rows of x, and x has been mean centered then this is the equation for Hotelling's T<sup>2</sup> statistic.


===Examples===
Note that if x is not of full rank then inv(x'\*x) won't exist, or if x is nearly rank deficient then calculation of the inverse will be unstable. In these cases, the scores from principal components analysis can be used.


inds = lamsel(lamda,[840 860; 1380 1400]);
If the optional input ''rinv'' is supplied then the leverage is calculated as


outputs the indices of the elements of lamda between 840 and 860 and between 1380 and 1400.
<pre>lev(i,1) = x(i,:)\*rinv\*x(i,:)'</pre>


===See Also===
===See Also===


[[baseline]], [[savgol]], [[specedit]]
[[doptimal]], [[figmerit]], [[pcr]], [[pls]]

Revision as of 16:31, 18 September 2008

Purpose

Calculates sample leverage.

Synopsis

lev = leverag(x,rinv)

Description

LEVERAG calculates the sample leverage according to

lev(i,1) = x(i,:)\*inv(x'\*x)\*x(i,:)'

Note that the leverage calculation should include a term for calculation of the offset (e.g. see Draper, N. and Smith, H., "Applied Regression Analysis, Second Edition", John Wiley & Sons, New York, N.Y., 1981), but the above formula contains the salient information. This, in effect, assumes that the data have been mean centered and the constant term related to estimating the offset has been ignored. If x'\*x is replaced by x'\*x/(m-1) where m is the number of rows of x, and x has been mean centered then this is the equation for Hotelling's T2 statistic.

Note that if x is not of full rank then inv(x'\*x) won't exist, or if x is nearly rank deficient then calculation of the inverse will be unstable. In these cases, the scores from principal components analysis can be used.

If the optional input rinv is supplied then the leverage is calculated as

lev(i,1) = x(i,:)\*rinv\*x(i,:)'

See Also

doptimal, figmerit, pcr, pls