swft - Shapiro-Wilk/Shapiro-Francia Tests
Example: [SW, SF] = swft(x_list, names, 1)
Input Arguements:
1) x_list - A numerical or cell matrix of data to be tested. Rows are
observations. Columns are treated as independent variables.
2) names (optional) - A single row cell array of variable names.
(Note: if x_list is a cell array, the first row can contain variable
names.) If the names argument is omitted, swft assigns
generic labels "var 1"..."var n" for display in output tables.
3) flag (optional) - In output tables substitute "< 0.0001" for p
values less than 0.0001:
0 (default) - display p values as calculated
1 - display "< 0.0001"
Output:
1) SW - A table containing the results of the Shapiro-Wilks test.
2) SF - A table containing the results of the Shapiro-Francia test.
The swft function calculates the Shapiro-Wilk and Shapiro-Francia tests for normal distributions. Sample sizes can range from 3-5000 for the Shapiro-Wilk test and 5-5000 for the Shapiro-Francia test. Both tests have been found to be relatively powerful compared to other normality tests.
The function takes a single input matrix in which rows are observations and columns are variables. If the input matrix has multiple columns, each is treated as an independent variable. If the input matrix is a cell array, the first row can contain variable names. Alternately, a separate list of variable names can be passed to the function. The function returns two tables, one for each test, displaying number of observations, skewness, kurtosis, the W/W' statistics, z score, and the corresponding p values.
Note: if the function is being used with a version of Matlab prior to
2018a, there is a short code block (line 166) that is currently commented
out that removes NaN's from the input matrix. Remove comment marks and
remove NaNs.
Cite As
Gardner-O'Kearny, William (2021). swft - Shapiro-Wilk/Shapiro-Francia Tests (https://www.mathworks.com/matlabcentral/fileexchange/<...>), MATLAB Central File Exchange. Retrieved March 13, 2021.
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.