public class WilcoxonSignedRanksGUI
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener
WilcoxonSignedRanks - GUI Version |
Design Conditions (samples) 2 3 or more Between-subjects
(independent samples)Mann-Whitney U Kruskal Wallis Within-subjects
(correlated samples)Wilcoxon
Signed-RankFriedman
The test is also called the Wilcoxon Matched-Pairs Signed-Ranks Test. Without "Matched-Pairs" the test assumes one of the samples is a default or assumed score against which variations in the other sample are compared. Either way, the computations are identical.
The procedure involves first building an array of difference scores (the difference between pairs of values for each participant). Differences equal to zero are ignored (i.e., no difference). An array of ranks is then built from the array of difference scores. The ranks are tested to determine if there is a significant difference between the two conditions. More formally, the hypothesis evaluated is "whether or not in the underlying populations represented by the samples/experimental conditions, the median of the difference scores equals zero. If a significant difference is obtained it indicates there is a high likelihood the two samples/conditions represent two different populations" (D. J. Sheskin, Handbook of Parametric and Non-parametric Statistical Procedures, 5th ed., CRC Press, 2011, p. 809).
The test is intended for ordinal data, such as rankings, assessments, or questionnaire responses (where the responses are non-linear). Using the Wilcoxon Signed-Ranks test (or other non-parametric tests) for interval or ratio data over a parametric ANOVA is an option if there is a concern over the underlying assumptions in the distribution of the data. The researcher must bear in mind, however, that the data transformation bears a cost: Information is sacrificed. For example, interval or ratio scores of 80, 79, and 49 are converted to ranks 1, 2, and 3. Yes, information is sacrificed.
Launch WilcoxonSignedRankGUI from GoStats as follows:
The mean responses (not shown) were 6.4 for media player #1 (left) and 3.7 for media player #2 (right). Evidently, the participants preferred media player #1 over media player #2. But, was the difference in responses statistically significant or was it just a chance outcome? To determine this, the Wilcoxon Signed-Rank test is used:3 3 6 6 4 3 10 3 6 5 5 6 9 2 7 4 6 2 8 3
The test statistic is a z-score. Since the customary threshold for statistical significance is exceeded ( p < .05), we conclude there is indeed a difference between the two media players in their "cool appeal".
The test also provides z' which is corrected for ties. The difference is minor. NOTE: Correcting for ties is with reference to the difference scores, not to the raw scores. For example, the 3rd and 5th rows have difference scores of 1 (4 - 3 = 1, 6 - 5 = 1), thus generating a tie in the ranks.
StatView provides the following output using the above data set:
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae) |
void |
focusGained(java.awt.event.FocusEvent fe) |
void |
focusLost(java.awt.event.FocusEvent fe) |
double |
getP1()
Return the p statistic (probability) for this
WilcoxonSignedRank object. |
double |
getP2()
Return the p statistic (probability) for this
WilcoxonSignedRank object. |
double[] |
getRanks(double[] d)
Given an array of data, return an array of ranks (handles ties).
|
double |
getZ1()
Return the z statistic for this
WilcoxonSignedRank object. |
double |
getZ2()
Return the z statistic for this
WilcoxonSignedRank object. |
void |
itemStateChanged(java.awt.event.ItemEvent ie) |
double |
mean(double[] n)
Calculate the mean of the values in a double array.
|
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, updateaddNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFrontadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validateaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed in interface java.awt.event.ActionListenerpublic void focusGained(java.awt.event.FocusEvent fe)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent fe)
focusLost in interface java.awt.event.FocusListenerpublic void itemStateChanged(java.awt.event.ItemEvent ie)
itemStateChanged in interface java.awt.event.ItemListenerpublic double getZ1()
WilcoxonSignedRank object.public double getZ2()
WilcoxonSignedRank object. The statistic
is corrected for ties.public double getP1()
WilcoxonSignedRank object.public double getP2()
WilcoxonSignedRank object.
The statistic is corrected for ties.public double[] getRanks(double[] d)
25, 75, 80, 81, 75
the returned array contains
1.0, 2.5, 4.0, 5.0, 2.5
d - a double arraypublic double mean(double[] n)
n - a double array