Leverag: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Scott No edit summary |
||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Line 12: | Line 11: | ||
LEVERAG calculates the sample leverage according to | LEVERAG calculates the sample leverage according to | ||
lev(i,1) = x(i,:)\*inv(x'\*x)\*x(i,:)' | <pre>lev(i,1) = x(i,:)\*inv(x'\*x)\*x(i,:)'</pre> | ||
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. | ||
Line 20: | Line 19: | ||
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,:)' | <pre>lev(i,1) = x(i,:)\*rinv\*x(i,:)'</pre> | ||
===See Also=== | ===See Also=== | ||
[[doptimal]], [[figmerit]], [[pls]], [[pcr]] | [[doptimal]], [[figmerit]], [[pls]], [[pcr]] |
Revision as of 15: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,:)'