NAG Library Routine Document
g01ahf
(withdraw_plot_scatter_normal)
1
Purpose
g01ahf performs a Normal probability plot on a character printing device, with a chosen number of character positions in each direction.
2
Specification
Fortran Interface
Subroutine g01ahf ( |
x,
nobs,
nstepx,
nstepy,
istand,
iwork,
nscores,
lwork,
xsort,
xbar,
xstd,
ifail) |
Integer, Intent (In) | :: |
nobs,
nstepx,
nstepy,
istand,
lwork | Integer, Intent (Inout) | :: |
ifail | Integer, Intent (Out) | :: |
iwork(nobs) | Real (Kind=nag_wp), Intent (In) | :: |
x(nobs) | Real (Kind=nag_wp), Intent (Out) | :: |
nscores(nobs),
xsort(nobs),
xbar,
xstd |
|
C Header Interface
#include nagmk26.h
void |
g01ahf_ (
const double x[],
const Integer *nobs,
const Integer *nstepx,
const Integer *nstepy,
const Integer *istand,
Integer iwork[],
double nscores[],
const Integer *lwork,
double xsort[],
double *xbar,
double *xstd,
Integer *ifail) |
|
3
Description
In a Normal probability plot, the data are plotted against Normal scores . The degree of linearity in the resultant plot provides a visual indication of the Normality of distribution of a set of residuals from some fitting process, such as multiple regression.
The data values are sorted into descending order prior to plotting, and may also be standardized to zero mean and unit standard deviation, if requested.
The plot is produced on a character printing device, using a chosen number of character positions in each direction. The output is directed to the current advisory message unit number (see the
Users' Note for your implementation). This number may be changed by an appropriate call to
x04abf before calling
g01ahf.
Axes are drawn and annotated and data points are plotted on the nearest character position. An appropriate step size for each axis is computed from the list
- power of .
Points are plotted using the digits to to indicate the equivalent number of observations at a particular character position, a letter A–Z for occurrences, or * if there are or more coincident occurrences. Zero axes are marked if included in the plotting area.
4
References
None.
5
Arguments
- 1: – Real (Kind=nag_wp) arrayInput
-
On entry: the vector of data values.
Constraint:
all data values must not be equal.
- 2: – IntegerInput
-
On entry: the number of data values.
Constraint:
.
- 3: – IntegerInput
-
On entry: the number of steps (character positions) to be plotted in the
-direction. If the supplied value of
nstepx is less than
, the value
will be used by
g01ahf. The maximum value for
nstepx is the number of character positions available on the chosen output device less
, up to a maximum of
. If
nstepx exceeds
on input, the value
will be used by the routine.
- 4: – IntegerInput
-
On entry: the number of steps (character positions) to be plotted in the
-direction. If the supplied value of
nstepy is less than
, the value
will be used by
g01ahf. There is no maximum value for
nstepy, but you should bear in mind that (
) records (lines) of output are generated by the routine.
- 5: – IntegerInput
-
On entry: indicates whether the residuals are to be standardized prior to plotting.
If
, the elements of
x are standardized to zero mean and unit standard deviation.
- 6: – Integer arrayWorkspace
-
- 7: – Real (Kind=nag_wp) arrayOutput
-
On exit: the Normal scores in ascending magnitude.
- 8: – IntegerInput
-
On entry: this argument is no longer referenced, but is included for backwards compatability.
- 9: – Real (Kind=nag_wp) arrayOutput
-
On exit: the data values, sorted into descending order, and standardized if
istand was positive on entry.
- 10: – Real (Kind=nag_wp)Output
-
On exit: the mean of the data values.
- 11: – Real (Kind=nag_wp)Output
-
On exit: the standard deviation of the data values.
- 12: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
-
All the supplied data values are equal.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
Accuracy is limited by the number of plotting positions available.
8
Parallelism and Performance
g01ahf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
For details of timing see
g01agf and
g01daf.
No blank records are output before or after the plot.
You must make sure that it is permissible to write records containing
nstepx characters to the current advisory message unit.
10
Example
The data are residuals from a linear regression. The values are standardized and plotted against the Normal scores, and are seen to follow a straight line fairly closely, indicating that Normality assumptions are justified.
10.1
Program Text
Program Text (g01ahfe.f90)
10.2
Program Data
Program Data (g01ahfe.d)
10.3
Program Results
Program Results (g01ahfe.r)