-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
7,997 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.7 KB
doc/matStats-manual/images/anova-iris/anova-irisPL-residsBySpecies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
%ANOVAIRIS Performs sample Anova on Iris data set | ||
% | ||
% output = anovaIris(input) | ||
% | ||
% Example | ||
% anovaIris | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% Created: 2017-07-19, using Matlab 9.1.0.441655 (R2016b) | ||
% Copyright 2017 INRA - Cepia Software Platform. | ||
|
||
% Analysis of variance on Fisher's iris | ||
iris = Table.read('fisherIris'); | ||
anovaPL = Anova(iris('PetalLength'), iris('Species')); | ||
|
||
%% display fitted coefficients | ||
coefficients(anovaPL, 'Species') | ||
% ans = | ||
% PetalLength | ||
% Setosa 1.462 | ||
% Versicolor 4.26 | ||
% Virginica 5.552 | ||
|
||
|
||
%% Display residuals | ||
|
||
plotResiduals(anovaPL); | ||
print(gcf, 'anova-irisPL-resids.png', '-dpng'); | ||
|
||
%% Display residual by factor level | ||
|
||
figure; set(gca, 'fontsize', 14); | ||
plot(iris('Species'), residuals(anovaPL), 'bs'); | ||
hold on; | ||
plot([.5 3.5], [0 0], 'k-'); | ||
print(gcf, 'anova-irisPL-residsBySpecies.png', '-dpng'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%NMF_IRIS One-line description here, please. | ||
% | ||
% output = nmf_iris(input) | ||
% | ||
% Example | ||
% nmf_iris | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% INRAE - BIA Research Unit - BIBS Platform (Nantes) | ||
% Created: 2020-12-22, using Matlab 9.8.0.1323502 (R2020a) | ||
% Copyright 2020 INRAE. | ||
|
||
iris = Table.read('fisherIris'); | ||
[W, H] = nmf(iris(:,1:4), 2); | ||
% use Matlab 'biplot' function to represent the results | ||
biplot(H.Data', 'Scores', W.Data, 'varLabels', H.ColNames); | ||
axis equal; axis([0 1.2 0 1.0]); | ||
|
||
print(gcf, 'nmf_iris_biplot.png', '-dpng'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
%PCACITIES One-line description here, please. | ||
% | ||
% output = pcaCities(input) | ||
% | ||
% Example | ||
% pcaCities | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% Created: 2017-06-16, using Matlab 9.1.0.441655 (R2016b) | ||
% Copyright 2017 INRA - Cepia Software Platform. | ||
|
||
% load data | ||
load cities.mat | ||
|
||
% format to a data table | ||
colNames = strtrim(cellstr(categories))'; | ||
rowNames = strtrim(cellstr(names)); | ||
cities = Table(ratings, colNames, rowNames); | ||
|
||
resPca = Pca(cities, 'scale', true, 'display', 'off'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
%PCAIRIS One-line description here, please. | ||
% | ||
% output = pcaIris(input) | ||
% | ||
% Example | ||
% pcaIris | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% Created: 2017-06-16, using Matlab 9.1.0.441655 (R2016b) | ||
% Copyright 2017 INRA - Cepia Software Platform. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
% Demonstration of plotting features of the MatStats library. | ||
% | ||
% output = plotDemo(input) | ||
% | ||
% Example | ||
% plotDemo | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% INRAE - BIA Research Unit - BIBS Platform (Nantes) | ||
% Created: 2020-07-01, using Matlab 9.8.0.1323502 (R2020a) | ||
% Copyright 2020 INRAE. | ||
|
||
|
||
%% Generate demo Table | ||
% Generate a data table containing three columns, corresponding to a dummy | ||
% parametrisation variable, and the result of two functions, here sine and | ||
% cosine functions. | ||
|
||
% parametrisation (as vertical vector) | ||
t = linspace(0, 2*pi, 100)'; | ||
|
||
% concatenate as a numerical array | ||
data = [t cos(t) sin(t)]; | ||
|
||
% create the Data Table encapsulating the data. Also specifies the name to | ||
% populate the 'title' of the figures | ||
tab = Table(data, {'t', 'Cos(t)', 'Sin(t)'}, 'Name', 'Sine and Cosine'); | ||
|
||
|
||
%% Line Plot | ||
|
||
figure; set(gca, 'FontSize', 14); | ||
linePlot(tab(:,1), tab(:, 2:3)); | ||
|
||
|
||
%% Bar Plot | ||
|
||
figure; set(gca, 'FontSize', 14); | ||
barPlot(tab(:,1), tab(:, 2:3)); | ||
|
||
|
||
%% Stair Steps Plot | ||
|
||
figure; set(gca, 'FontSize', 14); | ||
stairStepsPlot(tab(:,1), tab(:, 2:3)); | ||
|
||
|
||
%% Line Plot | ||
|
||
figure; set(gca, 'FontSize', 14); | ||
stemPlot(tab(:,1), tab(:, 2:3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
%DEMOPAIRPLOT_IRIS One-line description here, please. | ||
% | ||
% output = demoPairPlot_iris(input) | ||
% | ||
% Example | ||
% demoPairPlot_iris | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% INRAE - BIA Research Unit - BIBS Platform (Nantes) | ||
% Created: 2020-12-22, using Matlab 9.8.0.1323502 (R2020a) | ||
% Copyright 2020 INRAE. | ||
|
||
iris = Table.read('fisherIris'); | ||
figure; pairPlot(iris(:,1:4), iris(:,5)); | ||
print(gcf, 'iris_pairPlot_bySpecies.png', '-dpng'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
%IRIS_HISTOGRAM One-line description here, please. | ||
% | ||
% output = iris_histogram(input) | ||
% | ||
% Example | ||
% iris_histogram | ||
% | ||
% See also | ||
% | ||
|
||
% ------ | ||
% Author: David Legland | ||
% e-mail: [email protected] | ||
% INRAE - BIA Research Unit - BIBS Platform (Nantes) | ||
% Created: 2020-12-22, using Matlab 9.8.0.1323502 (R2020a) | ||
% Copyright 2020 INRAE. | ||
|
||
iris = Table.read('fisherIris'); | ||
|
||
figure; | ||
histogram(iris('PetalLength'), 30); | ||
|
||
print(gcf, 'iris_histogram_n30.png', '-dpng'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
%% Generate figures for the Table class manual | ||
% | ||
% Usage: | ||
% demoTable | ||
% | ||
% started 2017-05-31 | ||
|
||
%% Read and display data | ||
|
||
% Read data from a csv file (several options can be specified) | ||
tab = Table.read('fisherIris.txt'); | ||
|
||
% display a part of the table on the console | ||
disp(tab(1:5, :)); | ||
|
||
% Or display summary of the data, like in R | ||
summary(tab); | ||
|
||
% display the table in a frame | ||
show(tab); | ||
|
||
%% Histograms | ||
|
||
% histogram of petal length. Columns can be indexed by their name. | ||
figure; | ||
histogram(tab('PetalLength'), 30); | ||
print(gcf, 'iris_petalLength_hist.png', '-dpng'); | ||
|
||
|
||
% plot values of petal length | ||
figure; | ||
plot(tab('PetalLength'), 'bs'); | ||
print(gcf, 'iris_plotPetalLength_sq.png', '-dpng'); | ||
|
||
% plot petal width against petal length | ||
figure; | ||
plot(tab('PetalLength'), tab('PetalWidth'), 'b*'); | ||
print(gcf, 'iris_petalWidth_petalLength_star.png', '-dpng'); | ||
|
||
|
||
%% Box and violin plots | ||
|
||
% box plot of the quantitative variables | ||
figure; | ||
boxplot(tab(:,1:4)); | ||
print(gcf, 'iris_boxPlot.png', '-dpng'); | ||
|
||
figure; | ||
violinPlot(tab(:,1:4)); | ||
print(gcf, 'iris_violinPlot.png', '-dpng'); | ||
|
||
|
||
%% Management of groups | ||
|
||
% scatter plot using groups | ||
figure; | ||
scatterGroup(tab('PetalLength'), tab('PetalWidth'), tab('Species'), ... | ||
'Envelope', 'InertiaEllipse', ... | ||
'LegendLocation', 'NorthWest'); | ||
|
||
% Compute the mean of each group | ||
meanByGroup = aggregate(tab(:,1:4), tab('Species'), @mean); | ||
disp(meanByGroup); | ||
|
||
% display as bar plot | ||
figure; | ||
bar(meanByGroup'); | ||
print(gcf, 'iris_meanByGroup_bar.png', '-dpng'); | ||
|
||
|
||
%% Principal Component Analysis | ||
|
||
% Apply Principal Component Analysis on the quantitative variables | ||
irisPca = Pca(tab(:, 1:4), 'display', 'off'); | ||
|
||
% The result is a Pca object, containing Table object for scores, loadings | ||
% and eigen values | ||
disp(irisPca); | ||
|
||
% Score plot can be displayed with automatic labeling of axes | ||
figure; | ||
scorePlot(irisPca, 1, 2); | ||
|
||
% Loadings can also be displayed with automatic labeling | ||
figure; | ||
loadingPlot(irisPca, 1, 2); | ||
|
||
% To display scores with group labelling, simply call the plot method on | ||
% the score object stored in Pca result | ||
figure; | ||
scatterGroup(irisPca.Scores(:, 1), irisPca.Scores(:, 2), tab('Species'), ... | ||
'LegendLocation', 'NorthWest'); |