The code below (from a book) is supposed to calculate the "norm score" of an array. The array is populated from the "dvec" range on an Excel spreadsheet, which is used to populate the Znmat array.
Then the z scores and "norm scores" are calculated. The last part of the code (which I have left out) deals with plotting the data in a Normal Probability Plot.
1. What is the meaning of a "norm score"? Why is it calculated as the NORMSINV of the rank divided by the total number of elements?
2. What is the meaning of the "continuity correction"? How does it work?
These issues are not explained in the book, since the code is provided only as an example for creating a graph in Excel.
' returns n by 2 matrix where n = no. of elements in dvec
' 1st col z-scores, 2nd col normscores for n obs.
Dim M, V, r, c
Dim i As Integer, n As Integer
Dim Znmat() As Variant
Dim dvec As Range
'data input from worksheet
Set dvec = Sheets("Data").Range("dvec") 'dvec as Range object
n = Application.Count(dvec)
ReDim Znmat(n, 2)
M = Application.Average(dvec)
V = Application.Var(dvec)
For i = 1 To n
Znmat(i, 1) = (dvec(i) - M) / Sqr(V)
r = Application.Rank(dvec(i), dvec, 1)
c = (r - 3 / 8) / (n + 1 / 4)
Znmat(i, 2) = Application.NormSInv(c)