Application Center - Maplesoft

# Statistics and Data Analysis

You can switch back to the summary page by clicking here.

Statistics and Data Analysis

? Maplesoft, a division of Waterloo Maple Inc., 2005

Introduction

Maple 10 contains a brand new statistics package and new interactive tools for data import and data analysis.

This document covers some of the basic techniques for using the statistics and data analysis tools in Maple 10. Links to more extenisve information can be found at the end of this document.

Importing Data

The Data Import Assistant provides a graphical interface to the ImportMatrix command.  You can use it to preview your data, and set properties of the file format to ensure proper importing.

Once you are satisfied with your settings, you can

• Return the new matrix

• Return the new matrix, assigned to a specified name

• Return the Maple command that can then be used to import the file using the settings you defined

If you are going to import the file more than once, then it is a good idea to use the assistant interactively until you are satisfied with the results, and then get the assistant to return the actual Maple command instead of the matrix. You can then embed that command into your code or worksheet, so that the data gets imported automatically every time you run a test. This way, you can avoid a manual step.

The Data Import Assistant can be used to import data files with the following formats: delimited files (including CSV format), Matrix Market and MATLAB data files, image files (JPEG, .tif) audio files (WAVE).  If you wish to import binary data, you should use the FileTools[Binary] package.

This assistant returns a Matrix data type, which is a Vector if the data is one-dimensional. The statistics facilties work on one-dimensional data sets, so you can use your imported data directly if it is in a Vector format, otherwise you can convert it first using the convert(M, Vector) command.

The Statistics Package

The new Statistics package supercedes the old stats package. Though the stats package is still in Maple 10 for backwards compatibiltiy, you should always use the Statistics package from now on.

Using the Statistics package

There are various ways of using the new Statistics package: context menus, the Data Analysis Assistant, and the commands in the Statistics package.

This package works on one-dimensional objects, such as Vectors, one-dimensional Arrays, and lists. It is most efficient to use Vectors to store your data.

Over 30 tools for descriptive statistics and data analysis are available through context menus. Right-click on the matrix to perform operations. For example, select Statistics>Quantities>Mean

 (3.1.1.1)

Statistics menus are available for Data Manipulation, Quantities, Summary and Tabulation and Visualization.The Statistics context menu can be used on vectors, lists, and one-dimensional Arrays.

Commands

The Statistics package contains a large number of functions which can be accessed directly.

 (3.1.2.1)

Remember that command completion can be used to fill in long command names. On Windows, command completion is invoked through [Ctrl][Space]. For instance, to enter , it is enough to enter Stan [Ctrl][Space] in math mode or at a prompt, and then select the full completion from the drop-down list provided.

To find an organized list of all commands in the Statistics package, divided into 10 different categories,  see the Statistics help page.

Data Analysis Assistant

As part of the new Statistics package, Maple 10 includes a new interactive data analysis assistant to help you explore your data. Through mouse clicks, you can:

• Manipulate data in various ways, including a shuffle, sort, moving average and exponential smoothing

• Plot histograms, bar charts, error plots, bubble plots, scatter plots, frequency plots, and more

• Calculate and display quantities of interest, including the mean, median, mean deviation, kurtosis, and skewness

To launch this assistant, select Data Analysis... from the Tools>Assistants menu.  To bring data into the assistant, your data must first be defined inside the worksheet from which you launched the assistant. The data can be stored in a Vector or  Array, and needs to be assigned to a variable name. Select Import from the File menu once the assistant is launched, and then enter the variable name. To work with multiple data sets, simply import additional datasets in the same way.

You can also invoke the assistant from the command line, supplying the data as an argument.

Examples

Below are two simple examples to illustrate a few basic techniques of using the Statistics package.

Standard Calculations and Visualizations

Using the Statistics package, we create a random sample with normal distribution, then using the context menu, we plot a histogram of the data.

 (3.2.1.1)

We can use the Maple commands or the context menus to find the mean and variance.

 (3.2.1.2)

 (3.2.1.3)

Random Variables

Define two random variables.

 (3.2.4.1)

 (3.2.4.2)

Maple can calculate the probability density function of

 (3.2.4.3)

Create a sample using as the distribution.

 (3.2.4.4)

We can display the density plot for that distribution and the histogram of the data to verify that they do correspond. We put both plots on the same set of axes by using the plots[display] command.

From Inside Maple 10

The Maple Tour includes a section on statistics. See ? Tour,stats , or Help>Take a Tour of Maple and follow the link to Statistics.

Example worksheets give overviews of various aspects of the Statistics package.

• examples/StatisticsDataSmoothing : An overview of the Statistics package commands for performing data smoothing.

• examples/StatisticsEstimation : An overview of the Statistics package commands for statistical estimation, including maximum likelihood estimation.

• examples/StatisticsHypothesisTesting : An overview of the Statistics package commands for hypothesis testing and inference (New).

• examples/StatisticsProbabilityDistributions : An overview of the Statistics package commands for statistical distributions and manipulating random variables.

On the Web

Legal Notice: The copyright for this application is owned by Maplesoft. The application is intended to demonstrate the use of Maple to solve a particular problem. It has been made available for product evaluation purposes only and may not be used in any other context without the express permission of Maplesoft.