nag_regsn_std_resid_influence (g02fac) (PDF version)
g02 Chapter Contents
g02 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_regsn_std_resid_influence (g02fac)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_regsn_std_resid_influence (g02fac) calculates two types of standardized residuals and two measures of influence for a linear regression.

2  Specification

#include <nag.h>
#include <nagg02.h>
void  nag_regsn_std_resid_influence (Integer n, Integer ip, Integer nres, const double res[], const double h[], double rms, double sres[], NagError *fail)

3  Description

For the general linear regression model is defined by
y = X β + ε  
where y is a vector of length n  of the dependent variable,
  X is an n  by p  matrix of the independent variables,
  β is a vector of length p  of unknown arguments,
and ε is a vector of length n  of unknown random errors such that varε = σ 2 I .
The residuals are given by
r = y - y ^ = y - X β ^ .  
The fitted values, y ^ = X β ^ , can be written as Hy  for an n  by n  matrix H . The i th diagonal element of H , h i , gives a measure of the influence of the i th value of the independent variables on the fitted regression model. The values of r  and the h i  are returned by nag_regsn_mult_linear (g02dac).
nag_regsn_std_resid_influence (g02fac) 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:
(a) The i th residual is standardized by its variance when the estimate of σ 2 , s 2 , is calculated from all the data; known as internal studentization.
RI i = r i s 1 - h i .  
(b) The i th residual is standardized by its variance when the estimate of σ 2 , s -i 2  is calculated from the data excluding the i th observation; known as external studentization.
RE i = r i s -i 1 - h i = r i n-p - 1 n - p - R I i 2 .  
The two measures of influence are:
(a) Cook's D  
D i = 1 p RE i 2 h i 1 - h i  
(b) Atkinson's T  
T i = RE i n-p p h i 1 - h i .  

4  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

5  Arguments

1:     n IntegerInput
On entry: number of observations included in the regression, n .
Constraint: n > ip + 1 .
2:     ip IntegerInput
On entry: the number of linear arguments estimated in the regression model, p .
Constraint: ip1 .
3:     nres IntegerInput
On entry: the number of residuals.
Constraint: 1 nres n .
4:     res[nres] const doubleInput
On entry: the residuals, r i .
5:     h[nres] const doubleInput
On entry: the diagonal elements of H , h i , corresponding to the residuals in res.
Constraint: 0.0 < h[i] < 1.0 , for i=0,1,,nres - 1.
6:     rms doubleInput
On entry: the estimate of σ 2  based on all n  observations, s 2 , i.e., the residual mean square.
Constraint: rms>0.0 .
7:     sres[nres×4] doubleOutput
On exit: the standardized residuals and influence statistics.
For the observation with residual given in res[i] :
  • sres[i×4]  is the internally studentized residual
  • sres[i×4+1]  is the externally studentized residual
  • sres[i×4+2]  is Cook's D  statistic
  • sres[i×4+3]  is Atkinson's T  statistic.
8:     fail NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_2_INT_ARG_GT
On entry, nres=value  while n=value . These arguments must satisfy nresn .
NE_2_INT_ARG_LE
On entry, n=value  while ip + 1 = value. These arguments must satisfy n > ip + 1 .
NE_INT_ARG_LT
On entry, ip=value.
Constraint: ip1.
On entry, nres=value.
Constraint: nres1.
NE_REAL_ARG_GE
On entry, h[value]  must not be greater than or equal to 1.0: h[value] = value.
NE_REAL_ARG_LE
On entry, h[value]  must not be less than or equal to 0.0: h[value] = value.
On entry, rms must not be less than or equal to 0.0: rms=value .
NE_RESID_LARG
On entry, the value of a residual is too large for the given value of rms: res[value] = value, rms=value .

7  Accuracy

Accuracy is sufficient for all practical purposes.

8  Parallelism and Performance

Not applicable.

9  Further Comments

None.

10  Example

A set of 24 residuals and h i  values from an 11 argument model fitted to the cloud seeding data considered in Cook and Weisberg (1982) are input and the standardized residuals etc calculated and printed for the first 10 observations.

10.1  Program Text

Program Text (g02face.c)

10.2  Program Data

Program Data (g02face.d)

10.3  Program Results

Program Results (g02face.r)


nag_regsn_std_resid_influence (g02fac) (PDF version)
g02 Chapter Contents
g02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015