
Statistics and Machine Learning Toolbox™
User's Guide
R2019b

How to Contact MathWorks
Latest news:
www.mathworks.com
Sales and services:
www.mathworks.com/sales_and_services
User community:
www.mathworks.com/matlabcentral
Technical support:
www.mathworks.com/support/contact_us
Phone: 508-647-7000
The MathWorks, Inc.
1 Apple Hill Drive
Natick, MA 01760-2098
Statistics and Machine Learning Toolbox™ User's Guide
© COPYRIGHT 1993–2019 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by,
for, or through the federal government of the United States. By accepting delivery of the Program or
Documentation, the government hereby agrees that this software or documentation qualies as commercial
computer software or commercial computer software documentation as such terms are used or dened in
FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this
Agreement and only those rights specied in this Agreement, shall pertain to and govern the use,
modication, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conicting contractual terms or conditions. If this License fails to meet the
government's needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.

Revision History
September 1993 First printing Version 1.0
March 1996 Second printing Version 2.0
January 1997 Third printing Version 2.11
November 2000 Fourth printing Revised for Version 3.0 (Release 12)
May 2001 Fifth printing Minor revisions
July 2002 Sixth printing Revised for Version 4.0 (Release 13)
February 2003 Online only Revised for Version 4.1 (Release 13.0.1)
June 2004 Seventh printing Revised for Version 5.0 (Release 14)
October 2004 Online only Revised for Version 5.0.1 (Release 14SP1)
March 2005 Online only Revised for Version 5.0.2 (Release 14SP2)
September 2005 Online only Revised for Version 5.1 (Release 14SP3)
March 2006 Online only Revised for Version 5.2 (Release 2006a)
September 2006 Online only Revised for Version 5.3 (Release 2006b)
March 2007 Eighth printing Revised for Version 6.0 (Release 2007a)
September 2007 Ninth printing Revised for Version 6.1 (Release 2007b)
March 2008 Online only Revised for Version 6.2 (Release 2008a)
October 2008 Online only Revised for Version 7.0 (Release 2008b)
March 2009 Online only Revised for Version 7.1 (Release 2009a)
September 2009 Online only Revised for Version 7.2 (Release 2009b)
March 2010 Online only Revised for Version 7.3 (Release 2010a)
September 2010 Online only Revised for Version 7.4 (Release 2010b)
April 2011 Online only Revised for Version 7.5 (Release 2011a)
September 2011 Online only Revised for Version 7.6 (Release 2011b)
March 2012 Online only Revised for Version 8.0 (Release 2012a)
September 2012 Online only Revised for Version 8.1 (Release 2012b)
March 2013 Online only Revised for Version 8.2 (Release 2013a)
September 2013 Online only Revised for Version 8.3 (Release 2013b)
March 2014 Online only Revised for Version 9.0 (Release 2014a)
October 2014 Online only Revised for Version 9.1 (Release 2014b)
March 2015 Online only Revised for Version 10.0 (Release 2015a)
September 2015 Online only Revised for Version 10.1 (Release 2015b)
March 2016 Online only Revised for Version 10.2 (Release 2016a)
September 2016 Online only Revised for Version 11 (Release 2016b)
March 2017 Online only Revised for Version 11.1 (Release 2017a)
September 2017 Online only Revised for Version 11.2 (Release 2017b)
March 2018 Online only Revised for Version 11.3 (Release 2018a)
September 2018 Online only Revised for Version 11.4 (Release 2018b)
March 2019 Online only Revised for Version 11.5 (Release 2019a)
September 2019 Online only Revised for Version 11.6 (Release 2019b)


Getting Started
1
Statistics and Machine Learning Toolbox Product Description
................................................. 1-2
Key Features ..................................... 1-2
Supported Data Types ................................. 1-4
Organizing Data
2
Other MATLAB Functions Supporting Nominal and Ordinal
Arrays ............................................ 2-3
Create Nominal and Ordinal Arrays ...................... 2-4
Create Nominal Arrays .............................. 2-4
Create Ordinal Arrays ............................... 2-6
Change Category Labels ............................... 2-9
Change Category Labels ............................. 2-9
Reorder Category Levels .............................. 2-11
Reorder Category Levels in Ordinal Arrays .............. 2-11
Reorder Category Levels in Nominal Arrays ............. 2-12
Categorize Numeric Data ............................. 2-17
Categorize Numeric Data ........................... 2-17
Merge Category Levels ............................... 2-21
Merge Category Levels ............................. 2-21
v
Contents