Statistics - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Visualization : Statistics/Biplot

Statistics

  

Biplot

  

generate biplots

 

Calling Sequence

Parameters

Options

Description

Examples

References

Compatibility

Calling Sequence

Biplot(dataset, options, plotoptions)

Parameters

dataset

-

data set, DataFrame, or PCArecord

options

-

(optional) equation(s) of the form option=value where option is one of arrows, arrowlabels, dimension, pcbiplot, points, pointlabels, or scale; specify options for generating the biplot

plotoptions

-

options to be passed to the plots[display] command

Options

  

The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot[options] for details.

• 

arrows : truefalse or list; controls the display of arrows corresponding to each principal component. The default is true. If the arrows option is given as a list, the arrows are shown and any elements of the list are passed as plot options to the arrow constructor.

• 

arrowlabels : truefalse or list; specifies the labels shown on the arrows corresponding to each column of the data. The default is true. If the dataset is a DataFrame, then the biplot will automatically use the column names from the dataframe as labels. If the dataset is a Matrix, then the arrowlabels must be provided as a list, otherwise no labels are shown. The default arrow labels can be overridden by specifying a list containing the new values.

• 

dimension : integer; specifies the number of dimensions, either 2 or 3 of the resulting biplot. The default is 2.

• 

pcbiplot : truefalse; controls if with lambda = 1, observations are scaled up by n and variables are scaled down by n. This is referred to as a "principal component biplot", Gabriel (1971).

• 

points : truefalse or list; controls the display of points corresponding to the individual rows of the principal components. The default is true. If the points option is given as a list, the points are shown and any elements of the list are passed as plot options to the plot constructor.

• 

pointlabels : truefalse or list; controls the display of point labels. The default is false. If the dataset is a DataFrame, the row names from the DataFrame are used. If the dataset is a Matrix, the numbers 1 through n are used, where n is the number of rows of the Matrix. The default point labels can be overridden by specifying a list containing the new values.

• 

scale : numeric value between 0 and 1; controls if the variables are scaled by lambdascale and the observations are scaled by lambda1scale, where lambda are the singular values computed by the principal component analysis. The default is 1.

Description

• 

The Biplot command generates a biplot for the specified set of data. A biplot is a method of data visualization suitable for the results of a principal components analysis.

• 

The first parameter, dataset, can be a numeric Matrix or DataFrame with 2 or more columns, or a record generated by a principal component analysis. In the case that dataset is either a Matrix or a DataFrame, a principal component analysis is run on the dataset and the results are used for the biplot.

Examples

withStatistics:

Generate a biplot for the Iris dataset.

IrisDFImportFileTools:-JoinPathdatasets,iris.csv,base=datadir

IrisDFSepal LengthSepal WidthPetal LengthPetal WidthSpecies15.13.51.40.2setosa24.931.40.2setosa34.73.21.30.2setosa44.63.11.50.2setosa553.61.40.2setosa65.43.91.70.4setosa74.63.41.40.3setosa853.41.50.2setosa..................

(1)

pcaPCAIrisDF`Sepal Length`,`Sepal Width`,`Petal Length`,`Petal Width`:

A Biplot can also be used to show the first two components and the observations on the same diagram. The first principal component is plotted on the x-axis and the second on the y-axis.

Biplotpca,size=600,golden

From the Biplot, it can be observed that petal width and length are highly correlated and their variability can be primarily attributed to the first component. Likewise, the first component also explains a large part of the Sepal length. The variability in sepal width is more attributed to the second component.

It is possible to view the first three components using the dimension option. Also, the colorscheme option applies different colors based on the various levels in the "Species" column.

Biplotpca,dimension=3,points=colorscheme=valuesplit,IrisDFSpecies,lightmodel=none,orientation=50,50,0

The canada_crimes.csv dataset contains information on types of crimes committed per 100000 people:

CCdataImportFileTools:-JoinPathdatasets,canada_crimes.csv,base=datadir

CCdataViolent CrimeProperty CrimeOther Criminal CodeCriminal Code TrafficFederal StatuteNewfoundland and Labrador1276.153317.031010.67348.97267.94Prince Edward Island824.433294.3572.18348.64215.34Nova Scotia1241.053307.85902.76368.42375.11New Brunswick1164.322611.17712.02298.71283.45Quebec940.522100.84450.29511.18314.74Ontario786.622292.66476.48211.57258.15Manitoba1712.974311.481689.72276.28362.78Saskatchewan1963.465627.552913.78886.34692.9..................

(2)

The pointlabels option controls if the points in the biplot include labels or not. Additional options such as axes or size are passed to the plots:-display command.

BiplotPCACCdata,scale=true,points=false,pointlabels=true,arrows=color=Crimson,axes=normal,size=800,golden,view=1..1,0.5..0.5

References

  

Gabriel, K.R. (1971). The biplot graphical display of matrices with applications to principal component analysis. Biometrika, 58, 453-467.

Compatibility

• 

The Statistics[Biplot] command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

Statistics

Statistics[PrincipalComponentAnalysis]

Statistics[Visualization]