Leverag: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
 
imported>Jeremy
(Importing text file)
Line 1: Line 1:
===Purpose===
===Purpose===
Calculates sample leverage.
Calculates sample leverage.
===Synopsis===
===Synopsis===
:lev = leverag(x,''rinv'')
:lev = leverag(x,''rinv'')
===Description===
===Description===
LEVERAG calculates the sample leverage according to
LEVERAG calculates the sample leverage according to
lev(i,1) = x(i,:)\*inv(x'\*x)\*x(i,:)'.
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 T<sup>2</sup> statistic.
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.
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.
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
If the optional input ''rinv'' is supplied then the leverage is calculated as
lev(i,1) = x(i,:)\*rinv\*x(i,:)'.
lev(i,1) = x(i,:)\*rinv\*x(i,:)'.
===See Also===
===See Also===
[[doptimal]], [[figmerit]], [[pls]], [[pcr]]
[[doptimal]], [[figmerit]], [[pls]], [[pcr]]

Revision as of 14:25, 3 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, pls, pcr