Performing Shapiro-Wilk test on TI-84

On TI-84, although the Shapiro-Wilk test is not available as built-in function, it is possible to calculate the W statistics by using the calculator’s rich set of list and statistics function. It is not trivial, but doable.

First set up a list of sample values. Using the example from the original Shapiro-Wilk paper, the samples are input into a list called W, while the N variable denotes the dimension and U stores inverse of its square root. The data sample in W must be sorted in ascending order.

shapiro84-2 shapiro84-1

Next is to generate the M list based on W. This list is to calculate the inverse normal distribution based on the index value and the dimension of W list. Doing this in TI-84 is easy with the help of the seq() function. The complete expression is:
seq(invNorm( (I-0.375) / (N+0.25), 0, 1), I, 1, N, 1)

shapiro84-3 shapiro84-4

Now that the List M is ready, it is time to derive the sum of square of it and we store it into variable m (not the list M).
shapiro84-5

Since the approximation algorithm is used instead of look up table as proposed in the original paper, the next step is to prepare List A. This list is arranged in such a way that the first two and last two elements have different calculation than all the others. The last two values (N-1, N) of List A are prepared in the Y5 and Y6 equations. These are approximating equations. The first two elements are the negation of these two in a particular order.
shapiro84-6 shapiro84-7

One more variable, ε, has to be calculated at this point before we generate List A.
(m - 2*M(N)² - 2*M(N-1)²) / (1 - 2*Y6² - 2*Y5²)
shapiro84-8

Next is to generate the List A. As explained, four elements namely the first, second, N-1, and N elements of this list is calculated unlike all other elements. The screen below is for all except that four special elements.
shapiro84-9

The remaining steps for the four elements of this List A are then carried out as below.
shapiro84-10

Finally, all three lists are ready for calculation.
shapiro84-11

To calculate the W statistics, use the Linear Regression function in the TI-84 as below for W and A. The correlation coefficient r² is the W statistics as shown in R. See the next installment for the Z statistic and P value calculations from this W statistic, also on the TI-84.

shapiro84-14 shapiro84-18

Advertisements

3 thoughts on “Performing Shapiro-Wilk test on TI-84

  1. Pingback: Shapiro-Wilk test for normality | gmgolem

  2. Pingback: P value of Shapiro-Wilk test on TI-84 | gmgolem

  3. Pingback: Graphical visualization of data distribution in TI-84 and R | gmgolem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s