You are here: Symbol Reference > StatProbPlots Namespace > Functions > StatProbPlots.StatNormalPlot Function
Stats Master VCL
ContentsIndex
PreviousUpNext
StatProbPlots.StatNormalPlot Function

Constructs the Normal Probability Chart.

Pascal
procedure StatNormalPlot(const Data: TVec; const XDrawVec: TVec; const YDrawVec: TVec; out MinX: double; out MaxX: double; out MinY: double; out MaxY: double; const StdErrs: TVec = nil; const DataSorted: boolean = true);
Parameters 
Description 
Data 
Data to be drawn. The assumption is data values are sorted. 
XDrawVec 
Returns normal probability plot horizontal values to be drawn - > estimated quantiles from Data vector or in this case sorted Data values. 
YDrawVec 
Returns normal probability plot vertical values to be drawn - > Values are generated from theoretical standard normal distribution with parameters mu=0, sigma^2=1
MinX 
Returns slope line start X point, XDrawVec 25th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series. 
MaxX 
Returns slope line end X point, XDrawVec 75th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series. 
MinY 
Returns slope line start Y point, YDrawVec 25th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series. 
MaxY 
Returns slope line end Y point, YDrawVec 75th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series. 
StdErrs 
Standard error 
DataSorted 
If true, algorithm assumes Data is already sorted in ascending order. If Data is not sorted, you must set this parameter to false so that internal algorithm will automatically do the sorting. 

How to construct Normal distribution probability plot? 

  1. If needed, Data values are sorted (DataSorted parameter must be set to false).
  2. Abscissa drawing values are formed by estimated data quantiles - ordered Data values. After calculation they are copied to XDrawVec. crefTMtxVecBase.Length and crefTMtxVec.Complex properties of XDrawVec are adjusted automatically.
  3. Ordinate drawing values are formed by using theoretical probability p i.e the so Z values. After calculation they are copied to YDrawVec. crefTMtxVecBase.Length and crefTMtxVec.Complex properties of YDrawVec are adjusted automatically.
  4. XDrawVec and YDrawVec 25th and 75th percentile points are used to construct a reference line. Drawing points departures from this straight line indicate departures from normality.

 

The normal probability plot is used to answer the following questions:

  • Are the data normally distributed?
  • What is the nature of the departure from normality (data skewed, shorter than expected tails, longer than expected tails)?

Dew.Stats.Tee.ProbabilityPlot

The following code will create probability plot and then plot calculated values.

Uses MtxExpr, StatProbPlots, StatSeries, Math387, MtxVecTee;
procedure Example(Series1: TStatProbSeries);
var Data, XVec, YVec: Vector;
  X1,Y1,X2,Y2: double;
begin
  // generate some random values for Data vec
  Data.Size(100);
  Data.RandGauss(0.0,1.0); // standard norm. dist.
  StatNormalPlot(Data,XVec,YVec,X1,X2,Y1,Y2,false);
  With Series1 do
  begin
    MinX := X1;
    MinY := Y1;
    MaxX := X2;
    MaxY := Y2;
  end;
  DrawValues(XVec,YVec,Series1);
end;

 

#include "Math387.hpp"
#include "MtxExpr.hpp"
#include "StatProbPlots.hpp"
#include "StatSeries.hpp"
#include "MtxVecTee.hpp"
void __fastcall Example(TStatProbSeries * Series1);
{
  sVector data,xvec,yvec;
  double x1,x2,y1,y2;

  data.Size(100,false);
  data.RandGauss(0.0,1.0); // standard distribution
  StatNormalPlot(data,xvec,yvec,x1,x2,y1,y2,false);
  Series1->MinX = x1;
  Series1->MaxX = x2;
  Series1->MinY = y1;
  Series1->MaxY = y2;
  DrawValues(xvec,yvec,Series1);
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!