# naginterfaces.library.correg.linregm_​stat_​resinf¶

naginterfaces.library.correg.linregm_stat_resinf(n, ip, res, h, rms)[source]

linregm_stat_resinf calculates two types of standardized residuals and two measures of influence for a linear regression.

For full information please refer to the NAG Library document for g02fa

https://www.nag.com/numeric/nl/nagdoc_29/flhtml/g02/g02faf.html

Parameters
nint

, the number of observations included in the regression.

ipint

, the number of linear parameters estimated in the regression model.

resfloat, array-like, shape

The residuals, .

hfloat, array-like, shape

The diagonal elements of , , corresponding to the residuals in .

rmsfloat

The estimate of based on all observations, , i.e., the residual mean square.

Returns
sresfloat, ndarray, shape

The standardized residuals and influence statistics.

For the observation with residual, , given in .

Is the internally standardized residual, .

Is the externally standardized residual, .

Is Cook’s statistic, .

Is Atkinson’s statistic, .

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: , for all .

(errno )

On entry, a value in is too large for given . and .

Notes

For the general linear regression model

 where y is a vector of length n of the dependent variable, X is an n×p matrix of the independent variables, β is a vector of length p of unknown parameters, and ϵ is a vector of length n of unknown random errors such that var(ϵ)=σ2I.

The residuals are given by

and the fitted values, , can be written as for an matrix . The th diagonal elements of , , give a measure of the influence of the th values of the independent variables on the fitted regression model. The values of and the are returned by linregm_fit().

linregm_stat_resinf calculates statistics which help to indicate if an observation is extreme and having an undue influence on the fit of the regression model. Two types of standardized residual are calculated:

1. The th residual is standardized by its variance when the estimate of , , is calculated from all the data; this is known as internal Studentization.

2. The th residual is standardized by its variance when the estimate of , is calculated from the data excluding the th observation; this is known as external Studentization.

The two measures of influence are:

1. Cook’s

2. Atkinson’s

References

Atkinson, A C, 1981, Two graphical displays for outlying and influential observations in regression, Biometrika (68), 13–20

Cook, R D and Weisberg, S, 1982, Residuals and Influence in Regression, Chapman and Hall