Documentation : SAISIR20_Documentation.htm · 234 fiches
Version : 2.0 sept 2026
SAISIR is distributed under the CeCILL license. The authors and developers cannot be held responsible for consequences resulting from modifications made to part or all of the SAISIR source code.
AFFICHER_SAISIR_APPLY_KNN
SAISIR_APPLY_KNN
saisir_apply_multiple_regression - applies multiple_regression on "unknown" data
saisir_apply_nuee - apply Nuee dynamique (KCmeans)
saisir_apply_quaddis - Quadratic discriminant analysis
APPLY_RIDGE_REGRESSION - Applies a trained Ridge Regression model to new data
saisir_apply_stepwise_regression - applies stepwise_regression on "unknown" data
saisir_applyfda1 - application of factorial discriminant analysis on PCA scores
saisir_applylr1 - Apply basic latent root model on saisir data x
saisir_applypca - computes the scores of supplementary observations
saisir_applypcr - applies basic PCR on data
saisir_applypls - applies a pls model on an unknown data set
saisir_applyplsda - Applies pls discriminant analysis after model assessment using plsda
saisir_applyspcr - Applies a stepwise PCR
AFFICHER_SAISIR_KNN
saisir_barycenter_map - graph of map of barycenter
saisir_browse - browses a series of curves
saisir_ca_map - colored map for correspondence analysis: using a portion of the identifiers as labels
coloured_curves - displays curves coloured according to groups
saisir_colored_map1 - colored map : using a portion of the identifiers as labels
saisir_colored_map2 - colored map : using a portion of the identifiers as labels
saisir_colored_map4 - colored map according to 2 criteria
saisir_correlation_plot - Draw a correlation between scores and tables
saisir_curve - represents a row of a matrix as a single curve
curves - represents several rows of a matrix as curves
saisir_ellipse_map - plots the ellipse confidence interval of groups
GSCATTER3 3D Scatter plot with grouping variable
saisir gscatter3b wrapper for gscatter3 with default options
SAISIR(c) function_LARTIC 2026 - saisir_ica_inertia_display(ica_inertia_res)
saisir_labelled_hist - draws an histogram in which each obs. name is considered as a label
saisir_map - graph of map of data using identifiers as names
saisir_map3D - Draws a 3D map
SAISIR(c) class_LARTIC 2024 - Classe pcaFigure
SAISIR_PLOT_ICADA Tableau de bord graphique d'un modele saisir_ICADA.
saisir_plotmatrix1 - biplots of columns of matrices with colors
SENSORY_PROFILE - Modern graphical representation of sensory profiles (Spider / Radar plot)
saisir_show_vector - represents a row of a matrix as a succession identifiers
saisir_submap - partial display of observations
saisir_surface1 - Represent a surface in three dimensions
saisir_symbol_map - map with symbols : using a portion of the identifiers for
saisir_symbol_map - map with symbols : using a portion of the identifiers for
saisir_tcurve - representation of a column of a given matrix as a curve
saisir_tcurves - represents several columns of a matrix as curves
saisir_trajectory_curve - plots coloured XYcurves
saisir_xy_plot - Biplot of one column of X versus one column of Y
saisir_xyz_colored_map1 - Draws a colored 3D map from a Saisir file
function [Warping,XWarped,Diagnos] = cow(T,X,Seg,Slack,Options);
saisir_normc - Normalize columns of a matrix.
SAISIR(c) function_LARTIC 2024_ saisir_center() remplace les NaN par la moyenne de colonne, puis centre les colonnes
saisir_correct_baseline - simple linear baseline correction, using intensity
saisir_cow - Wrapper SAISIR pour l'alignement de signaux par COW (Correlation Optimized Warping)
saisir_derivative - n-th order derivative using the Savitzky-Golay coefficients
saisir_emsc - Correction of spectra by EMSC
saisir_group_centering - Centers data according to groups
SAISIR_ICOSHIFT - SAISIR Wrapper for Interval Correlation Optimized Shifting (iCOshift)
ICOShift pour 1H-RMN (sirop d'érable) — alignement par corrélation intervalle-par-intervalle
saisir_mean - computes the mean of the columns, following the saisir format
saisir_mean_replicats - Perform an averaging of analytical replicates contained in the dataset
saisir_moving_average - Moving average of signals
saisir_moving_max - replaces the central point of a moving window by the maximum value
saisir_moving_min - replaces the central point of a moving window by the minimum value
saisir_msc - Multiplicative scatter correction on spectra
saisir_norm_col - divides each column by the corresponding standard deviation
saisir_normc - Wrapper SAISIR sécurisé pour normaliser les spectres (lignes) à une norme de 1
saisir_pqn - Normalisation de données spectrales par quotient probabiliste (PQN)
saisir_row_center - subtracts the average row to each row
function [X1] = saisir_snv(X)
SAISIR(c) function_LARTIC 2024_ saisir_standardize()remplace les NaN par la moyenne de colonne puis divise chaque colonne par son écart-type
saisir_std - computes the standard_deviations of the columns, following the saisir format
saisir_surface_std - divide each row by the sum of its corresponding columns
No description available.
No description available.
SAISIR(c) function_LARTIC 2026 - correlation_circle
CORRIGE_RAYLEIGH
saisir_detectOutliers_robustcow - statistical outliers detection
function out = detect_patterns_from_options(names, OptionRegEx, varargin)
SAISIR(c) function_LARTIC 2025 - saisir_find_zero_nan - Détecte lignes/colonnes contenant 0, NaN, ou 0|NaN (SAISIR)
SAISIR(c)_function_LARTIC - function saisir_mannwhitney(mydata, mygroups, varargin)
MBPCA_PARAMETERS Paramètres généraux de l'analyse MB-PCA.
saisir_mean - computes the median of the columns, following the saisir format
SAISIR_REMOVE - Retire les lignes de la structure SAISIR dont les noms sont dans ToBeRemoved
saisir_reorder - reorders the data of files A1 and A2 according to their identifiers
RESTORE_EEM
Calcule le coefficient RV entre deux structures saisir X et Y
SAISIR(c) function_LARTIC 2025 - PCA SAISIR après SNV + sélection automatique de variables spectrales discriminantes
SAISIR(c) function_LARTIC 2025
saisir_symbol_map - map with symbols : using a portion of the identifiers for
SAISIR(c) function_LARTIC 2024
No description available.
SAISIR(c)_function_LARTIC - function saisir_welchtest(mydata, mygroups, varargin)
SAISIR(c) function_LARTIC 2024
========================================================================
SAISIR(c) function_LARTIC 2024
issaisir - tests if the input argument is a SAISIR matrix
LoadNicoletIRSpectra - Imports Thermo .SPA spectrum files and formats for SAISIR
SAISIR(c) function_LARTIC 2024
ADDCODE - Adds a prefix or suffix string to a matrix or array of text
saisir_alphabetic_sort - sorts the rows of x according to the alphabetic order of rows identifiers
saisir_appendbag1 - Merge an arbitrary number of "bag" files according to rows
appendcol - merges two files according to columns
saisir_appendcol1 - merges an arbitrary number of files according to columns
saisir_appendrow - merges two SAISIR matrices according to rows
saisir_appendrow1 - Merges an arbitrary number of files according to rows
saisir_bag2group - uses the identifiers in bag to create groups
saisir_bag_appendrow1 - Merges an arbitrary number of bags according to rows
saisir_barycenter - Calcule les barycentres des groupes d'une matrice SAISIR
BUILD_INDICATOR - Builds a complete disjoint table (One-Hot Encoding / Complete Indicator Matrix)
saisir_change_sign - changes the sign of a component and of its associated eigenvector
saisir_check - Checks if the data respect the saisir stucture
saisir_check_name - Controls if some strings are strictly identical in a string array
saisir_contingency_khi2 - computes khi2 stats on a contingency table
CONTINGENCY_TABLE - Computes a contingency table from two group vectors
saisir_cormap - Correlation between two tables
saisir_covmap - assesses the covariances between two tables
saisir_create_group - creates a vector of numbers indicating groups from identifiers
saisir_create_group1 - uses the identifiers to create groups
saisir_cumulate_covariance - Covariance on huge data set
saisir_deletecol - deletes columns of saisir files
saisir_deleterow - delete rows
DISPLAYSTATSTABLE - Displays a descriptive statistics table in a MATLAB figure
saisir_eliminate_nan - suppresses "not a number" data in a saisir structure
saisir_excel2bag - reads an excel file and creates the corresponding text bag
saisir_excel2saisir - reads an excel file
saisir_find_index - find the index corresponding to the closest "value"
saisir_find_max - gives the indices of the max value of a MATLAB Matrix
saisir_find_min - gives the indices of the min value of a MATLAB Matrix
saisir_find_peaks - finds and displays peaks greater than a threshold value
SAISIR(c) function_LARTIC 2024
SAISIR(c) function_LARTIC 2026 - saisir_ica_inertia(mydata, icatype)
SAISIR(c) function_LARTIC 2024
SAISIR(c) function_LARTIC 2022
SAISIR(c) function_LARTIC 2025
list - lists rows (only with a small number of columns)
Import data from text file
saisir_log10 - applies log10 transformation to a SAISIR matrix
saisir_matrix2saisir - transforms a Matlab matrix in a saisir structure
MIR_STYLE - Inverts the sign of MIR spectra wavenumbers for conventional plotting
saisir_mult - matrix multiplication following the SAISIR format
saisir_nancor - Matrix of correlation with missing data
saisir_num2str1 - Justified num2string
saisir_random_saisir - Creation of a random matrix
SAIIR_RANDOM_SELECT - Building a vector of random elements 0 or 1
saisir_random_splitrow - random selection of rows
saisir_randomize - Builds a file of randomly attributed vector in X1
IMPORTFILE Import data from a text file
SAISIR_@READIDENT - Loads a text file containing identifiers/strings
saisir_repeat_string - build a matricx of char by repeating a string
saisir_saisir2ascii - Saves a saisir file into a simple ASCII format
saisir_saisir2excel - Saves a saisir file in a format compatible with Excel
SAISIR(c) function_LARTIC 2024
SEEKSTRING - Finds row indices containing a specific substring
saisir_sgolaycoef - Computes the Savitsky-Golay coefficients
SAISIR_SORT - Sorts the rows of a SAISIR matrix according to a specific column
saisir_split_average - averages observations according to the identifiers
saisir_splitrow - splits a data matrix into 2 resulting matrices
saisir_string2saisir - creation of a saisir file from a string table (first column=name)
saisir_string2text - save a vector of string in a .txt format
saisir_subtract_variable - subtract a given variable to all the others
saisir_sum - calculates the sum of the rows
saisir_transpose - transposes a data matrix following the saisir format
saisir_xdisp -smart display of heterogeneous variables
XLS2SAISIR - Reads an Excel file and converts it to a clean SAISIR structure
plsda - Pls discriminant analysis following the saisir format
saisir_anavar1 - One way analysis of variance on all the columns
anovan1 - N-way analysis of variance (ANOVA) on data matrices.
function plstype = saisir_basic_pls(X,ndim)
basic_pls2 - PLS2 on several variables, several dimensions
function plstype=saisir_basic_pls3(X,y,ndim);
saisir_ca - CORRESPONDENCE ANALYSIS
COMDIM - Finding common dimensions in multi-table data (ComDim / CCSWA)
saisir_covariance_pca - principal component analysis when knowing the covariance (of variables)
saisir_cross_ridge_regression - ridge regression with validation
saisir_crossfda1 - validation on discrimination according to fda1 (directly on data)
saisir_crossmaha - validation on discrimination according to saisir_maha1 (directly on data)
saisir_crossplsda - validation on PLS discriminant analysis
saisir_crossval_multiple_regression - validation of multiple regression.
SAISIR_CROSSVAL_QUADDIS - Test-set validation for Quadratic Discriminant Analysis (QDA)
saisir_crossvalpls - validation of pls with up to ndim dimensions.
SAISIR_CROSSVALPLS1A - Cross-validation for PLS regression (detailed outputs)
saisir_d2_factorial_map - assesses a factorial map from a table of squared distance
saisir_dendro - dendrogram using euclidian metric and Ward linkage
saisir_dimcross_stepwise_regression - Tests models obtained from stepwise regression
saisir_dimcrosspcr1 - validation of PCR (samples in validation are selected)
distance - Usual Euclidian distances
saisir_fda1 - stepwise factorial discriminant analysis on PCA scores
saisir_fda2 - stepwise factorial discriminant analysis on PCA scores with verification
saisir_group_mean - gives the means of group of rows
SAISIR(c) function_LARTIC 2022 - saisir_ica(mydata, NBIc, Options)
SAISIR_ICADA Analyse en composantes independantes discriminante (ICA-DA).
KNN_SAISIR Classification KNN pour données SAISIR
saisir_leave_one_out_pls1 - PLS1 with leave_one out validation
saisir_leave_one_out_pls2 - PLS2 with leave_one out validation
saisir_linkage - assesses a simple linkage vector from a matrix of distance
saisir_lr1 - Latent root regression
saisir_mdistance - computes distances between the two tables using metric "metric"
saisir_mfa - Multiple factor analysis
saisir_multiple_regression - Simple Multiple linear regression (all the variables)
saisir_multiway_pca - Multi way principal component analysis
saisir_normed_pca - PCA with normalisation of data
saisir_nuee - Nuee dynamique (KCmeans)
SAISIR(c)_function_LARTIC - function saisir_pca(mydata,var_score)
saisir_pca_cano - generalized canonical analysis after PCAs on each table
saisir_pca_cross_ridge_regression - PCA ridge regression with crossvalidation
saisir_pca_ridge_regression - Basic ridge regression after PCA
saisir_pca_stat - Gives some complementary statistics on PCA observations
saisir_pcareconstruct - reconstructs original data from a PCA model and a file of score
saisir_pcr - PCR (components introduced in the order of eigenvalues)
saisir_pcr1 - Basic model of PCR (components introduced in the order of eigenvalues)
saisir_pls - PLS regression with "dim" dimensions
saisir_plsda - Pls discriminant analysis following the saisir format
QUADDIS - Quadratic Discriminant Analysis (Training Phase)
saisir_quickpls - Quick PLS regression from 1 to ndim dimensions
saisir_regression_score - build a factorial space for regression
saisir_ridge_regression - Basic ridge regression
saisir_ridge_regression1 - Régression Ridge basée sur la norme ciblée de Beta
SAISIR_ROBUST_PLS - Régression PLS robuste sur structures SAISIR
saisir_simple_regression - mono_linear regressions
saisir_spcr - stepwise Principal component regression
saisir_statis - Multiway method STATIS
STEPWISE_REGRESSION - Forward/Backward Stepwise Linear Regression for SAISIR objects
saisir_svd_pca - NOT CENTERED Principal component analysis on raw data
saisir_covariance_select - selection of predictive variables from covariance
saisir_covsel(x, y, lv) - Selection of variable from covariance maximisation
SAISIR(c) function_LARTIC 2026 - saisir_covsel_bands(mydata, Y, nvar, window)
saisir_covsel(x,lv,firstLetter, lastLetter) - Selection of variable from covariance maximisation
MAHA - Forward stepwise variable selection for Discriminant Analysis
MAHA1 - Forward stepwise variable selection with an independent validation set
saisir_maha3 - simple discriminant analysis forward introducing variables no validation samples
saisir_maha4 - simple discriminant analysis forward
saisir_maha6 - simple discriminant analysis forward introducing variables with validation samples
saisir_select_from_identifier - Uses identifier of rows for selecting samples
saisir_select_from_variable - use identifier of columns for selecting variables
saisir_selectcol - creates a new data matrix with the selected columns
saisir_selectrow - creates a new data matrix with the selected rows
function figures = afficher_saisir_apply_knn(prediction)Source: afficher_saisir_apply_knn.m
AFFICHER_SAISIR_APPLY_KNN
Graphical display of prediction results obtained from saisir_apply_knn.
Syntax:
afficher_saisir_apply_knn(prediction)
figures = afficher_saisir_apply_knn(prediction)
Input:
prediction : structure generated by saisir_apply_knn
prediction.d
prediction.i
prediction.v
prediction.d2
prediction.scores
prediction.confidence
prediction.predicted_codes
prediction.predicted_labels
prediction.class_codes
prediction.class_labels
Output:
figures : structure containing handles of the generated figures
figures.margin
figures.confidence
figures.scores
figures.distribution
The function generates four independent figures:
1 - Classification score / classification margin
2 - Prediction confidence
3 - Heatmap of KNN class scores
4 - Distribution of predicted classes
For a binary classification problem, the first graph displays:
score(class 2) - score(class 1)
A positive value corresponds to class 2 and a negative value to class 1.
The horizontal zero line represents the classification boundary.
For a multiclass problem, the first graph displays:
highest score - second highest score
which provides a measure of the separation between the two most likely
classes.
========================================================================
Check input structure
=========================================================================Return to thematic list · HOMEfunction tables = afficher_saisir_knn(result)Source: afficher_saisir_knn.m
AFFICHER_SAISIR_KNN
Graphical and tabular display of the results obtained from saisir_knn.
Syntax:
afficher_saisir_knn(result)
tables = afficher_saisir_knn(result)
Input:
result : structure generated by saisir_knn
Output:
tables : structure containing the numerical results displayed
in the different tables:
tables.summary
tables.classes
tables.confusion
tables.observations
tables.k_search
The function displays:
- general KNN classification performance
- sensitivity and specificity for each class
- confusion matrix
- optimization of the number of neighbours k
- observed and predicted classes for each sample
- KNN class scores
========================================================================
Check input structure
=========================================================================Return to thematic list · HOMEfunction [Warping,XWarped,Diagnos] = cow(T,X,Seg,Slack,Options);Source: cow.m
function [Warping,XWarped,Diagnos] = cow(T,X,Seg,Slack,Options);
Correlation Optimized Warping function with linear interpolation
Giorgio Tomasi / Frans van den Berg 060912 (GT)
Flags pour la plateforme PULSAR
---------------
Flag1 : cow
Flag2 : T,X,Seg,Slack,Options, context
Flag3 : Warping,XWarped,Diagnos
Flag4 : Correction
Thomas Skov 061912 - line 277 changed to work in MATLAB version 6.5
in: T (1 x nt) target vector
X (mP x nP) matrix with data for mP row vectors of length nP to be warped/corrected
Seg (1 x 1) segment length; number of segments N = floor(nP/m)
or (2 x N+1) matrix with segment (pre-determined) boundary-points
first row = index in "xt", must start with 1 and end with "nt"
second row = index in "xP", must start with 1 and end with "nP"
Slack (1 x 1) 'slack' - maximum range or degree of warping in segment length "m"
Options (1 x 5) 1 : triggers plot and progress-text (note: only last row/object in "xP" is plotted)
2 : correlation power (minimum 1th power, maximum is 4th power)
3 : force equal segment lengths in "xt" and "xP" instead of filling up "xt" with N boundary-points
(notice that different number of boundaries in "xt" and "xP" will generate an error)
4 : fix maximum correction to + or - options(4) points from the diagonal
5 : save in "diagnos" the table with the optimal values of loss function and predecessor (memory
consuming for large problems - on how to read the tables are in the m-file
default [0 1 0 0 0] (no plot; power 1; no forced equal segment lengths; no band constraints; no Table in "diagnos")
out: Warping (mP x N x 2) interpolation segment starting points (in "nP"
units) after warping (first slab) and before warping (second slab)
(difference of the two = alignment by repositioning segment
boundaries; useful for comparing correction in different/new objects/samples)
XWarped (mP x nt) corrected vectors (from "xP" warped to match "xt")
Diagnos (struct) warping diagnostics: options, segment, slack,
index in target ("xt", "warping" is shift compared to this) and sample ("xP"), search range in "xP", computation time
(note: diagnostics are only saved for one - the last - signal in "xP")
based on: Niels-Peter Vest Nielsen, Jens Micheal Carstensen and Jørn Smedegaard 'Aligning of singel and multiple
wavelength chromatographic profiles for chemometric data analysis using correlation optimised warping'
J. Chrom. A 805(1998)17-35
Reference: Correlation optimized warping and dynamic time warping as preprocessing methods for chromatographic Data
Giorgio Tomasi, Frans van den Berg and Claus Andersson, Journal of Chemometrics 18(2004)231-241
Authors:
Giorgio Tomasi / Frans van den Berg
Royal Agricultural and Veterinary University - Department of Food Science
Quality and Technology - Spectroscopy and Chemometrics group - Denmark
email: gt@kvl.dk / fb@kvl.dk - www.models.kvl.dk
Modifications: 2024
CBYC - LARTIC
INPUT
context : permet de connaitre dans quel contexte la fonction est
utilisée.
Si script classique, alors contexte = 0
si webApp, alors contexte = 1 car les boite de dialogues standalone ne
sont pas permises pour les webApp
Check Input valuesReturn to thematic list · HOMESource: ENoseData_treatment.m
Return to thematic list · HOMEfunction test=issaisir(x);Source: issaisir.m
issaisir - tests if the input argument is a SAISIR matrix test=issaisir(X); Flags pour la plateforme PULSAR --------------- Flag1 : issaisir Flag2 : x Flag3 : test (boolean) Flag4 : Tools Input argument: ============== X: anything Output argument: =============== test: (boolean) "true" if X is a SAISIR structure, "false" otherwise. SEE also : saisir_checkReturn to thematic list · HOME
function res_saisir = LoadNicoletIRSpectra(Filenames)Source: LoadNicoletIRSpectra/LoadNicoletIRSpectra.m
LoadNicoletIRSpectra - Imports Thermo .SPA spectrum files and formats for SAISIR Flags pour la plateforme PULSAR --------------- Flag1 : LoadNicoletIRSpectra Flag2 : Filenames Flag3 : res_saisir Flag4 : Tools Usage: ====== res_saisir = LoadNicoletIRSpectra; % Ouvre l'interface de sélection res_saisir = LoadNicoletIRSpectra(Filenames); % Importe une liste de fichiers Input: ===== Filenames : Cell array de noms de fichiers .SPA à importer (optionnel) Output: ======= res_saisir : Objet SAISIR (n_samples x p_variables) avec métadonnées intégrées 1. Gestion de la sélection des fichiers (Interface graphique si aucun argument)Return to thematic list · HOME
function n = normc(m)Source: normc.m
saisir_normc - Normalize columns of a matrix. Syntax saisir_normc(M) Description saisir_normc(M) normalizes the columns of M to a length of 1. Examples m = [1 2; 3 4] n = saisir_normc(m) See also NORMR Mark Beale, 1-31-92 Copyright (c) 1992-1998 by The MathWorks, Inc. $Revision: 1.6 $ $Date: 1998/06/11 17:21:47 $Return to thematic list · HOME
function[type]=plsda(x,group,ndim)Source: plsda.m
plsda - Pls discriminant analysis following the saisir format function[plsdatype]=plsda(X,group,ndim) Flags pour la plateforme PULSAR --------------- Flag1 : PLS discriminant analysis Flag2 : x, group, ndim Flag3 : type Flag4 : Model Input arguments: =============== X : SAISIR matrix of predictive variables (n x p) group: SAISIR (n x 1) vector of integers of groups. Observationqs with the same number in group belong to the same group (missing group not allowed) ndim: number of dimensions in the PLS model Output arguments ================ plsdatype with fields beta :coeff for predicting the indicator matrix beta0 :intercept for predicting the indicator matrix t :PLS latent variable predy :predicted indicator matrix classed :predicted groups according to method #0 ncorrect :number of rightly classified samples according to method #0 (attribution to index of max of predicted Y) confusion :confusion matrix according to method #0 ncorrect1 :number of rightly classified samples according to method #1 (mahalanobis distance on latent variable t) confusion1 :confusion matrix according to method #1 tbeta :coeff for predicting the latent variables t tbeta0 :intercept for predicting the indicator matrix linear :linear form for direct prediction of group linear0 :%the min of x'*linear + linear0 gives the predicted group (this is equivalent with considering Mahalanobis distances) transform the file of group into an indicator matrix (1: the obs belongs to this group)Return to thematic list · HOME
function T = saisir2table(mydata)Source: saisir2table.m
SAISIR(c) function_LARTIC 2024 function T = saisir2table(mydata) Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2024 This function creates a Matlab table object from a SAISIR strcture See also : table2saisir function that makes the inverse process INPUT mydata : data SAISIR structure OUTPUT T : a Matlab table object Example of use: T = saisir2table(mydata); T.Properties T.Properties.VariableNames download SAISIR package at : https://lartic.fsaa.ulaval.ca/chimiometrie/enseignement-saisirReturn to thematic list · HOME
function str1 = saisir_addcode(str, code, deb_end)Source: saisir_addcode.m
ADDCODE - Adds a prefix or suffix string to a matrix or array of text Description: ============ Concatenates a specific string 'code' either before (prefix) or after (suffix) each row of a character matrix, cell array of strings, or string array. This function is primarily used to recode SAISIR identifiers (.i or .v). Flags pour la plateforme PULSAR --------------- Flag1 : addcode - prefix/suffix Flag2 : str, code, deb_end Flag3 : str1 Flag4 : Tools Input arguments: ================ str : Input text (n x p char matrix, cell array of strings, or string array). code : The substring to add (1 x k char or string). deb_end : Insertion mode flag (0 = prefix/before [default]; 1 = suffix/after). Output argument: ================ str1 : The resulting modified text matching the input data type. Typical example: ================ DATA.i = addcode(DATA.i, '2026_', 0); % Adds '2026_' before every sample name 1. Input arguments validation and defaultsReturn to thematic list · HOME
function X1=saisir_alphabetic_sort(X,start_pos:end_pos)Source: saisir_alphabetic_sort.m
saisir_alphabetic_sort - sorts the rows of x according to the alphabetic order of rows identifiers
function X1=saisir_alphabetic_sort(X,start_pos:end_pos)
Flags pour la plateforme PULSAR
---------------
Flag1 : Alphabetic sort
Flag2 : s, start_pos, end_pos
Flag3 : s1
Flag4 : Tools
Input arguments:
===============
x : SAISIR matrix
start_pos, end_pos : character positions in the identifiers.
Output argument:
================
x1= SAISIR matrix with the rows sorted in alphabetic order.
This functions sorts the observations (rows) according to
their identifiers (".i" field of X);
example
=======
>> a.i
ans =
xenon
krypton
Aluminium
>>a.d
ans =
1.00 2.00 3.00 4.00
5.00 6.00 7.00 8.00
9.00 10.00 11.00 12.00
b=saisir_alphabetic_sort(a,1,5);
>> b.i
ans =
Aluminium
krypton
xenon
>> b.d
ans =
9.00 10.00 11.00 12.00
5.00 6.00 7.00 8.00
1.00 2.00 3.00 4.00Return to thematic list · HOMEfunction res = saisir_anavar1(X,g)Source: saisir_anavar1.m
saisir_anavar1 - One way analysis of variance on all the columns function res = saisir_anavar1(X,g) Perform a one-way analysis of variance for each of the column of X. Flags pour la plateforme PULSAR --------------- Flag1 : One way analysis of variance Flag2 : saisir, g Flag3 : res Flag4 : Model Input arguments: =============== X: SAISIR matrix (n x p) g: SAISIR vector of group identifier (integers ,n x 1) Output arguments: ================ res with fields: res.F : SAISIR vector of Fisher values for each variable in X (1 x p) res.F.df : degrees of freedom of the model/ res.p : SAISIR vector of associated probabilities (1 x p). Note: res.F and res.p can be examined as curves (using "saisir_curve" function) or by the command "saisir_show_vector" (for discrete variables) The function performs p independant one-way anovas, taking the groups (defined in g: each observations having the same number are belonging to the same group.) See also: "saisir_anovan1", "saisir_show_vector","saisir_create_group1"Return to thematic list · HOME
function res = anovan1(X,model,gr1, gr2, ...)Source: saisir_anovan1.m
anovan1 - N-way analysis of variance (ANOVA) on data matrices. function res = anovan1(X,model,gr1, gr2, ...) Performs as many independant N-way analyses of variance as the number of columns in X Flags pour la plateforme PULSAR --------------- Flag1 : ANOVA -- N-way analysis of variance Flag2 : saisir, model, varargin Flag3 : res Flag4 : Model Input arguments: =============== X: SAISIR matrix of response values (n x p) model (integer): gives the level of desired interactions (1= no interactions studied; 2: first degree of interactions ... ) (see Matlab function ANOVAN) gr1; gr2 ...: SAISIR vector of qualitative groups forming a factor of the ANOVA (n x 1). Identical numbers mean that the corresponding observations are in the same group Output arguments: ================ res with fields res.F: the F values associated with each effect and (possibly) interaction res.P: probability res.df (characters): degrees of freedom res.singular: singularity of the model. If the singularity == 1, the model is redundant and a lowest level of interaction must be tested. see also: saisir_anovan, saisir_anova, saisir_anavar1, saisir_show_vector, saisir_create_group1 example: my_anova=saisir_anovan1(spectra,2,grouping1, grouping2); saisir_show_vector(my_anova.P,2); %%examination of the probabilities of the second factor (with identifiers) saisir_curve(my_anova.F,2); %% Fisher F examined as a curve.Return to thematic list · HOME
function [saisir] = saisir_appendbag1(saisir1,varargin)Source: saisir_appendbag1.m
saisir_appendbag1 - Merge an arbitrary number of "bag" files according to rows
usage: [X]= saisir_appendbag1(X1, X2, X3,.....)
Flags pour la plateforme PULSAR
---------------
Flag1 : appendbag1
Flag2 : saisir1, varargin
Flag3 : saisir
Flag4 : Tools
Input argument:
===============
X1, X2, X3 ... : "bag" structure (see function "saisir_excel2bag" for details)
with the same number of columns
Output argument:
================
X: concatenated bag structure
bag is a structure (such as X.d,X.i,X.v),
with bag.d being here a three way table of characters
if bag.d is dimensioned (n x p x v): n is the number of rows, v the
number of columns, and p the number of characters for each string.
The structure bag is obtained as out put argument of the function
"saisir_excel2bag".
Example:
[value1,bag1]=saisir_excel2bag('data1',['A'; 'B'],20);
[value2,bag2]=saisir_excel2bag('data2',['A'; 'B'],20);
bag3=saisir_appendbag1(bag1,bag2);
if(size(saisir1.d,2)~=size(saisir2.d,2))
help saisir_appendrow;
error('number of columns are not equal');
end
saisir.d=[saisir1.d;saisir2.d];
saisir.i=[saisir1.i;saisir2.i];
saisir.v=saisir1.v;Return to thematic list · HOMEfunction [saisir] = saisir_appendcol(saisir1,saisir2)Source: saisir_appendcol.m
appendcol - merges two files according to columns function: [X3]= appendcol(X1,X2) Flags pour la plateforme PULSAR --------------- Flag1 : appendcol - merges SAISIR - columns Flag2 : saisir1, saisir2 Flag3 : saisir Flag4 : Tools Input arguments: =============== X1, X2 : SAISIR Matrix dimensionned n x p and n x q Ouput argument: =============== X3 : SAISIR Matrix dimensionned n x(p+q) The identifiers or rows are recopied in X3.i The identifiers of columns are the concatenation of X1.v and X2.v Example: total=saisir_appendcol(chemistry1, chemistry2); see also: saisir_appendrow, saisir_appendrow1, saisir_appendcol1Return to thematic list · HOME
function [saisir] = saisir_appendcol1(saisir1,varargin)Source: saisir_appendcol1.m
saisir_appendcol1 - merges an arbitrary number of files according to columns usage: [X]= saisir_appendcol1(X1,X2,X3,...) Flags pour la plateforme PULSAR --------------- Flag1 : appendcol1 Flag2 : saisir1, varargin Flag3 : saisir Flag4 : Tools Input arguments: =============== X1, X2, X3 ... : SAISIR Matrices with the same numbers of rows Ouput argument: =============== X : SAISIR Matrix The identifiers or rows are recopied in X.i The identifiers of columns are the concatenation of X1.v, X2.v, X3.v ... Example: total=saisir_appendcol1(chemistry1, chemistry2, chemistry3 ); see also: saisir_appendrow, saisir_appendrow1, saisir_appendcolReturn to thematic list · HOME
function [saisir] = saisir_appendrow(saisir1,saisir2)Source: saisir_appendrow.m
saisir_appendrow - merges two SAISIR matrices according to rows usage: [X3]= saisir_appendrow(X1,X2) Flags pour la plateforme PULSAR --------------- Flag1 : appendrow - merges SAISIR matrices Flag2 : saisir1, saisir2 Flag3 : saisir Flag4 : Tools Input arguments: ================ X1, X2 : SAISIR Matrix dimensionned n1 x p and n2 x p Ouput argument: ============== X3 : SAISIR Matrix dimensionned (n1+n2) x p The identifiers or columns are recopied in X3.v The identifiers of rows are the concatenation of X1.i and X2.i Example: total=saisir_appendrow(spectra1, spectra2); see also: saisir_appendcol, saisir_appendrow1, saisir_appendcol1Return to thematic list · HOME
function [saisir] = saisir_appendrow1(saisir1,varargin)Source: saisir_appendrow1.m
saisir_appendrow1 - Merges an arbitrary number of files according to rows
usage: [X]= saisir_appendrow1(X1,X2,X3,...)
Flags pour la plateforme PULSAR
---------------
Flag1 : appendrow1
Flag2 : saisir1, varargin
Flag3 : saisir
Flag4 : Tools
Input arguments:
===============
X1, X2, X3 : SAISIR Matrices with the same number of columns
Ouput argument:
===============
X : SAISIR Matrix with p columns
The identifiers or columns are recopied in X.v
The identifiers of rows are the concatenation of X1.i, X2.i, X3.i ...
Example:
total=saisir_appendrow1(spectra1, spectra2, spectra3);
see also: saisir_appendcol, saisir_appendrow, saisir_appendcol1
if(size(saisir1.d,2)~=size(saisir2.d,2))
help saisir_appendrow1;
error('number of columns are not equal');
end
saisir.d=[saisir1.d;saisir2.d];
saisir.i=[saisir1.i;saisir2.i];
saisir.v=saisir1.v;Return to thematic list · HOMEfunction prediction = saisir_apply_knn(newdata,result)Source: saisir_apply_knn.m
SAISIR_APPLY_KNN
Apply a KNN model previously created and validated with saisir_knn
to a new SAISIR data set.
Syntax:
prediction = saisir_apply_knn(newdata,result)
Inputs:
newdata : SAISIR structure containing the new observations
newdata.d : n x p data matrix
newdata.i : observation identifiers
newdata.v : variable names
result : structure returned by saisir_knn
result.model : final KNN model
result.class_codes : numerical class codes
result.class_labels : class labels
result.input_variables : variables used to build the model
Output:
prediction : SAISIR structure containing the predicted classes
prediction.d :
col. 1 : predicted class code
col. 2 : KNN confidence
col. 3... : KNN scores for each class
prediction.i : observation identifiers
prediction.v : variable names
prediction.d2 : predicted class labels
prediction.model
prediction.k
prediction.class_codes
prediction.class_labels
Example:
result = saisir_knn(calibrationData,groups);
prediction = saisir_apply_knn(testData,result);
Notes:
The function does not re-estimate or modify the KNN model.
If the original KNN model was built with:
'Standardize',true
Matlab automatically applies to newdata the means and standard
deviations estimated from the original calibration data.
No additional standardization must therefore be performed here.
========================================================================
Check newdata structure
=========================================================================Return to thematic list · HOMEfunction [res]=saisir_apply_multiple_regression(x,type,y);Source: saisir_apply_multiple_regression.m
saisir_apply_multiple_regression - applies multiple_regression on "unknown" data function[res]=saisir_apply_multiple_regression(X,type,(y)) Flags pour la plateforme PULSAR --------------- Flag1 : apply_multiple_regression Flag2 : x, type, y Flag3 : res Flag4 : Prediction Input argument: ============== X: SAISIR matrix of predictive variables type: output argument of function "multiple_regression" y (optional): SAISIR vector of known observed y Output argument: =============== res with fields: ypred: predicted y if input argument "y" given : r2: r2 value RMSEV: root mean square error of validationReturn to thematic list · HOME
function[group]=saisir_apply_nuee(saisir,xcentre)Source: saisir_apply_nuee.m
saisir_apply_nuee - apply Nuee dynamique (KCmeans) saisir_nuee(X,barycenter) Flags pour la plateforme PULSAR --------------- Flag1 : apply_nuee - dynamic Nuee (KCmeans) Flag2 : saisir, xcentre Flag3 : group Flag4 : Prediction Input arguments ============= saisir : a SAISIR matrix of dimension n x p xcentre : a SAISIR matrix defining the barycenter k x p with k groups Output argument =============== group : a SAISIR vector of group (integer, n x 1). Identical values X :a matrix of dimension n x p barycenter : a matrix defining the barycenter k x p with k groups Barycenter is possibly the field "center" of the output of function "nuee"Return to thematic list · HOME
function res = saisir_apply_quaddis(quaddis_type,x,known_group);Source: saisir_apply_quaddis.m
saisir_apply_quaddis - Quadratic discriminant analysis saisir_apply_quaddis(quaddis_type,x,(known_group)); Flags pour la plateforme PULSAR --------------- Flag1 : apply_quaddis Flag2 : quaddis_type, x, known_group Flag3 : res Flag4 : Prediction Application of quadratic discriminant analysis (test) ==================================================== Input arguments: ================ quaddis_type : output of function "saisir_quaddis" (structure) x : predictive data saisir matrix (n x p) known_group : true groups of observations in x (n x 1) (optional) Ouput arguments: ================ result with fields: predgroup : predicted groups (n x 1) density : pseudo-density (n x gmax) proba : probability of belonging to a given group (n x gmax) if "known_group" defined nscorrect100 : percentage of correct classification (number) sconfus : confusion matrix (gmax x gmax)Return to thematic list · HOME
function [res] = saisir_apply_ridge_regression(ridgetype, x, y)Source: saisir_apply_ridge_regression.m
APPLY_RIDGE_REGRESSION - Applies a trained Ridge Regression model to new data
Description:
============
Predicts target values for an unknown dataset 'x' using coefficients from
a trained ridge regression model structure ('ridgetype'). If the actual observed
targets 'y' are provided, validation statistics (RMSEP and R2) are computed.
Flags pour la plateforme PULSAR
---------------
Flag1 : apply_ridge_regression
Flag2 : ridgetype, x, y
Flag3 : res
Flag4 : Prediction
Input arguments:
================
ridgetype : Structure output from saisir_ridge_regression containing model coefficients.
x : SAISIR structure of predictive variables (.d, .i, .v) for new samples.
y : (Optional) SAISIR structure of observed reference values (.d, .i, .v).
Output arguments:
=================
res : Structure containing:
.predy : SAISIR structure with predicted values for each ridge parameter.
.r2 : (If y provided) SAISIR structure with R2 coefficients of prediction.
.rmsep : (If y provided) SAISIR structure with Root Mean Square Error of Prediction.
1. Get dimensions and center the new X data using the calibration model's meanReturn to thematic list · HOMEfunction[res]=saisir_apply_stepwise_regression(type,x,y)Source: saisir_apply_stepwise_regression.m
saisir_apply_stepwise_regression - applies stepwise_regression on "unknown" data function[res]=saisir_apply_stepwise_regression(stepwise_type,X,(y)) Flags pour la plateforme PULSAR --------------- Flag1 : apply_stepwise_regression Flag2 : stepwise_type, x, y Flag3 : res Flag4 : Prediction Input arguments: ================ stepwise_type: array of cells obtained as output of stepwise_regression X : SAISIR matrix of predictive variables (n x p) y : SAISIR vector of observed variable (n x 1) Output argument =============== res with fields predy : predicted y for all the tested models rmsev : Root mean square error of validation (if input argument "y" defined) r2 : determination coefficients between oobserved and predicted y build as many models as available in "stepwise_type"Return to thematic list · HOME
function[res]=saisir_applyfda1(saisir,fda1type,actual_group)Source: saisir_applyfda1.m
saisir_applyfda1 - application of factorial discriminant analysis on PCA scores function[res]=saisir_applyfda1(X,fdatype,(actual_group)) Flags pour la plateforme PULSAR --------------- Flag1 : applyfda1 Flag2 : saisir, fda1type, actual_group Flag3 : res Flag4 : Prediction Input arguments: =============== X: Saisir matrix of predictive variables (n x p) fdatype : structure, output of function "fda1" actual_group (optional)(n x 1): SAISIR vector indicating the membership of the observations. A same number indicates that these observations belong to the same group. Output argument: =============== res with fields datafactor : discriminant scores (n rows) predicted_group: number indicating the prediction in each group If actual_group si given, the field "confusion" gives the confusion matrix row: actual group, columns: predicted by the "fda1" Typical example: ================ (calibration data in "calibration_data", group in "qualitative_group", Unknown data in "unknown_data"); Building the model p=saisir_pca(calibration_data); fdatype=fda1(p, qualitative_group, 10, 5) Applying the model res=saisir_applyfda1(unknown_data,fdatype); See also : saisir_fda1, saisir_maha3, saisir_maha6, saisir_plsda, saisir_pcaReturn to thematic list · HOME
function [predy]=saisir_applylr1(lrtype,X)Source: saisir_applylr1.m
saisir_applylr1 - Apply basic latent root model on saisir data x function [predy]=saisir_applylr1(lrtype,X) Flags pour la plateforme PULSAR --------------- Flag1 : applylr1 Flag2 : lr1type, x Flag3 : predy Flag4 : Prediction Input arguments: ================ lrtype: structure, output of function "lr1" (predictive model) X :SAISIR matrix of predictive variables Output argument =============== predy :SAISIR matrix of predicted y (for all the models asked when using "lr1" creates as many y predicted as allowed by the dimensions in lr1typeReturn to thematic list · HOME
function [supscores]=saisir_applypca(pcatype, X)Source: saisir_applypca.m
saisir_applypca - computes the scores of supplementary observations function [supscores]=saisir_applypca(pcatype, X) assess the scores of supplementary observations Flags pour la plateforme PULSAR --------------- Flag1 : applypca Flag2 : pcatype, saisir Flag3 : coordsup Flag4 : Prediction Input arguments: =============== pcatype: (structure) output argument of functions "saisir_pca","saisir_normed_pca", or "saisir_covariance_pca" X : SAISIR matrix of supplementary observations Output argument: =============== supscores : SAISIR matrix of scores of X Typical example =============== p=saisir_pca(spectra);%% PCA supscores=saisir_applypca(p,supplementary_spectra); saisir_map(supscores,1,2); The number of columns of X must be compatible with pcatype. If "saisir_normed_pca" was applied, X is divided by the standard deviations of the principal observations prior to projectionReturn to thematic list · HOME
function [predy]=saisir_applypcr(pcrtype,X)Source: saisir_applypcr.m
saisir_applypcr - applies basic PCR on data function [predy]=saisir_applypcr(pcrtype,X) apply a basic pcr (in pcrtype) on saisir data x creates as many y predicted as allowed by the dimensions in pcrtype Flags pour la plateforme PULSAR --------------- Flag1 : applypcr Flag2 : pcrtype, x Flag3 : predy Flag4 : Prediction Input arguments pcrtype:structure, output of function "PCR" X: SAISIR matrix of predictive variables Output argument predy : SAISIR matrix of predicted y, for all the dimensions tested see also: "saisir_pcr", "saisir_pcr1", "saisir_basic_pls"Return to thematic list · HOME
function res=saisir_applypls(X,plsmodel, (knowny))Source: saisir_applypls.m
saisir_applypls - applies a pls model on an unknown data set function res=saisir_applypls(X,plsmodel, (knowny)) Flags pour la plateforme PULSAR --------------- Flag1 : applypls Flag2 : x, plsmodel, knowny Flag3 : res Flag4 : Prediction Input arguments: --------------- X : SAISIR matrix (n x p) plsmodel :output argument of functions "saisir_pls", "saisir_basic_pls" or "saisir_basic_pls2" knowny (optional): actual value of y (if it is known, this allos the computation of r2 and RMSEV Ouput arguments: --------------- res with fields PREDY: predicted values for the all the models given by "plsmodel" (n x ndim) RMSEV: root mean square error of validation for all the models (only if "knowny" is given) (1 x ndim) r2: determination coefficient between predicted and observed y values (only if "knowny" is given) (1 x ndim) T: PLS scores of the set (n x ndim)Return to thematic list · HOME
function[res]=saisir_applyplsda(x,model,actual_group)Source: saisir_applyplsda.m
saisir_applyplsda - Applies pls discriminant analysis after model assessment using plsda function[res]=saisir_applyplsda(X,plsdatype,(actual_group)) return the predicted group on (unknown data x) Flags pour la plateforme PULSAR --------------- Flag1 : applyplsda Flag2 : x, model, actual_group Flag3 : res Flag4 : Prediction Input arguments: =============== X : SAISIR matrix of predictive variables plsdatype: structure returned by function 'plsda' actual_group (optional): SAISIR vector of observed groups. Observations with the same group number belong to the same group. Ouput argument: ============== res with fields: confusion1: matrix of confusion, method 1 (if "actual_group" defined) ncorrect1: Number of correct classifications, method 1 (if "actual_group" defined) predgroup1: predicted group (method1) confusion0: matrix of confusion, method 0 (if "actual_group" defined) ncorrect0: Number of correct classifications, method 0 (if "actual_group" defined) predgroup0: predicted group (method 0) Method 1: (attribution to index of max of predicted Y) Method 0: (shortest Mahalanobis distance calculated on PLS scores);Return to thematic list · HOME
function [predy]=saisir_applyspcr(spcrtype,X)Source: saisir_applyspcr.m
saisir_applyspcr - Applies a stepwise PCR function [predy]=saisir_applyspcr(spcrtype,X) Flags pour la plateforme PULSAR --------------- Flag1 : applyspcr Flag2 : spcrtype, x Flag3 : predy Flag4 : Prediction Input arguments: =============== spcrtype:(structure), output argument of spcr X: SAISIR marix of predictive variables Output argument: =============== predy: y predicted for all the tested dimensionsReturn to thematic list · HOME
function [group_type]=saisir_bag2group(bag)Source: saisir_bag2group.m
saisir_bag2group - uses the identifiers in bag to create groups
function [group_type]=saisir_bag2group(bag)
Flags pour la plateforme PULSAR
---------------
Flag1 : bag2group
Flag2 : bag
Flag3 : grouptype
Flag4 : Tools
Input argument
=============
bag: "bag" structure , output of function "saisir_excel2bag"
Ouptut argument
=============
group_type : array of cells of structure SAISIR
such as group_type{i} contains the SAISIR structure of groups as defined
by the corresponding column i in "bag"
creates as many group as different strings in the column of bag.d
useful for discriminant analysis or correspondance analysisReturn to thematic list · HOMEfunction [saisir] = saisir_bag_appendrow1(saisir1,varargin)Source: saisir_bag_appendrow1.m
saisir_bag_appendrow1 - Merges an arbitrary number of bags according to rows usage: [bag]= saisir_bag_appendrow1(saisir1, bag1, bag2 ....) Flags pour la plateforme PULSAR --------------- Flag1 : bag_appendrow1 Flag2 : saisir1, varargin Flag3 : saisir Flag4 : Tools Input arguments ============== bag1, bag2, bag3 ... : structure "bag" as defined in function "saisir_excel2bag" Ouput argument ============= bag: concatentation of bag1, bag2, bag3 with increase of the number of rows the second and third dimensions of bag.d must be equalsReturn to thematic list · HOME
function [barycentres] = saisir_barycenter(X, mygroups)Source: saisir_barycenter.m
saisir_barycenter - Calcule les barycentres des groupes d'une matrice SAISIR Flags pour la plateforme PULSAR --------------- Flag1 : Barycenter Flag2 : X, mygroups Flag3 : barycentres Flag4 : Tools INPUTS X : Matrice ou objet SAISIR (n échantillons x p variables) mygroups : Structure SAISIR contenant l'appartenance aux groupes. OUTPUT barycentres : Structure SAISIR contenant les coordonnées des barycentres (ngroupes x p)Return to thematic list · HOME
function saisir_barycenter_map(s,col1,col2,gr,charsize)Source: saisir_barycenter_map.m
saisir_barycenter_map - graph of map of barycenter function saisir_barycenter_map(s,col1,col2,gr,charsize) Flags pour la plateforme PULSAR --------------- Flag1 : barycenter_map Flag2 : s, col1, col2, gr, charsize Flag3 : none ( plotting function ) Flag4 : Plot Input arguments: ============== s: SAISIR matrix (n x p) col1, col2 : indices of the variables ploted in X and Y (integers) group: SAISIR vector of group ( n x 1). Indicates the group belonging of each observation charsize size of the Font (default: 7). Display two columns as a map Each observation is linked to its own barycentre by a straight line figure;Return to thematic list · HOME
function plstype = saisir_basic_pls(X,ndim)Source: saisir_basic_pls.m
function plstype = saisir_basic_pls(X,ndim)
Flags pour la plateforme PULSAR
---------------
Flag1 : basic_pls
Flag2 : x, y, ndim
Flag3 : plstype
Flag4 : Model
Input arguments:
================
X: SAISIR matrix of predictive variables (n x p)
X must contain:
X.d : data matrix
X.i : sample names
X.v : variable names
X.y : SAISIR vector of variables to be predicted (n x 1)
ndim: maximum number of dimensions asked
Output arguments:
=================
plstype with fields:
BETA: regression coefficients for the ndim models (p x ndim)
T: PLS scores (n x ndim)
P: PLS loadings such as X = TP + residuals (ndim x p)
Q: Q value such as y = TQ + residuals (ndim x 1)
BETA0: intercepts of the ndim models (ndim x 1)
PREDY: predicted y values up to ndim dimensions (n x ndim)
RMSEC: Root mean square error of calibration up to ndim dimensions (1 x ndim)
r2: determination coefficient between observed and predicted values (1 x ndim)
message: error message if X.y is missing or if another error occursReturn to thematic list · HOMEfunction result=basic_pls2(X,y,maxdim)Source: saisir_basic_pls2.m
basic_pls2 - PLS2 on several variables, several dimensions
function result=basic_pls2(X,y,maxdim)
Flags pour la plateforme PULSAR
---------------
Flag1 : basic_pls2
Flag2 : x, y, maxdim
Flag3 : res1
Flag4 : Model
Input arguments:
===============
X: SAISIR matrix of predictive variables ( n x p)
y: SAISIR vector of observed y (n x m)
maxdim (integer): maximum number of PLS dimensions
Ouput arguments:
===============
result with fields
T: PLS scores (n x maxdim)
loadings: PLS loadings (p x maxdim)
meanx: average of X (1 x p)
res: array of cells (maxdim elements)
A structure in res{i} with i = 1 ... maxdim contains the results of the
prediction of the variable i.
result.res{i} has the fields:
nom: (string) , name of the considered variable i
BETA (p x maxdim): regression coefficients up to maxdim dimensions
BETA0 (1 x maxdim): intercepts of the models
PREDY (n x maxdim): predicted y for 1 to maxdim dimensions
RMSEC (1 x maxdim): root mean square errors of calibration
r2 (1 x maxdim): r2 for 1 to maxdim dimensionsReturn to thematic list · HOMEfunction plstype=saisir_basic_pls3(X,y,ndim);Source: saisir_basic_pls3.m
function plstype=saisir_basic_pls3(X,y,ndim); Flags pour la plateforme PULSAR --------------- Flag1 : basic_pls Flag2 : X, y, ndim Flag3 : plstype Flag4 : Model Input arguments: ================ X: SAISIR matrix of predictive variables (n x p) y: SAISIR vector of variables to be predicted (n x 1) ndim: maximum number of dimension asked Output arguments: ================= plstype with fields: BETA: regression coefficients for the ndim models (p x ndim) T: PLS scores (n x ndim) P:�PLS loadings such as X = TP + residuals (ndim x p) Q: Q value such as y = TQ + residuals (ndim x 1) BETA0: intercepts of the ndim models (ndim x 1) PREDY: predicted y values up to ndim dimensions (n x ndim) RMSEC: Root mean square error of predicttion up to ndim dimensions (1 x ndim) r2: determination coefficient between observed and predicted values (1 x ndim) source : adaptation of the SCILAB FACT program "ikpls" as developped by Jean Claude Boulet (INRA Montpellier France and Jean-Micher Roger (IRSTEA CEMAGREF Montpelliet France) Dominique says " Ridge regression always surpasses PLS" Note : if you need to project supplementary observations in the PLS space use saisir_basic_pls1, which is much slower . see also: saisir_basic_pls1,saisir_basic_pls2, pcr, spcr, saisir_ridge_regression, saisir_ridge_regression1, saisir_lr1, saisir_applyplsReturn to thematic list · HOME
function saisir_browse(X,xstart)Source: saisir_browse.m
saisir_browse - browses a series of curves function saisir_browse(X,xstart) Flags pour la plateforme PULSAR --------------- Flag1 : browse Flag2 : saisir, xstart Flag3 : none ( plotting function ) Flag4 : Plot Display the rows of the SAISIR matrix X as curves Right button to go down, Left button to go up, Ctrl C to exit If X.v can be interpreted as a vector of number (such as wavelengths), the X scale is given by this vector. Otherwise, the X-axis is simply given by the rank of the variablesReturn to thematic list · HOME
function [indicator, groupings] = saisir_build_indicator(x)Source: saisir_build_indicator.m
BUILD_INDICATOR - Builds a complete disjoint table (One-Hot Encoding / Complete Indicator Matrix)
[indicator, groupings] = saisir_build_indicator(x)
This function converts a SAISIR matrix containing categorical variables
(represented as integers) into a dummy/disjoint binary matrix (0 or 1).
This preprocessing step is mandatory for Multiple Correspondence Analysis (MCA).
Flags pour la plateforme PULSAR
---------------
Flag1 : build_indicator
Flag2 : x
Flag3 : indicator, groupings
Flag4 : Tools
Input arguments:
================
x : Valid SAISIR structure. x.d must be an (n x p) matrix of integer values
representing qualitative categories/modalities.
Output arguments:
=================
indicator : Valid SAISIR structure containing the complete disjoint table.
The number of rows is 'n', the number of columns equals the total
number of categories across all variables.
groupings : Cell array of structures (1 x p) mapping and describing the modalities
for each original variable.
--- 1. Control of Input Arguments ---Return to thematic list · HOMEfunction ca_type=saisir_ca(N);Source: saisir_ca.m
saisir_ca - CORRESPONDENCE ANALYSIS
function ca_type=saisir_ca(N);
Flags pour la plateforme PULSAR
---------------
Flag1 : ca - CORRESPONDENCE ANALYSIS
Flag2 : N
Flag3 : ca_type
Flag4 : Model
Compute correspondence analysis from the contingency table in N;
N is a SAISIR structure
If only groupings are available, the contigency table must be computed
before using this function (see for example function "saisir_contingency_table")
==============================================================
Fields of the output
score :CA scores of rows followed by CA scores of columns
eigenval :eigenvalues, percentage of inertia, cumulated percentage
contribution :contribution to the component rows, then columns
squared_cos :squared cosinus row, then columns
khi2 :khi2 of the contingency table
df :degree of freedom
probability :probability of random values in contigency table
==============================================================
The identifiers of rows of 'score' (which are the identifiers of rows and columns of N (N.i and N.v)
are preceded with the letter 'r' or 'c'.
It is therefore possible to use color for emphazising row and columns in
the simultaneous biplot of rows and columns
Source : G. Saporta. Probabilites, analyse des donnees et statistiques.
: Edition Technip, page 198 and followings.
REMARK : use function "saisir_ca_map" to plot the biplot observation/variableReturn to thematic list · HOMEfunction saisir_ca_map(graphHandle, s,col1,col2,startpos,endpos,labcol1,labcol2,titre,charsize,marg)Source: saisir_ca_map.m
saisir_ca_map - colored map for correspondence analysis: using a portion of the identifiers as labels saisir_ca_map(X,col1,col2,startpos,endpos,(col1label),(col2label),(title),(charsize),(margin)) Flags pour la plateforme PULSAR --------------- Flag1 : ca_map Flag2 : graphHandle, s, col1, col2, startpos, endpos, labcol1, labcol2, titre, charsize, marg Flag3 : none ( plotting function ) Flag4 : Plot Input arguments: ================ X: SAISIR data matrix col1, col2: rank of the columns to be displayed (normaly scores obtained from function "ca". startpos, endpos: position of the string in the identifiers indicating the color of the display Biplot of two columns as colored map useful for correspondance analysis (from function "ca") The coloration of the displayed descriptors depends on the arguments "startpos" and "endpos". If one of this argument is zero: single (black) color Otherwise, from the names of individual, the string name(sartpos:endpos) is extracted. Two observations for which these strings are different, are also colored differently. THIS FUNCTION IS SPECIFIC TO CORRESPONDANCE ANALYSIS: If the first letter of the identifier is either c(column) or r (row), this letter is removed in the name. The letter c produces an italic display. This allows a representation in which the variables are in italic letter couleur=[0 0 0; 1 0 1; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ]; couleur=[0 0 1; 1 0 0; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ];Return to thematic list · HOME
Source: saisir_calculerModeleKovats.m
Return to thematic list · HOMEfunction [saisir, xmean] = saisir_center(mydata)Source: saisir_center.m
SAISIR(c) function_LARTIC 2024_ saisir_center() remplace les NaN par la moyenne de colonne, puis centre les colonnes function [saisir, xmean] = saisir_center(mydata) Flags pour la plateforme PULSAR --------------- Flag1 : Centering Flag2 : mydata Flag3 : saisir, xmean Flag4 : Correction Input argument: --------------- mydata : matrice SAISIR (n x p) Output argument: --------------- saisir : matrice SAISIR (n x p) centrée (moyenne de chaque colonne = 0) xmean : vecteur SAISIR (1 x p) des moyennes de colonnes AVANT centrage Remarque : Les NaN de chaque colonne de mydata.d sont remplacés par la moyenne de la colonne (calculée en ignorant les NaN) avant le centrage. 1) On récupère les données numériquesReturn to thematic list · HOME
function [pcatype1] = saisir_change_sign(pcatype,ncomp)Source: saisir_change_sign.m
saisir_change_sign - changes the sign of a component and of its associated eigenvector function [pcatype1] = saisir_change_sign(pcatype,ncomp) Flags pour la plateforme PULSAR --------------- Flag1 : change_sign Flag2 : pcatype1, ncomp Flag3 : pcatype Flag4 : Tools Input argument: -------------- pcatype : output argument of function pcatype Output argument: --------------- pcatype1: new pca structure The function is useful when several PCAS has been computed. For the sake of clarity, it may be useful to have the axis oriented in (about) the same directions. In this way, the graphical representations may be easier to interpret. see also: function "smart_coord"Return to thematic list · HOME
function check=saisir_check(X)Source: saisir_check.m
saisir_check - Checks if the data respect the saisir stucture function check=saisir_check(X) Flags pour la plateforme PULSAR --------------- Flag1 : saisir_check Flag2 : x Flag3 : check Flag4 : Tools Input argument: ============== X: (expected) SAISIR matrix Output argument: =============== check: check = 1 if x is in the SAISIR format (no warning) check = 2 if x is in the SAISIR format (with warning) check = 0 if x is not in the SAISIR format (fatal error) The function tests if the input argument X is a valid SAISIR structure and gives some information. If X is a valid structure, also signals (as warning) if there are missing values, identical rows or columns (which may be the sign of something wrong) Useful to see if X is a valid '.d','.i','.v' structure.Return to thematic list · HOME
function [detected,names]=saisir_check_name(string)Source: saisir_check_name.m
saisir_check_name - Controls if some strings are strictly identical in a string array function [detected,names]=saisir_check_name(string) Flags pour la plateforme PULSAR --------------- Flag1 : check_name Flag2 : string Flag3 : detected, names Flag4 : Tools Input argument: -------------- "string": a matrix of characters ouput argument: -------------- detected: vectors giving the indices of the observations having the same name. names: matrix of characters giving the found identical name This function is mainly used in relationship with function "saisir_reorder"Return to thematic list · HOME
function h=saisir_colored_curves(X,group)Source: saisir_colored_curves.m
coloured_curves - displays curves coloured according to groups function h=saisir_colored_curves(X,group) Flags pour la plateforme PULSAR --------------- Flag1 : colored_curves Flag2 : s, group Flag3 : h ( plotting function ) Flag4 : Plot Input argument: -------------- X: SAISIR matrix (n x p) group: Saisir vector of groups (integers,n x 1). The function displays all the observations as curves. Each curve is colored according to the values in "group". The observations with the same group number are colored identically.Return to thematic list · HOME
function saisir_colored_map1(hgraph, s,col1,col2,startpos,endpos,labcol1,labcol2,titre,charsize,marg)Source: saisir_colored_map1.m
SAISIR(c) function_LARTIC 2024
saisir_colored_map1 - colored map : using a portion of the identifiers as labels
saisir_colored_map1(hgraph,s, col1,col2,startpos,endpos,(col1label),(col2label),(title),(charsize),(margin))
Biplot of two columns as colored map
Flags pour la plateforme PULSAR
---------------
Flag1 : colored_map1
Flag2 : s, col1, col2, startpos, endpos, labcol1, labcol2, titre, charsize, marg
Flag3 : none ( plotting function )
Flag4 : Plot
Input arguments:
===============
hgraph : handle de la fenetre qui recevra la
X: SAISIR matrix
col1, col2 : index of the two columns to be represented (integer values)
startpos, endpos: position in the identifier strings of rows ('.i') for
the coloration
col1label (optional): Label of the variable forming the X-axis
col2label (optional): Label of the variable forming the Y-axis
title (optional) : title of the graph
charsize (optional) : size of the plotted characters
marg (optional) : margin value allowing an extension of the axis in order
to cope with long identifiers (default value: 0.05)
Use preferably "saisir_colored_map1"
The coloration of the displayed descriptors depends on the arguments
startpos and endpos.
From the names of individual, the string name(sartpos:endpos) is extracted. Two observations
for which these strings are different, are also colored differently.
Example:
Let X be a SAISIR matrix
Let X.i being
'wheat1'
'barle2'
'ricex1'
'wheat2'
'barle3'
...
The command 'saisir_colored_map1(gca, X,5,3,1,5)' will plot the column 5 as X, 3, as Y
The characters are extracted from 1 to 5 , that is strings 'wheat', 'barley',
'ricex'.A different color will be given for each of this strings.
See also saisir_colored_map2 (same principle but with the whole identifier name
displayed)
clf;
cla;
figure;
couleur=[0 0 0; 1 0 1; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ];
couleur=[0 0 1; 1 0 0; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ];Return to thematic list · HOMEfunction saisir_colored_map2(s,col1,col2,startpos,endpos, haxes, labcol1,labcol2,titre,charsize,marg)Source: saisir_colored_map2.m
saisir_colored_map2 - colored map : using a portion of the identifiers as labels
saisir_colored_map2(s,col1,col2,startpos,endpos, haxes, labcol1,labcol2,titre,charsize,marg)
Biplot of two columns as colored map
Flags pour la plateforme PULSAR
---------------
Flag1 : colored_map2
Flag2 : s, col1, col2, startpos, endpos, haxes, labcol1, labcol2, titre, charsize, marg
Flag3 : none ( plotting function )
Flag4 : Plot
Input arguments:
===============
X: SAISIR matrix
col1, col2 : index of the two columns to be represented (integer values)
startpos, endpos: position in the identifier strings of rows ('.i') for
the coloration
haxess : handle for target graph
col1label (optional): Label of the variable forming the X-axis
col2label (optional): Label of the variable forming the Y-axis
title (optional) : title of the graph
charsize (optional) : size of the plotted characters
marg (optional) : margin value allowing an extension of the axis in order
to cope with long identifiers (default value: 0.05)
For the French users: there is a synonym function "carte_couleur2".
Use preferably "saisir_colored_map2"
The coloration of the displayed descriptors depends on the arguments
startpos and endpos.
From the names of individual, the string name(sartpos:endpos) is extracted. Two observations
for which these strings are different, are also colored differently.
example:
Let X be a SAISIR matrix
Let X.i being
'wheat1'
'barle2'
'ricex1'
'wheat2'
'barle3'
...
The command 'saisir_colored_map1(X,5,3,1,5)' will plot the column 5 as X, 3, as Y
The characters are extracted from 1 to 5 , that is strings 'wheat', 'barley',
'ricex'.A different color will be given for each of this strings.
See also saisir_colored_map1 (same principle but with only the portion of
the identifier names, from startpos to endpos, displayed)
clf;
cla;
figure;
couleur=[0 0 0; 1 0 1; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ];
couleur=[0 0 1; 1 0 0; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ];Return to thematic list · HOMEfunction saisir_colored_map4(s,col1,col2,choice,symbol_choice,charsize)Source: saisir_colored_map4.m
saisir_colored_map4 - colored map according to 2 criteria saisir_colored_map4(X,col1,col2,color_choice,(symbol_choice),(charsize);) Flags pour la plateforme PULSAR --------------- Flag1 : colored_map4 Flag2 : s, col1, col2, choice, symbol_choice, charsize Flag3 : none ( plotting function ) Flag4 : Plot Input_arguments -------------- X: SAISIR matrix of data (n x p) col1, col2 : rank of the columns to be represented choice: first criterion of choice, dealing with the colors symbol_choice (optional): second criteria of choice, dealing with the symbols Biplot of two columns as colored map The coloration of the displayed descriptors depends on the arguments choice (either matrix of char, vector of number or saisir structure); with number of elements equal to the number rows in s; if the elements of "choice" are different, they are also colored differently. if "symbol_choice" is also defined (either matrix of char, vector of number or saisir structure) different symbols are used. The color of the point is then given by "choice", and the shape of the symbol depends on "symbol_choice" Example of use: Colored text with color determined by the second character in wheat.i saisir_colored_map4(wheat,1,50,wheat.i(:,2));; saisir_carte_couleur4(ble,1,50,ble.i(:,2),ble.i(:,3)); color: determined by the second character in wheat.i colored symbol: shape determined by the third character in wheat.i clf; cla; figure; couleur=[0 0 0; 1 0 1; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ]; couleur=[0 0 1; 1 0 0; 0 0 1; 0 0.7 0; 0.5 0.5 0; 0.5 0 0.5; 0 0.5 0.5 ; 0.25 0.25 0.25 ; 0.5 0 0; 0 0.5 0; 0 0.5 0; 0.1 0.2 0.3; 0.3 0.2 0.1; 0.5 0.5 0.8; 0.1 0.8 0.1 ];Return to thematic list · HOME
function [res] = saisir_comdim(col, ndim, threshold)Source: saisir_comdim.m
COMDIM - Finding common dimensions in multi-table data (ComDim / CCSWA)
Description:
============
Performs Common Dimensions Analysis on a collection of multi-set data tables.
All tables must contain the exact same number of observations (rows).
Flags pour la plateforme PULSAR
---------------
Flag1 : comdim
Flag2 : col, ndim, threshold
Flag3 : res
Flag4 : Model
Input arguments:
================
col : A cell array of SAISIR structures, e.g., {table1, table2, table3}.
(Legacy structure arrays are also supported for backward compatibility).
ndim : (Optional) Number of common dimensions to compute (Default: number of tables).
threshold : (Optional) Iterative loop convergence tolerance (Default: 1E-10).
Output arguments:
=================
res : A structure containing the ComDim results formatted as SAISIR objects:
.Q : Compromise observation scores (nrow x ndim).
.saliences : Weights (saliences) of the original tables on each dimension (ntable x ndim).
.explained : Percentage of variance explained by each common dimension.
Reference:
==========
E.M. Qannari, I. Wakeling, P. Courcoux and H. J. H. MacFie,
Food Quality and Preference 11 (2000) 151-154.
1. Handle optional input arguments and defaultsReturn to thematic list · HOMEfunction res=contingency_kh2(table);Source: saisir_contingency_khi2.m
saisir_contingency_khi2 - computes khi2 stats on a contingency table
function res=contingency_kh2(table);
Flags pour la plateforme PULSAR
---------------
Flag1 : contingency_khi2
Flag2 : table
Flag3 : res
Flag4 : Tools
Input argument:
--------------
table: SAISIR matrix of contingency table (n x p)
output argument
--------------
res with fields:
theo: theoretical contingency table assuming independence of rows and
columns in "table"
khi2: khi2 value
dll: degree of freedom of the model
P: probability of the null hypothesis ("independence of rows and columns")
Each element of input argument "table" gives the number of observations
which both belongs to the group of the corresponding row and the
corresponding column. For example table.d(2,4) indicates the number of
observations which are both in the group 2 of rows and in the group 4 of
columns.
The contingency table can be created with the function "saisir_contingency_table"Return to thematic list · HOMEfunction tbl = saisir_contingency_table(g1, g2)Source: saisir_contingency_table.m
CONTINGENCY_TABLE - Computes a contingency table from two group vectors
Description:
============
Cross-tabulates two categorical group vectors 'g1' and 'g2' to count the
joint frequencies of occurrences. Safely handles non-consecutive, zero,
or negative group identifiers by extracting true unique classes.
Flags pour la plateforme PULSAR
---------------
Flag1 : contingency_table
Flag2 : g1, g2
Flag3 : tbl
Flag4 : Tools
Input arguments:
================
g1 : SAISIR structure vector (n x 1) representing the first grouping factor (.d, .i, .v).
g2 : SAISIR structure vector (n x 1) representing the second grouping factor (.d, .i, .v).
Output argument:
================
tbl : A SAISIR structure containing the contingency table (.d, .i, .v).
tbl.d(i,j) contains the number of observations belonging simultaneously
to group i in g1 and group j in g2.
See also:
=========
crosstab, accumarray
1. Verify input dimensionsReturn to thematic list · HOMEfunction [cor] = saisir_cormap(X1,X2)Source: saisir_cormap.m
saisir_cormap - Correlation between two tables function [cor] = saisir_cormap(X1,X2) Flags pour la plateforme PULSAR --------------- Flag1 : cormap Flag2 : saisir1, saisir2 Flag3 : saisir Flag4 : Tools Input arguments -------------- X1 and X2: SAISIR matrix dimensioned n x p1 and n x p2 respectively Output argument: --------------- cor: matrix of correlation dimensioned p1 x p2) the tables must have the same number of rows An element cor.d(i,j) is the correlation coefficient between the column i of X1 and j of X2Return to thematic list · HOME
function [saisir] = saisir_correct_baseline (saisir1,col1,col2)Source: saisir_correct_baseline.m
saisir_correct_baseline - simple linear baseline correction, using intensity function [saisir] = saisir_correct_baseline (saisir1,col1,col2) Flags pour la plateforme PULSAR --------------- Flag1 : correct_baseline Flag2 : saisir1, col1, col2 Flag3 : saisir Flag4 : Correction Input arguments --------------- saisir1: SAISIR matrix (n x p) col1 and col2 : ranks of the columns to be used for baseline correction. Output argument --------------- saisir: SAISIR matrix (n x p) after baseline correction. The baseline is modelled by a straight line going from data points col1 to col2Return to thematic list · HOME
function[res] = saisir_correlation_circle(hgraph, pcatype,saisir,col1,col2,startpos,endpos, showgraph)Source: saisir_correlation_circle.m
SAISIR(c) function_LARTIC 2026 - correlation_circle function[results] = correlation_circle(hgraph,pcatype,X,col1,col2,(startpos),(endpos),showgraph) Input arguments --------------- pcatype: output argument of function "saisir_pca") X: original data matrix (n x p) col1 and col2 : ranks of the PC-scores to be represented. startpos and endpos(optional): key in the variable identifiers for coloring the variables (optional) showgraph: compute correlation circle between variables from X and loadings from pcatype Output argument -------------- res: matrix p x n scores of the correlations between the variables and all the available PC-scores The function draw the correlation circle typical example Let "chemistry" be a SAISIR matrix mypca = saisir_pca(chemistry); saisir_correlation_circle(hgraph,mypca,chemistry,col1,col2, 'on'); %correlation circle of plan %#1-#2 Note: Use preferably the function "saisir_correlation_plot"Return to thematic list · HOME
function handle=saisir_correlation_plot(scores,col1,col2, X1,X2, ...);Source: saisir_correlation_plot.m
saisir_correlation_plot - Draw a correlation between scores and tables function handle=saisir_correlation_plot(scores,col1,col2, X1,X2, ...); Flags pour la plateforme PULSAR --------------- Flag1 : correlation_plot Flag2 : scores, col1, col2 Flag3 : handle (Plotting function) Flag4 : Plot Input arguments: ============== scores: - ORTHOGONAL scores obtained by multidimensional analysis col1 and col2: - Indices (ranks) of the scores to be plotted (integer number) X, X2, ... - Arbitrary number of tables giving the variables to be plotted The number of rows in the scores and other tables must be identical The function displays the correlation circle, with a different color for each table in X1, X2 ... A dotted line gives the level of 50% explained variable. If the input argument "scores" have non-orthogonal columns the graph is normally incorrect and a warning message is displayed.Return to thematic list · HOME
function EEMcorr = saisir_corrige_rayleigh(EEM,Lex)Source: Fluorescence/saisir_corrige_rayleigh.m
CORRIGE_RAYLEIGH Suppression et reconstruction des diffusions Rayleigh d'une EEM EEM(:,1) = longueurs d'onde d'émission Lem EEM(:,2:end) = intensités de fluorescence Lex = longueurs d'onde d'excitation EEMcorr = matrice corrigée, même format que EEM ParamètresReturn to thematic list · HOME
function[pcatype]=saisir_covariance_pca(covariance_type,ncomponent)Source: saisir_covariance_pca.m
saisir_covariance_pca - principal component analysis when knowing the covariance (of variables) function[pcatype]=saisir_covariance_pca(covariance_type,(nscore)) Flags pour la plateforme PULSAR --------------- Flag1 : covariance_pca Flag2 : covariance_type, ncomponent Flag3 : pcatype Flag4 : Model Input arguments: --------------- covariance_type: output argument of function "saisir_cumulate_covariance" nscore : (integer, optional) number of scores to be calculated (default : all) Output argument: ---------------- pcatype with fields: eigenvec: eigenvector eigenval:eigenvalues average:average value of the active observations Performs PCA on the covariance matrix as calculated by"saisir_cumulate_covariance" This function is useful fo to carrying on PCA with huge data set (see "saisir_cumulate_covariance" for an example of use) typical example: A complete script must therefore be something like cov=saisir_cumulate_covariance(spectra_1);%% starting cov=saisir_cumulate_covariance(spectra_2,cov);%% cumulating values of matrix 1 cov=saisir_cumulate_covariance(spectra_3,cov);%% cumulating values of matrix 2 ... cov=saisir_cumulate_covariance(spectra_k,cov);%% cumulating values of matrix k covariance_type=saisir_cumulate_covariance([],cov);%% finishing [pcatype]=saisir_covariance_pca(covariance_type,(ncomponent)) score1=saisir_applypca(pcatype,spectra_1);%% projecting data from spectra_1 This function is mainly used to compute PCA on huge data set, which cannot be loaded completely in the free memory, and thust must be split in smaller subset of observations. related function; "saisir_cumulate_covariance" (covariance of huge data set)Return to thematic list · HOME
function res=saisir_covariance_select(X,Y,nvar,standardize);Source: saisir_covariance_select.m
saisir_covariance_select - selection of predictive variables from covariance
function res=saisir_covariance_select(X,Y,nvar,standardize);
Flags pour la plateforme PULSAR
---------------
Flag1 : covariance_select
Flag2 : saisir, y, nvar, standardize
Flag3 : res
Flag4 : VarSel
Input arguments
===============
X :Saisir matrix of predictive variable (n x p)
y :Saisir vector of variables to be predicted (n x k)
nvar: Number of variables introduced in the model
standardize(optional): if true, the data are standardized before covsel application ; false(default) : data not standardized
Output argument
===============
res with fields:
-res.rank : indices of the selected variables (up to nvar variables)
-res.cumulated_variance : percentage of the variance reconstructible from
the selected variables in X . First column: cumulated variance of X, second
column : cumulated variance in Y.
res.reducedX: X reduced to selected variables
According to :
J.M Roger, B. Palagos, D.Bertrand; E.Fernadez-Ahumuda. CovSel: S�lection
de variables dans le cas hautement multivari� et d'�talonnage
multi-r�ponses. Application � la spectrom�trie IR. Congress "Chimiom�trie
2009, Paris 30 november-1st December 2009"
AgroParisTech, 48-51.
Typical example:
Asking for 10 variables
res=saisir_covariance_select(X,y,10)
res =
rank: [1x1 struct]
cumulated_variance: [1x1 struct]
see also: saisir_stepwise_regressionReturn to thematic list · HOMEfunction [cov] = saisir_covmap(X1,X2)Source: saisir_covmap.m
saisir_covmap - assesses the covariances between two tables function [cov] = saisir_covmap(X1,X2) Flags pour la plateforme PULSAR --------------- Flag1 : covmap Flag2 : saisir1, saisir2 Flag3 : saisir Flag4 : Tools Input arguments -------------- X1 and X2: SAISIR matrix dimensioned n x p1 and n x p2 respectively Output argument: --------------- cov: matrix of covariance dimensioned p1 x p2) the tables must have the same number of rows An element cov.d(i,j) is the covariance between the column i of X1 and j of X2Return to thematic list · HOME
function [covSel] = saisir_covsel(mydata, y, nbVar)Source: saisir_covsel.m
saisir_covsel(x, y, lv) - Selection of variable from covariance maximisation [covSel] = saisir_covsel(x, y, lv) Flags pour la plateforme PULSAR --------------- Flag1 : CovSel Flag2 : mydata Flag3 : covSel Flag4 : VarSel Input arguments ================ mydata : Saisir matrix with .d with dim n x p y : Saisir matrix with .d with dim n x 1 lv : nombre de variables max à sélectionner standardize (optional): if false (default) data not standardized, true: data standardized Output arguments ================ covsel.d : data matrix with selected variables covsel.i : sample names covsel.v : name of selected variables covsel.mydata : initial dataset before covsel covSel.num : number (rank) of selected variables covSel.crbvar : evolution des variances cumulees de X (1ere colonne) et de Y (2eme)Return to thematic list · HOME
function covSel = saisir_covsel_bands(mydata, Y, nvar, window)Source: saisir_covsel_bands.m
SAISIR(c) function_LARTIC 2026 - saisir_covsel_bands(mydata, Y, nvar, window) Perfom CovSel using bands instead of variable on SAISIR matrix [covSel] = saisir_covsel_bands(mydata, Y, nvar, window) Flags pour la plateforme PULSAR --------------- Flag1 : saisir_covsel_bands Flag2 : mydata, Y, nvar, window Flag3 : covSel Flag4 : VarSel CovSel par bandes spectrales avec sortie SAISIR Entrées : mydata : structure SAISIR contenant au minimum le champ .d Y : vecteur ou matrice réponse, taille n x q nvar : nombre de centres de bandes à sélectionner window : demi-largeur de bande autour de chaque centre sélectionné Sortie : covSel.d : données réduites aux variables sélectionnées covSel.i : noms d'observations, si présents dans mydata covSel.v : noms de variables sélectionnées, si présents dans mydata covSel.idxBands : indices de toutes les variables sélectionnées covSel.idxCenter : indices des centres sélectionnés covSel.rawdata : structure SAISIR initiale complète covSel.Y : Y utilisé après éventuelle transformation covSel.groups : liste des groupes si Y était un vecteur de groupes Author : C.B.Y. Cordella, LARTIC, Université LAvalReturn to thematic list · HOME
function [covSel] = saisir_covsel_groups(mydata, nbVar, firstLetter, lastLetter)Source: saisir_covsel_groups.m
saisir_covsel(x,lv,firstLetter, lastLetter) - Selection of variable from covariance maximisation [covSel] = saisir_covsel(x,lv,firstLetter, lastLetter) Flags pour la plateforme PULSAR --------------- Flag1 : CovSel Flag2 : mydata Flag3 : covSel Flag4 : VarSel Input arguments ================ mydata : Saisir matrix with .d with dim n x p lv : nombre de variables max à sélectionner firstLetter, lastLetter : 1ere et dernier caractere pour la formation des groupes Output arguments ================ covsel.d : data matrix with selected variables covsel.i : sample names covsel.v : name of selected variables covsel.mydata : initial dataset before covsel covSel.num : number (rank) of selected variables covSel.crbvar : evolution des variances cumulees de X (1ere colonne) et de Y (2eme)Return to thematic list · HOME
function [Warping, XWarped_saisir, Diagnos] = saisir_cow(T, X, Seg, Slack, Options, context)Source: saisir_cow.m
saisir_cow - Wrapper SAISIR pour l'alignement de signaux par COW (Correlation Optimized Warping) Flags pour la plateforme PULSAR --------------- Flag1 : COW - Correlation Optimized Warping Flag2 : T, X, Seg, Slack, Options, context Flag3 : Warping, XWarped_saisir, Diagnos Flag4 : Correction Input arguments: ================ T : Objet SAISIR (1 x nt) contenant le signal cible (Target) X : Objet SAISIR (mP x nP) contenant les signaux à aligner Seg : Longueur du segment (ou matrice de frontières prédéfinies) Slack : Tolérance maximale d'alignement (déplacement autorisé) Options : (Optionnel) Options de calcul/graphique COW context : (Optionnel) Contexte d'exécution (0: classique, 1: webApp) 1. Gestion des arguments optionnels par défautReturn to thematic list · HOME
function saisir=saisir_create_group(saisir1,code_list,startpos,endpos)Source: saisir_create_group.m
saisir_create_group - creates a vector of numbers indicating groups from identifiers group=saisir_create_group(X,code_list,startpos,endpos) Flags pour la plateforme PULSAR --------------- Flag1 : create_group Flag2 : saisir1, code_list, startpos, endpos Flag3 : saisir Flag4 : Tools Input arguments: --------------- X: SAISIR matrix (n x p) code_list:matrix of character (k x q) startpos, endpos: place in the identifier names where to find the code Output argument: --------------- group: SAISIR vector (n x 1) of groups. A same number indicates that the observations belong to the same group Normally, k groups are identified typical use: group=saisir_create_group(X,['A1';'B2';'C1'],3,4]); The command seek in X.i the codes 'A1', 'B2', 'C1', in position 3 to 4 Observations with code 'A1', 'B2, 'C1' are placed in group numbered 1, 2 and 3 respectively. see also "saisir_create_group1" group structure are used in discriminant analysis, anova and relate methodsReturn to thematic list · HOME
function [group]=saisir_create_group1(X,startpos,endpos)Source: saisir_create_group1.m
saisir_create_group1 - uses the identifiers to create groups function [group]=saisir_create_group1(X,startpos,endpos) Flags pour la plateforme PULSAR --------------- Flag1 : create_group1 Flag2 : s, startpos, endpos Flag3 : saisir, effectif Flag4 : Tools Input arguments: ================ X: SAISIR matrix (n x p) startpos, endpos: place in the identifier names where to find the code Output argument: ================ group :SAISIR vector (n x 1) of groups. A same number indicates that the observations belong to the same group group.g : number of observations in each found group This function uses the row identifiers (considered as relevant keys) for creating groups. Its identifies as many group as different strings from startpos to endpos Typical example ================ mygroup=saisir_create_group1(X,1,2);%% use the characters in pos 1 to 2 of the row names (X.i) As illustration mygroup.d(1:30:100,1) % ans= % 2.00 %% belongs to group 2 % 2.00 % 4.00 %%belongs to group 4, % 1.00 %% and so on mygroup.g.d % 38.00 %% Number of obs. in group 1 % 35.00 %% Number of obs. in group 2 % 40.00 %% and so on ... % 27.00 The function "saisir_create_group1" is very commonly used when groups are needed (For example, in discriminant analysis, ANOVA, ellipse_map , etc ) See also: saisir_contingency_tableReturn to thematic list · HOME
function[res]=saisir_cross_ridge_regression(x,y,krange,selected)Source: saisir_cross_ridge_regression.m
saisir_cross_ridge_regression - ridge regression with validation function[res]=saisir_cross_ridge_regression(X,y,krange,selected) Flags pour la plateforme PULSAR --------------- Flag1 : cross_ridge_regression Flag2 : x, y, krange, selected Flag3 : res Flag4 : Model Input arguments: --------------- X: Saisir matrix of the predictive data set (n x p) y: Saisir vector of value to be predicted (n x 1) krange: Matlab vector of double (k x 1) (see function "ridge regression") selected:Matlab vector which elements are either equal to 0 or 1 Output arguments ---------------- res with fields predy: predicted y in validation (n2 x k) obsy: observed y in validation (n2 x k) r2: r2 between observed and predicted y in validation (1 x k) rmsecv: root mean square error of validation (1 x k) ridgetype: see function "ridge_regression" divides a collection in calibration (selected = 0) and verification set (selected = 1) applies saisir_ridge_regression on the validation set All the models with the k parameter in "krange" are testedReturn to thematic list · HOME
function[res]=saisir_crossfda1(saisir,group,among,maxvar,ntest)Source: saisir_crossfda1.m
saisir_crossfda1 - validation on discrimination according to fda1 (directly on data) function[res]=saisir_crossfda1(X,group,among,maxvar,ntest) Flags pour la plateforme PULSAR --------------- Flag1 : crossfda1 Flag2 : saisir, group, among, maxvar, ntest Flag3 : res Flag4 : Model input arguments =============== X: Saisir data matrix (n x p) group:Saisir vector of group (integer, n x 1).Two observations belonging to the same group have the same group number. among: maximum rank of the PC scores entered in the model (see "saisir_fda1" for details) maxvar: (integer) maximal number of scores entered in the model ntest: (integer) number of observation in each group in the validation set ouput arguments: =============== res with fields fdatype: fdatype built up with the calibration set (see function "saisir_fda1") verification: with fields datafactor: discriminant scores of the validation set predicted_group: in the validation set confusion: confusion matrix of the validation set (rows: actual group; columns: predicted group) The function applies "saisir_fda1" by dividing the sample in X into calibration and validation set "ntest" observations in each group are randomly (with no repeat) placed in test group. typical example: g=saisir_create_group1(wheat,2,3);%% creation of the vector of group number res=saisir_crossfda1(wheat,g,10,5,5); res.validation.confusion;%% confusion matrix in validation saisir_colored_map1(res.validation.datafactor,1,2,2,3); %% looking at the discriminant biplot of the validation setReturn to thematic list · HOME
function[discrtype2]=saisir_crossmaha(saisir,group,maxvar,ntest)Source: saisir_crossmaha.m
saisir_crossmaha - validation on discrimination according to saisir_maha1 (directly on data) function[discrtype]=saisir_crossmaha(X,group,maxvar,ntest) Flags pour la plateforme PULSAR --------------- Flag1 : crossmaha Flag2 : saisir, group, maxvar, ntest Flag3 : discrtype2 Flag4 : Model Input arguments ============== X: SAISIR matrix (n x p) group:SAISIR vector of group numbers (n1 x 1) maxvar:(integer) maximum number of variables introduced in the model ntest (integer): number of observations in each group in the validation set Output argument: =============== discrtype with fields: step with fields index: vector giving the rank of the variable introduced at each step (maxvar values) correct: vector giving the number of correct classifications in the calibration set (max var values) name: identifiers of the variables introduced int the models (matrix of char with maxvar rows) ntestcorrect: vector giving the number of correct classifications in the validation set (max var values) classed: SAISIR vector of the predicted group numbers of the calibration set (n1 x 1). Only the result of the final step is given testclassed:SAISIR vector of the predicted group numbers of the test set (n2 x 1) Only the result of the final step is given selected: vecor indicating the observations in the calibration (0) and in the validation (1) set confusion with fields cal: confusion matrix of the calibration set val: confusion latrix of the validation set Applies saisir_maha1 by dividing the sample in saisir into calibration and verification set ntest observations in each group are randomly (with no repeat) placed in test group. see also function "saisir_maha1"Return to thematic list · HOME
function[res]=saisir_crossplsda(x,group,dim,selected)Source: saisir_crossplsda.m
saisir_crossplsda - validation on PLS discriminant analysis function[res]=saisir_crossplsda(X,group,dim,selected) Flags pour la plateforme PULSAR --------------- Flag1 : crossplsda Flag2 : x, group, dim, selected Flag3 : res Flag4 : Model Input arguments: =============== X:SAISIR matrix of predictive data (n x p) group:SAISIR vector of group numbers (n x 1). A same number indicates that the observations belong to the sdame group dim: maximum number of PLS dimensions selected:matlab VECTOR with 0= calibration sample, 1= verification sample Output argument: =============== res with fields: confusion1: confusion matrix of the calibration set , method 1 ncorrect1: number of correctly classified obs. in calibration, method1 nscorrect1: number of correctly classified obs. in validation, method1 sconfusion1: confusion matrix of the validation set , method 1 confusion: confusion matrix of the calibration set , method 0 ncorrect: number of correctly classified obs. in calibration, method 0 nscorrect: number of correctly classified obs. in validation, method 0 sconfusion: number of correctly classified obs. in validation, method 0 info: ' no index: max of predicted Y; 1: mahalanobis distance on latent variables t' The function divides the data collection into a calibration set (selected=0) and a validation set (selected = 1) The function "saisir_plsda" is applied on the calibration set, and tested on the validation set. Two strategies for attributing a group to each observation are tested: Method 0 (no index): the observations are classified in the group for which the predicted indicator variable is the highest. Method 1: (preferable) linear discrimination on the PLS scores see also:"saisir_plsda", "saisir_applyplsda"Return to thematic list · HOME
function[res]=saisir_crossval_multiple_regression(x,y,selected)Source: saisir_crossval_multiple_regression.m
saisir_crossval_multiple_regression - validation of multiple regression.
function[res]=saisir_crossval_multiple_regression(X,y,selected)
Flags pour la plateforme PULSAR
---------------
Flag1 : crossval_multiple_regression
Flag2 : x, y, selected
Flag3 : res
Flag4 : Model
Input arguments:
================
X: SAISIR matrix of predictive data (n x p)
y: SAISIR vector of the variable to be predicted ( n x 1)
selected: MATLAB vector ( n x 1) giving the samples placed in the
verification set: 1= in verification; 0 = in calibration set
Output arguments:
================
res with fields:
calibration with fields
ypred: predicted y (n x1)
beta0: intercept of the regresssion
beta: regression coefficients (p x 1)
r2: r2 between observed and predicted values in calibration[1x1 struct]
RMSEC: Root mean square error of calibration
validation with fields
ypred predicted values in validation
r2: determination coefficient between obs and predicted values in
validation
RMSEV: Root mean square error of validation
Divides the data into a calibration and a validation set.
Multiple linear regression is established on the calibration set
and validated on the validation set.
The division calibration/validation is determined by the vector "selected"Return to thematic list · HOMEfunction res = saisir_crossval_quaddis(x, group, selected)Source: saisir_crossval_quaddis.m
SAISIR_CROSSVAL_QUADDIS - Test-set validation for Quadratic Discriminant Analysis (QDA)
Description:
============
Splits a dataset into a calibration (training) set and a validation (test) set
based on a selection vector. It trains a QDA model on the calibration data
and evaluates its classification performance on the independent validation data.
Flags pour la plateforme PULSAR
---------------
Flag1 : crossval_quaddis
Flag2 : x, group, selected
Flag3 : res
Flag4 : Model
Input arguments:
================
x : SAISIR structure of predictive variables (.d, .i, .v) of size (n x p).
group : SAISIR structure vector (.d, .i, .v) of known class labels (n x 1 integers).
selected : Numeric MATLAB vector (n x 1) defining the data split:
0 = Sample is assigned to the Calibration (training) set.
1 = Sample is assigned to the Validation (test) set.
Output argument:
================
res : A structure containing two sub-structures:
.calibration : The trained QDA model structure (as output by 'saisir_quaddis').
.validation : The classification results on the test set (as output by 'saisir_apply_quaddis').
See also:
=========
saisir_quaddis, saisir_apply_quaddis, saisir_splitrow
1. Split the predictive data matrix (x) based on the selection mask
saisir_splitrow returns the rows matching 'true' in the first output, and 'false' in the secondReturn to thematic list · HOMEfunction [res]=saisir_crossvalpls(X,y,ndim,selected)Source: saisir_crossvalpls.m
saisir_crossvalpls - validation of pls with up to ndim dimensions. function [res]=saisir_crossvalpls(X,y,ndim,selected) Flags pour la plateforme PULSAR --------------- Flag1 : crossvalpls Flag2 : x, y, ndim, selected Flag3 : res Flag4 : Model Input args: =========== X: predictive data n x p y: Variable to be predicted n x 1 ndim: maximal number of dimensions in the PLS model selected: Matlab vector n x 1 (0= obs in calibration; 1 in validation) Output args ============ res with fields ---calibration: calibration results with fields BETA: regression coefficients (p x ndim) BETA0: intercept (p x 1) PREDY: predicted y in calibration (n x ndim) T: scores PLS (n x ndim) RMSEC: Root mean square of calibration (1 x ndim) r2: determination coefficient (yobs/ypred) (1 x ndim) ---validation : validation results with fields PREDY: predicted y in validation (n x ndim) RMSEV: Root mean square error of validation (1 x ndim ) r2: determination coefficient (yobs/ypred) (1 x ndim) OBSY: observed y in validation (number of rows=number of obs in validation) See also: "saisir_crossvalpls1a" Note: "saisir_crossvalpls" is faster than "saisir_crossvalpls1a" but gives less information (for example the PLS scores in validation and the loadings in calibration are not given here))Return to thematic list · HOME
function [res] = saisir_crossvalpls1a(x, y, ndim, selected)Source: saisir_crossvalpls1a.m
SAISIR_CROSSVALPLS1A - Cross-validation for PLS regression (detailed outputs)
[res] = saisir_crossvalpls1a(x, y, ndim, selected)
Flags pour la plateforme PULSAR
---------------
Flag1 : crossvalpls1a
Flag2 : x, y, ndim, selected
Flag3 : res
Flag4 : Model
Input arguments:
================
x : Valid SAISIR structure for predictive data (n x p)
y : Valid SAISIR structure for the variable to predict (n x 1)
ndim : (Integer) Maximal number of dimensions/latent variables in the PLS model
selected : Numeric vector (n x 1) where:
0 = Sample used in Calibration
1 = Sample used in Validation
Output arguments:
=================
res : Custom structure containing detailed outputs:
.calibration : Structure from saisir_basic_pls (scores, loadings, coefficients...)
.validation : Structure from saisir_applypls (predicted values, metrics, validation scores...)
with an additional field .OBSY containing the true validation values.
See also: saisir_crossvalpls, saisir_pls, saisir_applypls
--- 1. Inputs Verification ---Return to thematic list · HOMEfunction [covariance_type]=saisir_cumulate_covariance((X),(covariance_type1));Source: saisir_cumulate_covariance.m
saisir_cumulate_covariance - Covariance on huge data set function [covariance_type]=saisir_cumulate_covariance((X),(covariance_type1)); This function is mainly useful for computing PCA on very large data sets Flags pour la plateforme PULSAR --------------- Flag1 : cumulate_covariance Flag2 : x, covariance_type1 Flag3 : covariance_type Flag4 : Tools Input arguments: --------------- X: SAISIR matrix X (n x p) or []; covariance_type: (optional): output argument of the function "saisir_cumulate_covariance" Output argument: ---------------- covariance_type: either intermediary results in cumulating covariance or a structure containing covariance matrix (at completion) At completion, "covariance_type" has fields: covariance: matrix p x p of covariances average: average value of all the observations (1 x p) n: total number of observations involved in computing the covariance matrix if the second argument (covariance_type1) undefined, initiate the calculation of covariance, If the two arguments are defined, cumulate the covariance if the first argument =[], finish the work A complete script must therefore be something like cov=saisir_cumulate_covariance(spectra_1);%% starting cov=saisir_cumulate_covariance(spectra_2,cov);%% cumulating values of matrix 1 cov=saisir_cumulate_covariance(spectra_3,cov);%% cumulating values of matrix 2 ... cov=saisir_cumulate_covariance(spectra_k,cov);%% cumulating values of matrix k covariance_type=saisir_cumulate_covariance([],cov);%% finishing [pcatype]=saisir_covariance_pca(covariance_type,(ncomponent)) score1=saisir_applypca(pcatype,spectra_1);%% projecting data from spectra_1 related function; "saisir_covariance_pca" (pca from covariance)Return to thematic list · HOME
function h=saisir_curve(s,nligne,xlab,ylab,titre)Source: saisir_curve.m
saisir_curve - represents a row of a matrix as a single curve handle=saisir_curve(X,(nrow), (xlabel),(ylabel),(title)) Flags pour la plateforme PULSAR --------------- Flag1 : curve Flag2 : s, nligne, xlab, ylab, titre Flag3 : h ( handle of the graph) Flag4 : Plot Input argument: -------------- X : SAISIR matrix nrow : indeix of the row to be shown xlabel, ylabel (optional) : label on X and Y title (optional) : title of the graph. This function draws the row (typically a spectrum) as a curve. If X.v can be interpreted as a vector of number (such as wavelengths), the X scale is given by this vector. Otherwise, the X-axis is simply given by the rank of the variables A function "courbe" is a synonym of this function.Return to thematic list · HOME
function h=saisir_curves(s,range,xlab,ylab,titre)Source: saisir_curves.m
curves - represents several rows of a matrix as curves usage handle=saisir_curves(X,range,(xlabel),(ylabel),(title)) Flags pour la plateforme PULSAR --------------- Flag1 : curves Flag2 : s, range, xlab, ylab, titre Flag3 : h ( handle of the graph) Flag4 : Plot Input arguments: --------------- X : SAISIR matrix range (optional): vector of integer values giving the indices of the rows to be displayed (default : all rows displayed) xlabel, ylabel (optional): labels in X and Y title (optional): title of the graph. If X.v can be interpreted as a vector of number (such as wavelengths), the X scale is given by this vector. Otherwise, the X-axis is simply given by the rank of the variables example: saisir_curves(spectra,1:2:100,'wavenumber','log 1/R','Raman spectra'); plot the rows 1, 3, 5, ... 99 as curves. A function "courbes" is a synonym of this function.Return to thematic list · HOME
function [ftype] = saisir_d2_factorial_map(X)Source: saisir_d2_factorial_map.m
saisir_d2_factorial_map - assesses a factorial map from a table of squared distance function [ftype] = saisir_d2_factorial_map(X) Flags pour la plateforme PULSAR --------------- Flag1 : d2_factorial_map Flag2 : saisir Flag3 : ftype Flag4 : Model Input argument: ============== X : Saisir matrix n x n of squared distances Output argument: =============== ftype with fields: eigenval: eigenvalues score: scores typical (demonstrative) example =============== xdist=saisir_distance(data,data); xdist.d=xdist.d.*xdist.d ;%% warning !! squared distance needed ftype=saisir_d2_factorial_map(xdist); saisir_map(ftype.score,1,2); p=saisir_pca(data); figure; saisir_map(p.score,1,2);%% identical to previous figure Useful when only the distance matrix is available Uses the Torgerson approach to transform squared distance into pseudo scalar products.Gives the factorial scores of the distanceReturn to thematic list · HOME
function [X1] = saisir_deletecol(X,index)Source: saisir_deletecol.m
saisir_deletecol - deletes columns of saisir files function [X1] = saisir_deletecol(X,index) Flags pour la plateforme PULSAR --------------- Flag1 : deletecol Flag2 : saisir1, index Flag3 : saisir Flag4 : Tools input arguments =============== X:Saisir matrix (n x p) index:vector indicating the columns to be deleted Output argument ============== X1:saisir matrix (n x q) with q <=p The deleted columns are indicated by the vector index (numbers of booleans) Typical Examples reduced=saisir_deletecol(data,[1 3 5]);%% deletes 3 columns reduced1=saisir_deletecol(data,sum(data.d)==0); % deletes all the columns with the sum equal to 0 see also: saisir_deleterow, saisir_selectrow, saisir_selectcolReturn to thematic list · HOME
function [saisir] = saisir_deleterow(saisir1,index)Source: saisir_deleterow.m
saisir_deleterow - delete rows saisir_deleterow(X,index) Flags pour la plateforme PULSAR --------------- Flag1 : deleterow Flag2 : saisir1, index Flag3 : saisir Flag4 : Tools input arguments =============== X:Saisir matrix (n x p) index:vector indicating the rows�to be deleted Output argument ============== X1:saisir matrix (n1 x p) with n1 <=n The deleted rows are indicated by the vector index (numbers of booleans) Typical Examples reduced=saisir_deleterow(data,[1 3 5]);%% deletes 3 rows reduced1=saisir_deletecol(data,sum(data.d,2)==0); % deletes all the rows with the sum equal to 0 see also: saisir_selectrow, saisir_selectcol, saisir_deletecol on commence par recopier tous les champs dans la nouvelle structureReturn to thematic list · HOME
function group=saisir_dendro(X,(topnodes))Source: saisir_dendro.m
saisir_dendro - dendrogram using euclidian metric and Ward linkage function group=saisir_dendro(X,(topnodes)) Flags pour la plateforme PULSAR --------------- Flag1 : dendrogram Flag2 : saisir, topnodes Flag3 : group Flag4 : Model Input arguments: ================ X : Saisir data matrix topnodes (optional): level of cutting the dendrogram Output argument =============== group: groups number at the level of cutting defined by topnodes. typical use =========== g=saisir_dendro(data,30); g will contain numbers ranginf from 1 to 30 indicating the group number Attempts to display the identifiers on the dendrogram. Works only with a few number of identifiersReturn to thematic list · HOME
function [saisir]=saisir_derivative(saisir1,K,F,Dn)Source: saisir_derivative.m
saisir_derivative - n-th order derivative using the Savitzky-Golay coefficients [X]=saisir_derivative(X1,polynom_order,window_size,derivative_order) Flags pour la plateforme PULSAR --------------- Flag1 : Derivative Savitzky-Golay coefficients Flag2 : saisir1, K, F, Dn Flag3 : saisir Flag4 : Correction Input arguments: =============== X1:SAISIR matrix (n x p) polynom_order:(integer) order of the fitting polynom window_size:(integer) number of data points involved in the calculation derivative_order: (integer, normally 1 or 2) order of the derivative Output argument: ================ X : transformed data matrix (n rows) The function assumes that X is a matrix of digitized signals (such as spectra) with constant intervals of digitization. Example: ======= res=saisir_derivative(DATA,3,21,2); Compute the second derivative using a polynom of power 3 as model and a window size of 21 AUTHOR: ALAIN COLLET, 2005Return to thematic list · HOME
function saisir_detectOutliers_robustcow(mydata, PCx, PCy, startLabel, endLabel, options)Source: saisir_detectOutliers_robustcow.m
saisir_detectOutliers_robustcow - statistical outliers detection function saisir_detectOutliers_robustcow(mydata, PCx, PCy, startLabel, endLabel, options) Fonction de detection d'outliers statistiques basee sur la fonction robustcov de Matlab saisir_detectOutliers_robustcow se place dans l'espace des composantes principales du jeu fourni en entree mydata. Puis utilise 2 ou plus de 2 composantes principales pour calculer la distance entre les coordonnees des echantillons et le vecteur moyen des composantes avec une metrique au choix. Puis détermine des limites statistiques sur le plan Robust Distance = f(distance calculée) en calculant le 95th percentile de la distribution chi-square avec p degres de liberte 'distance calculée' pouvant être choisie par l'utilisateur Date : 2023 INPUTS mydata : structure SAISIR PCx, PCy : numero des composantes principales à prendre en compte startLabel, endLabel : position des caractères relatifs aux groupes d'échantillons dans le jeu de données options : contient les champs .datatype, .method, .distance, .inclusionPCs si options.datatype = 'numbers' alors names = numerical vector corresponding to the samples position in the data matrix si options.datatype = '' alors names = mydata.i(:,startLabel:endLabel) si options.method : 'olivehawkins' or 'fmcd' or 'ogk' si options.method = '' alors valeur par defaut options.method = 'olivehawkins' si options.distance : mahalanobis, cityblock, chebychev, euclidean, cosine, correlation, minkowski, hamming si options.distance = '' alors valeur par defaut options.distance = 'mahalanobis' si options.inclusionPCs : 'x2y' or 'x&y' on se place dans l'espace des composantes principalesReturn to thematic list · HOME
function out = detect_patterns_from_options(names, OptionRegEx, varargin)Source: Saisir_detectPatternsFromStringArray.m
(c) LARTIC_2025 - detect_patterns_from_options(names, OptionRegEx, varargin)
function out = detect_patterns_from_options(names, OptionRegEx, varargin)
DETECT_PATTERNS_FROM_OPTIONS
Construit des regex à partir de motifs en 1re colonne d'un cell array,
puis repère ces motifs dans 'names'.
out = detect_patterns_from_options(names, OptionRegEx)
out = detect_patterns_from_options(..., 'IgnoreCase', true)
ENTRÉES
names : cellstr ou string array de noms d'échantillons.
OptionRegEx : cell Mx1. Chaque ligne (i,1) contient soit une char/string,
soit un 1x1 cell {'motif'} (ex.: {'VRxxxxxxxx'}, {'Ax_xxx'}).
PLACEHOLDERS
x : alphanumérique [A-Za-z0-9]
9,d : chiffre \d
a : minuscule [a-z]
A : majuscule [A-Z]
_ : underscore littéral
autres caractères : pris littéralement (échappés).
SORTIES (structure 'out')
out.tokens : motifs d'entrée (texte brut avec jokers)
out.patterns : regex compilées correspondantes (char)
out.matches{i} : matches pour le motif i (cell, taille = numel(names))
out.starts{i} : indices de début pour le motif i
out.ends{i} : indices de fin pour le motif i
out.has(:,i) : masque logique (true si au moins un match pour names{k})
out.first(:,i) : première occurrence trouvée (string, "" si rien)
EXEMPLE
names = {'2025-06-25_Cordella_VR123456', 'UNKWNA0_ABC', ...
'fooVRAB12CDbar', 'ZZ_A7_q1w'};
OptionRegEx = cell(2,1);
OptionRegEx{1,1} = {'VRxxxxxxxx'}; % 'VR' + 8 alphanum.
OptionRegEx{2,1} = {'Ax_xxx'}; % 'A' + 1 alphanum + '_' + 3 alphanum
out = detect_patterns_from_options(names, OptionRegEx);
% Accès rapide :
% out.first(:,1) -> premières correspondances du motif 'VRxxxxxxxx'
% out.first(:,2) -> premières correspondances du motif 'Ax_xxx'
Pour exiger des chiffres (et non des alphanumériques) après VR, mettre le motif : {'VR999999'} (ou {'VRdddddd'}), qui sera traduit en VR\d{6}.
Le paramètre optionnel 'IgnoreCase', true active une recherche insensible à la casse.
Le champ out.first(:, i) est souvent le plus pratique pour récupérer directement « la première occurrence par nom » pour le motif i.
---- Options ---------------------------------------------------------Return to thematic list · HOMEfunction[res]=saisir_dimcross_stepwise_regression(x,y,selected,Pthres,confidence)Source: saisir_dimcross_stepwise_regression.m
saisir_dimcross_stepwise_regression - Tests models obtained from stepwise regression
function[res]=saisir_dimcross_stepwise_regression(X,y,selected,Pthres,(confidence))
Flags pour la plateforme PULSAR
---------------
Flag1 : dimcross_stepwise_regression
Flag2 : x, y, selected, Pthres, confidence
Flag3 : res
Flag4 : Model
Input arguments:
X : SAISIR matrix of predictive variables (n x p)
y : SAISIR vector of variable to be predicted (n x 1)
selected: MATLAB vector (p elements). 0 = in the calibration set;
1 = validation set
Pthres: probability threshold of entering or discarding variable
confidence: (optional): confidence interval for the correlation coefficient
ouput argument:
res with fields
calibration (see "saisir_stepwise_regression")
validation (see "saisir_apply_stepwise_regression")
validation has fields
predy: predicted y in validation for all the regression models
rmsev: root mean square error of validation (idem)
r2: determination coefficient between observed and predicted y
observed_y: vector of observed y values in the validation set.
The function divides the data set X and y in a calibration set and a
validation set. The vector "selected" defines the division.
The stepwise regression models are established on the calibration set
and tested on the validation set. All the calculated models are tested,
which gives as many columns of predicted y as the number models computed
by stepwise_regression.Return to thematic list · HOMEfunction [pcrres]=saisir_dimcrosspcr1(X,y,ndim,selected)Source: saisir_dimcrosspcr1.m
saisir_dimcrosspcr1 - validation of PCR (samples in validation are selected) function [pcrres]=saisir_dimcrosspcr1(X,y,ndim,selected) Flags pour la plateforme PULSAR --------------- Flag1 : dimcrosspcr1 Flag2 : x, y, dimmax, selected Flag3 : pcrres Flag4 : Model Input arguments: ================= X : SAISIR matrix of predictive variables (n x p) y : SAISIR vector of variable to be predicted (n x 1) ndim: max number of PCR dimensions tested selected: MATLAB vector of samples selected as calibration set (==0) and verification set (==1) Output arguments: ================ pcrres with fields r2: determination coefficient between observed and predicted y (1 x ndim) predy: predicted y for all the dimensions tested ( n x ndim) rmsev: root mean square error of validation for all the dimensions tested (1 x ndim) obsy: observed y in the validation set Components introduced in the order of the eigenvalues Remarks; 1) The vector "selected" can be build randomly using the function "random_select" 2)The biplot observed/predicted values can be displayed by the command "saisir_xy_plot" (for example "saisir_xy_plot(pcrres.obsy,1,pcrres.predy,3)" will show the PCR model with 3 dimensions.Return to thematic list · HOME
function saisir_displayStatsTable(stats)Source: saisir_displayStatsTable.m
DISPLAYSTATSTABLE - Displays a descriptive statistics table in a MATLAB figure
Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval
Modernized & Vectorized Version
Description:
============
Automatically extracts descriptive statistics (Mean, Min, Max, Std, Variance)
from a SAISIR stats structure and builds a clean, dynamically sized graphical
user interface table (uitable).
Flags pour la plateforme PULSAR
---------------
Flag1 : displayStatsTable
Flag2 : stats
Flag3 : None ( display function )
Flag4 : Tools
Input argument:
================
stats : Structure containing fields: .grpMean, .grpMin, .grpMax, .grpStd, .grpVar
and group metadata labels.
1. Validation of required statistical fieldsReturn to thematic list · HOMEfunction [d_saisir] = saisir_distance(X1,X2)Source: saisir_distance.m
distance - Usual Euclidian distances function [d_saisir] = saisir_distance(X1,X2) Flags pour la plateforme PULSAR --------------- Flag1 : distance Flag2 : saisir1, saisir2 Flag3 : d_saisir Flag4 : Model Input arguments =============== X1, X2: SAISIR matrices dimensioned n1 x p and n2 x p respectively Output argument ============== d_saisir: matrix n1 x n2 of Euclidian distances between the observations the tables must have the same number of columnsReturn to thematic list · HOME
function [X1] = saisir_eliminate_nan(X,(row_or_col))Source: saisir_eliminate_nan.m
saisir_eliminate_nan - suppresses "not a number" data in a saisir structure function [X1] = saisir_eliminate_nan(X,(row_or_col)) Flags pour la plateforme PULSAR --------------- Flag1 : eliminate_nan Flag2 : saisir, row_or_col Flag3 : saisir1 Flag4 : Tools Input argument: ============== X:Saisir data matrix row_or_col: if row_or_col==0 tries to have the maximum number of rows if row_or_col==1 tries to have the maximum number of columns Output argument: =============== X1:Saisir data matrix with no NaN values From a given saisir file possibly containing NaN values (not determined values) create a file of known values Only useful when a very few numbers of rows or columns contain NaN valuesReturn to thematic list · HOME
function saisir_ellipse_map(X,col1,col2,gr,centroid_variability,(confidence),(point_plot))Source: saisir_ellipse_map.m
saisir_ellipse_map - plots the ellipse confidence interval of groups function saisir_ellipse_map(X,col1,col2,gr,centroid_variability,(confidence),(point_plot)) Flags pour la plateforme PULSAR --------------- Flag1 : ellipse_map Flag2 : D, i, j, gr, centroid_variability, confidence, point_plot Flag3 : None ( plotting function ) Flag4 : Plot Input arguments: ================ - X: data matrix - col1, col2: represented columns - gr: qualitative groups (referred as integer number) - centroid_variability : either 0 (variability of individual data points), or 1 : variability of the centroid itself (default: 0) confidence: P value of the confidence interval to be out of the ellipse (default: 0.05) point_plot: if point_plot ~=0 , plots also the individual points as symbols (inactivated if centroid_variability set to 1) useful in discriminant analysis and related methods.Return to thematic list · HOME
function [x1,emsc_model1,coefficients1]=saisir_emsc(x,good_spectra,bad_spectra,reference);Source: saisir_emsc.m
saisir_emsc - Correction of spectra by EMSC [X1, emsc_model, coefficients]=saisir_emsc(X,good_spectra,bad_spectra,ref); Flags pour la plateforme PULSAR --------------- Flag1 : EMSC Flag2 : x Flag3 : x1, emsc_model1, coefficients1 Flag4 : Correction Input arguments: =============== X - Saisir matrix to be corrected good_spectra - Spectra wich participate to the spectral reconstruction , bad_spectra - spectra not participating to the reconstruction ref - reference spectrum to also assess the scattering effect (defaut : average); This argument can be replaced by [],if not present,but are not optional ! Output arguments: =============== X1 - Corrected spectra emsc_model - Pure signals involved in the EMSC model coefficients - Regression coefficients associated to the pure signals Extended Multiplicative Signal Correction Building the EMSC modelReturn to thematic list · HOME
function [X,bag] = saisir_excel2bag(filename,ref_text_col,(nchar),(deb),(xend))Source: saisir_excel2bag.m
saisir_excel2bag - reads an excel file and creates the corresponding text bag
(array of caracter)
function [X,bag] = saisir_excel2bag(filename,ref_text_col,(nchar),(deb),(xend))
reads an excel file which has been saved under the format .csv (the delimiters are ';')
the excel file includes the identifers of rows and columns
Flags pour la plateforme PULSAR
---------------
Flag1 : excel2bag
Flag2 : filename , ref_text_col, nchar, deb, xend
Flag3 : saisir, bag
Flag4 : Tools
Input arguments
===============
filename :excelfile in the '.csv' format
nchar :number of characters read in each cell of the excel files
(the other are ignored)
ref_text_col :an array of string giving the reference of columns designed as forming the columns of bag.d.
THESE COLUMNS ARE DESIGNATED USING THE EXCEL STYLE ('AA','AB' ....)
deb : number of the first row decoded
xend : final row decoded
output argument:
===============
X: matrix of numerical values
bag: a structure (bag.d,bag.i,bag.v), with bag.d being here a matrix of char
saisir contains the numerical values from the excel file, with the exception of the columns referenced by ref_text_col
bag contains the charactes values from the excel file, referenced by ref_text_col
Example:
[value,bag]=saisir_excel2bag('olive',['A'; 'B'],20)
the columns 'A' and 'B' from excel are read as text (in output bag)
the other columns are read as number (in value) respecting the saisir
structure.
This function is normally used in relation
with "saisir_bag2group".Return to thematic list · HOMEfunction [saisir] = saisir_excel2saisir(filename)Source: saisir_excel2saisir.m
saisir_excel2saisir - reads an excel file
function [saisir] = saisir_excel2saisir(filename)
Flags pour la plateforme PULSAR
---------------
Flag1 : excel2saisir
Flag2 : filename
Flag3 : myRawData, mydata
Flag4 : Tools
Input arguments
==============
filename: (string) name of the text Excel file in .xls format
Reads an Excel file which has been saved under the format .xls (97-2004)
the excel file includes the identifers of rows and columns
The Excel format is compulsorily the following (example):
varname1 varname2 varname3
obsname1 number11 number12 number13
obsname2 number21 number22 number23
obsname3 number31 number32 number33
The decimal separator is the point (".") NOT THE COMMA (",")Return to thematic list · HOMEfunction[fdatype]=saisir_fda1(pcatype, group, among, maxvar)Source: saisir_fda1.m
saisir_fda1 - stepwise factorial discriminant analysis on PCA scores function[fdatype]=saisir_fda1(pcatype, group, among, maxscore) Flags pour la plateforme PULSAR --------------- Flag1 : fda1 Flag2 : pcatype, group, among, maxvar Flag3 : fdatype Flag4 : Model Input arguments: --------------- pcatype: (structure) output argument of function "saisir_pca" applied on the predictive data set group : SAISIR vector of group (integer values). Identical numbers mean that the observations belong to the same group. among : (integer) Maximal rank (dimension) of PC-score allowed to enter in the model maxscore: (integer) Maximum number of scores allowed to enter in the model. Output arguments: ---------------- fdatype with fields: introduced: rank of the PC scores introduced in the model ncorrect: number of correct classifications (no validation) at each step beta: projection coefficients such as datafactor=X*beta datafactor: discriminant scores centroidfactor: scores of the barycenters (centroids) eigenval: eigenvalues of the discriminant analysis confusion: confusion matrix (row actual; column predicted) average: average of the predicitive data set. Assesses a stepwise factorial discriminant analysis according to Bertrand et al., J of Chemometrics, Vol . 4, 413-427 (1990). the basic idea is to assess a factorial discriminant analysis on the scores of a previous pca. The criterion of score selection is the maximisation of the trace of T-1B. In order to avoid using PC-scores with very small eigenvalues, the input argument "among" gives the maximal dimension to be allowed. "maxscore" indicates the maximal number of scores. "datafactor" corresponds to the final model (with maxscore scores introduced). If one is interested in a more economical model, it is easy, looking at the classification, to reduce the value in "maxscore" and re-run "saisir_fda1". Typical example: g=saisir_create_group1(wheat,1,3);%% creation of a grouping from the identifiers names, using characters in position 1 p=saisir_pca(wheat); %% first PCA res=saisir_fda1(p,g,20,5);%% model with 5 scores introduced among the 20 first ones res.ncorrect.d % ans = % 13.00 1 PC score introduced % 31.00 % 69.00 % 77.00 % 93.00 5 PC scores introduced saisir_colored_map1(res.datafactor,1,2,1,3)% map of the discrimination figure; saisir_ellipse_map(res.datafactor,1,2,g,1,0.05) % shown as confidence ellipses Note : the number of dimensions in datafactor is less than the number of qualitative groups minus 1 (with 2 groups, only 1 discriminant dimension!). SEE ALSO saisir_maha3, saisir_maha6, saisir_plsda, saisir_quaddis, saisir_applyfda1.Return to thematic list · HOME
function[fdatype]=saisir_fda2(x,g,among, maxvar,selected)Source: saisir_fda2.m
saisir_fda2 - stepwise factorial discriminant analysis on PCA scores with verification function[res]=saisir_fda2(X, group, among, maxscore, selected) Flags pour la plateforme PULSAR --------------- Flag1 : fda2 Flag2 : x, g, among, maxvar, selected Flag3 : fdatype Flag4 : Model Input arguments: --------------- X: SAISIR matrix of the predictive data set (n x p) group : SAISIR vector of group (integer values). Identical numbers mean that the observations belong to the same group. among : (integer) Maximal rank (dimension) of PC-score allowed to enter in the model maxscore: (integer) Maximum number of scores allowed to enter in the model. selected: matlab vector (n x 1) with elements =0 (calibration set), or 1 (validation set) Output arguments: ---------------- res with fields: introduced: rank of the PC scores introduced in the model ncorrect: number of correct classifications in the calibration set at each step nscorrect: number of correct classifications in the validation (supplementary) set at each step beta: projection coefficients such as datafactor=X*beta datafactor: discriminant scores if the calibration set centroidfactor: scores of the barycenters (centroids) computed from the calibration set supscore: discriminant scores if the validation set eigenval: eigenvalues of the discriminant analysis confusion: confusion matrix (row actual; column predicted) in the calibration set average: average of the calibration set. sconfusion: confusion matrix (row actual; column predicted) in the validation (or "supplementary" set) Assesses a stepwise factorial discriminant analysis according to Bertrand et al., J of Chemometrics, Vol . 4, 413-427 (1990). the basic idea is to assess a factorial discriminant analysis on the scores of a previous pca. The criterion of score selection is the maximisation of the trace of T-1B. In order to avoid using PC-scores with very small eigenvalues, the input argument "among" gives the maximal dimension to be allowed. "maxscore" indicates the maximal number of scores. "datafactor" corresponds to the final model (with maxscore scores introduced). If one is interested in a more economical model, it is easy, looking at the classification, to reduce the value in "maxscore" and re-run "saisir_fda1". The collection is divided in a calibration and a validation set from the elements of the input argument "selected" Typical example: g=saisir_create_group1(data,1,3);%% creation of a grouping from the identifiers names, using characters in position 1 to 3 random selection of 1/3 in the validation set res=saisir_fda2(data,g,10,5,saisir_random_select(size(data.d,1),round(size(data.d,1)/3))); SEE ALSO saisir_smaha3, saisir_maha6, saisir_plsda, saisir_quaddis, saisir_applyfda1, saisir_fda1.Return to thematic list · HOME
function index=saisir_find_index(str,value);Source: saisir_find_index.m
saisir_find_index - find the index corresponding to the closest "value" function index=saisir_find_index(str,value); useful for finding the wavelength index in strings Flags pour la plateforme PULSAR --------------- Flag1 : find_index Flag2 : str, value Flag3 : index Flag4 : Tools Input argument: ============== str: an array of characters which can be interpreted as a vector of numbers when using a command such as vector=str2num(str); value: a numerical value normally in the range given by vector. Output argument: =============== Index (rank) of the variable Exemple of use : index=saisir_find_index(spectra.v,1104); Find the index of the variable in "spectra" closest to the value 1104. Important note: the number associated with num2str(str) are supposed to be sorted (It is the normal case with spectral data)Return to thematic list · HOME
function [row,col,value]=saisir_find_max(matrix)Source: saisir_find_max.m
saisir_find_max - gives the indices of the max value of a MATLAB Matrix saisir_find_max(matrix) Flags pour la plateforme PULSAR --------------- Flag1 : find_max Flag2 : matrix Flag3 : row, col, value Flag4 : Tools Input argument ============== matrix: MATLAB matrix Output arguments =============== row, col: indexes of the row and column of the maximum, respectively value: value of the maximum see also saisir_find_minReturn to thematic list · HOME
function [row,col,value]=saisir_find_min(matrix)Source: saisir_find_min.m
saisir_find_min - gives the indices of the min value of a MATLAB Matrix saisir_find_min(matrix) Flags pour la plateforme PULSAR --------------- Flag1 : find_min Flag2 : matrix Flag3 : row, col, value Flag4 : Tools Input argument ============== matrix: MATLAB matrix Output arguments =============== row, col: indexes of the row and column of the minimun, respectively value: value of the minimun see also saisir_find_maxReturn to thematic list · HOME
function [res_saisir, index]=saisir_find_peaks(saisir,row,threshold,gap,min_max,show_plot)Source: saisir_find_peaks.m
saisir_find_peaks - finds and displays peaks greater than a threshold value Flags pour la plateforme PULSAR --------------- Flag1 : Find Peaks Flag2 : saisir, row, threshold, gap, min_max, show_plot Flag3 : res_saisir, index Flag4 : Tools Input arguments ============== X:SAISIR data matrix of "spectra-like" data nrow:(integer): index of the row to be studied threshold: peaks of absolute value lower than the threshold are not detected windowsize (integer, preferably odd number): size of the moving window in which the peaks are to be found min_max: either 0 : only maximum detected, or 1: maximum and minimum detected Output argument ============== vect: matlab vector of the positions (name of variable converted into numbers) index: matlab vector of the index of the variables corresponding to peaks Inside a moving window of size "windowsize" (data points) detects the maximum (or maximum and minimum values). The identified positions are considered as "peaks" and shown on the display. The corresponding variables identifiers (normally wavelengths, or retention time values) are converted into numbers and given in the output argument "vect". The system of threshold and moving window avoid that a large series of peaks will be identified if the studied curve is not perfectly smooth. The "windowsize" indicates the minimum gap (in data points) between two consecutive peaks. The threshold makes it possible to detect peaks greater than a certain value.Return to thematic list · HOME
function [mask, idx, labels] = saisir_find_zero_nan(saisir, varargin)Source: saisir_find_zero_nan.m
SAISIR(c) function_LARTIC 2025 - saisir_find_zero_nan - Détecte lignes/colonnes contenant 0, NaN, ou 0|NaN (SAISIR)
[mask, idx, labels] = saisir_find_zero_nan(saisir, 'dim', 1|2, ...
'type', 'zero'|'nan'|'zero_or_nan', ...
'tol', tol, ...
'criterion', 'all'|'any')
Entrées (Name-Value):
'dim' : 1 = détecter des LIGNES (défaut), 2 = détecter des COLONNES
'type' : 'zero' (défaut) | 'nan' | 'zero_or_nan'
'tol' : tolérance pour le test "zéro" (défaut 0 -> zéro strict)
'criterion' : 'all' (défaut) = tous les éléments satisfont le test
'any' = au moins un élément satisfait le test
Sorties:
mask : vecteur logique (n x 1 si dim=1, p x 1 si dim=2)
idx : indices où mask == true
labels : étiquettes correspondantes (saisir.i pour les lignes, saisir.v pour les colonnes, si dispo)
Notes:
- Pour 'type'='zero', seuls les |x|<=tol sont considérés "zéro".
- Pour 'type'='nan', la tolérance est ignorée.
- Pour 'type'='zero_or_nan', la condition est (|x|<=tol) OR isnan(x).
Exemple d’utilisation:
% Lignes entièrement nulles (zéro exact) :
[m1, id1, labs1] = saisir_find_zero_nan(X, 'dim', 1, 'type', 'zero', 'tol', 0, 'criterion', 'all');
% Colonnes contenant au moins UN NaN :
[m2, id2, labs2] = saisir_find_zero_nan(X, 'dim', 2, 'type', 'nan', 'criterion', 'any');
% Lignes entièrement 0 ou NaN avec tolérance:
[m3, id3] = saisir_find_zero_nan(X, 'dim', 1, 'type', 'zero_or_nan', 'tol', 1e-12, 'criterion', 'all');
--- Vérifications de baseReturn to thematic list · HOMEfunction indices = saisir_findStringInCellArray(cellArray, targetString)Source: saisir_findStringInCellArray.m
SAISIR(c) function_LARTIC 2024 Flags pour la plateforme PULSAR --------------- Flag1 : findStringInCellArray Flag2 : cellArray, targetString Flag3 : indices Flag4 : Tools Input arguments: ============== cellArray: a cell array of strings to search through targetString: the string to find in the cell array Output argument: =============== indices: a vector of indices where the target string is found in the cell array insensible à la casse :Return to thematic list · HOME
function X1=saisir_group_centering(X,group);Source: saisir_group_centering.m
saisir_group_centering - Centers data according to groups function X1=saisir_group_centering(X,group); Flags pour la plateforme PULSAR --------------- Flag1 : group_centering Flag2 : X, group Flag3 : res Flag4 : Correction Input arguments ============== X: SAISIR matrix (n x p) group: SAISIR vector of group (integer, n x 1). Identical values in "group" indicates that the corresponding observations belong to the same group. Output argument =============== X1:SAISIR matrix (n x p) group-centered. For each group, as defined by the input argument "group", the function computes the average observation (1 x p). This average is subtracted to all observation belonging to this group. An usage of this function is the centering of sensory data according to each panellist.Return to thematic list · HOME
function X1=saisir_group_mean(X,startpos,endpos)Source: saisir_group_mean.m
saisir_group_mean - gives the means of group of rows function X1=saisir_group_mean(X,startpos,endpos) Flags pour la plateforme PULSAR --------------- Flag1 : group_mean Flag2 : s, startpos, endpos Flag3 : saisir1 Flag4 : Model Input arguments =============== X: SAISIR data matrix ( n x p) startpos, endpos : (integers) character positions in the identifiers giving the key for building the qualitative groups. Output argument =============== X1: matrix of averages of groups (k x p) with k the number of found groups. This function uses the identifier for creating groups. creates as many groups as different strings from startpos to endpos The function gives the matrix of averages according to groups (barycenters).Return to thematic list · HOME
function saisir_gscatter3(x,y,z,group,clr,sym,siz,doleg,xnam,ynam,znam)Source: saisir_gscatter3.m
GSCATTER3 3D Scatter plot with grouping variable saisir_gscatter3(x,y,z,group,clr,sym,siz,doleg,xnam,ynam,znam) Designed to work in the exactly same fashion as statistics toolbox's gscatter This function does not require the statistics toolbox installed. Flags pour la plateforme PULSAR --------------- Flag1 : gscatter3 Flag2 : x, y, z, group, clr, sym, siz, doleg, xnam, ynam, znam Flag3 : none (plotting function) Flag4 : Plot See also GSCATTER, GSCATTER3B Copyright 2017 Gustavo Ferraz Trinade. Set number of groupsReturn to thematic list · HOME
function saisir_gscatter3b(X,Y,group,clr,sym,siz,doleg,xnam,ynam,znam)Source: saisir_gscatter3b.m
saisir gscatter3b wrapper for gscatter3 with default options Flags pour la plateforme PULSAR --------------- Flag1 : gscatter3b Flag2 : x, y, z, group, clr, sym, siz, doleg, xnam, ynam, znam Flag3 : none (plotting function) Flag4 : Plot Input arguments ================ X: SAISIR matrix of predictive variables (n x p) Y: SAISIR vector of variable to be predicted (n x 1) group: SAISIR vector of group numbers (n x 1) clr: jsp sym: string marker symbol (default '.') siz: integer doleg:string for legend (default 'on') xnam: string for x-axis label (default inputname(1)) ynam: string for y-axis label (default inputname(2)) znam: string for z-axis label (default inputname(3)) 1. Gestion des valeurs par défaut si les arguments sont absentsReturn to thematic list · HOME
function [icatype] = saisir_ica(mydata, NBIc, Options)Source: ICA/saisir_ica.m
SAISIR(c) function_LARTIC 2022 - saisir_ica(mydata, NBIc, Options) Perfom ICA on SAISIR matrix [icaRes] = saisir_ica(mydata, NBIc, Options) Flags pour la plateforme PULSAR --------------- Flag1 : ICA Flag2 : mydata Flag3 : icatype Flag4 : Model Inputs : mydata: SAISIR Matrix NBIc: number of ICs to be used in the model Options: model calculation options: "Wide", "Tall", "Normal" Options.Method = 'Tall', 'Wide', 'Kernel', 'ComDim', 'Normal' Options.Partitions = number of partition if X is tall or wide Options.Centred = Matrix centred by column Output : icaRes: SAISIR structure specific to ICA Author : C.B.Y. Cordella, UMR914 Inra PNCA, Laboratoire de Chimie Analytique 2017 Use : jade_DNR, IC_signs from D. N Rutledge & D. Jouan-Rimbaud BouveresseReturn to thematic list · HOME
function ica_inertia_res = saisir_ica_inertia(mydata, icatype)Source: ICA/saisir_ica_inertia.m
SAISIR(c) function_LARTIC 2026 - saisir_ica_inertia(mydata, icatype)
Perfom ICA on SAISIR matrix
[ica_inertia_res] = saisir_ica_inertia(mydata, icatype)
Flags pour la plateforme PULSAR
---------------
Flag1 : ICA_Eigenval
Flag2 : mydata, icatype
Flag3 : ica_inertia_res
Flag4 : Tools
Calcul des pseudo-valeurs propres d'un modèle ICA,
des écarts entre pseudo-valeurs propres,
et d'un critère de non-gaussianité pour chaque IC
Entrées
mydata.d : matrice initiale X, n x p
icatype : sortie de saisir_ica
Champs utilisés dans icatype
icatype.scores.d : scores ICA, n x k
icatype.signals.d : signaux/loadings ICA, p x k ou k x p
Sortie
ica_inertia_res : structure contenant les scores triés,
les pseudo-valeurs propres,
les critères d'écart,
et les critères de non-gaussianité
============================================================Return to thematic list · HOMEfunction saisir_ica_inertia_display(ica_inertia_res)Source: ICA/saisir_ica_inertia_display.m
SAISIR(c) function_LARTIC 2026 - saisir_ica_inertia_display(ica_inertia_res) Perfom ICA on SAISIR matrix saisir_ica_inertia_display(ica_inertia_res) Flags pour la plateforme PULSAR --------------- Flag1 : ICA_inertia_display Flag2 : ica_inertia_res Flag3 : [] Flag4 : Plot Représentation graphique des pseudo-valeurs propres ICA, des écarts entre pseudo-valeurs propres et des critères de non-gaussianité Entrée ica_inertia_res : sortie de saisir_ica_inertia ============================================================Return to thematic list · HOME
function [res, matriceConfusion, performances] = saisir_ICADA(mydata, varargin)Source: ICA-DA/saisir_ICADA.m
SAISIR_ICADA Analyse en composantes independantes discriminante (ICA-DA).
RES = SAISIR_ICADA(mydata) ajuste une ICA sur mydata.d, puis une LDA
sur les scores ICA. Les groupes sont recherches, dans cet ordre, dans
mydata.group, .groups, .groupe, .groupes, .class, .classes, .y ou .g.
[RES, C, PERF] = SAISIR_ICADA(...) renvoie aussi la matrice de
confusion de validation croisee et les performances correspondantes.
Parametres nom-valeur :
'Group' : groupes (n x 1), si absents de mydata
'NumComponents' : nombre de composantes ICA (defaut : min(10,n-1,p))
'KFolds' : nombre de plis stratifies (defaut : 5)
'Center' : centrer les variables (defaut : true)
'Scale' : reduire les variables (defaut : false)
'Prior' : 'equal' ou 'empirical' (defaut : 'equal')
'Regularization' : regularisation relative de la covariance LDA
(defaut : 1e-6)
'MaxIter' : iterations maximales FastICA (defaut : 1000)
'Tolerance' : tolerance FastICA (defaut : 1e-7)
'Nonlinearity' : parametre alpha de tanh(alpha*u) (defaut : 1)
'RandomSeed' : graine aleatoire (defaut : 1)
'Verbose' : afficher le resume (defaut : true)
Sortie RES (structure SAISIR enrichie) :
RES.d, RES.i, RES.v : scores ICA sous forme SAISIR
RES.signals.d/.i/.v : signaux ICA (une ligne par composante)
RES.model : parametres ICA et LDA du modele complet
RES.confusion : confusion en validation croisee
RES.confusionCalibration : confusion de recalage
RES.performance : performances en validation croisee
RES.cv.predictedIndex : classes predites en validation croisee
RES.cv.predictedLabels : etiquettes predites
La validation croisee est sans fuite d'information : centrage,
reduction, blanchiment, ICA et LDA sont recalcules dans chaque pli.
Exemple :
[r,C,p] = saisir_ICADA(mydata,'NumComponents',6,'KFolds',10);
colored_map(r,1,2,group);
Remarque : ICA-DA signifie ici ICA non supervisee suivie d'une LDA.
L'ordre final des composantes est etabli selon leur rapport de Fisher
sur le jeu complet, uniquement pour faciliter leur interpretation.
Flags pour la plateforme PULSAR
---------------
Flag1 : create ICA-DA model
Flag2 : mydata, varargin
Flag3 : ICA-DA
Flag4 : Model
-------------------------------------------------------------------------
Lecture et controle des entrees
-------------------------------------------------------------------------Return to thematic list · HOMEfunction icoShift_res = saisir_icoshift(xT, xP, inter, n, options, Scal)Source: saisir_icoshift.m
SAISIR_ICOSHIFT - SAISIR Wrapper for Interval Correlation Optimized Shifting (iCOshift)
Description:
============
Splits a SAISIR spectral database into intervals and co-shifts each vector
left-right using Fast Fourier Transform (FFT) to maximize correlation
toward a target spectrum. Missing parts on the edges are handled automatically.
Flags pour la plateforme PULSAR
---------------
Flag1 : icoshift
Flag2 : xT, xP, inter, n, options, Scal
Flag3 : icoShift_res
Flag4 : Correction
Input arguments:
================
xT : Target vector (1 x mP), or strings: 'average', 'median', 'max'.
xP : Standard SAISIR matrix structure containing fields:
.d : (Matrix nP x mP) Spectral or continuous data.
.i : (Matrix of char) Identifiers of the rows (samples).
.v : (Matrix of char/numeric) Variables identifiers (wavelengths).
inter : Alignment mode: 'whole', an integer (number of intervals), or custom bounds.
n : Maximum shift allowed: integer, 'b' (best search), 'f' (fast search, default).
options : Vector [1 x 4] for plot, filling mode, and pre-cosbifting options.
Scal : Vector of scalars used as axis for plot (optional, default: 1:mP).
Output arguments:
=================
icoShift_res : Standardized SAISIR structure containing:
.shifted : Valid SAISIR object (.d, .i, .v) with shift-corrected data.
.ints : Defined intervals matrix.
.ind : Matrix of shift indices per sample and per interval.
.target : The actual target array used for the final alignment.
--- 1. Control of Input Arguments & Formats ---Return to thematic list · HOMEfunction [X_align, shifts_pts, shifts_ppm, ref, intervals_idx] = saisir_icoShift2(X, ppm, varargin)Source: saisir_icoShift2.m
ICOShift pour 1H-RMN (sirop d'érable) — alignement par corrélation intervalle-par-intervalle
------------------------------------------------------------------------------
[X_align, shifts_pts, shifts_ppm, ref, intervals_idx] = icoShift_maple(X, ppm, ...)
X : (nSamples x nVars) matrices de spectres
ppm : (1 x nVars) vecteur des déplacements chimiques (croissant ou décroissant)
Flags pour la plateforme PULSAR
---------------
Flag1 : icoshift2
Flag2 : X, ppm, varargin
Flag3 : X_align, shifts_pts, shifts_ppm, ref, intervals_idx
Flag4 : Correction
Options Name-Value :
'Ref' : 'mean' (defaut) | 'median' | vecteur (1 x nVars)
'Intervals' : [K x 2] bornes en ppm (sinon défaut pour sirop d'érable)
'Mask' : [M x 2] zones à ignorer (defaut [4.60 5.00] ppm ~ HDO)
'MaxShift' : entier (#points) max par intervalle (defaut calculé depuis MaxShiftPPM)
'MaxShiftPPM': valeur en ppm pour convertir en points (defaut 0.010 ppm)
'Verbose' : true/false (defaut false)
Sorties :
X_align : X aligné
shifts_pts : (nSamples x K) décalages par intervalle (en points, + = vers la droite)
shifts_ppm : (nSamples x K) décalages en ppm
ref : spectre de référence utilisé (1 x nVars)
intervals_idx: cell{K,1} indices (colonnes) de chaque intervalle
Notes :
- Alignement "rigide" local (pas d’étirement), zero-padding aux bords.
- Pensez à corriger phase/baseline et calibrer (ex. TSP) AVANT.
- Placez icoShift AVANT la normalisation (PQN/TIC) et le scaling.
------------------------------------------------------------------------------
---------- Parsing ----------Return to thematic list · HOMEfunction [chromatograms_saisir, taille] = saisir_importENosefile(filename)Source: saisir_importENosefile.m
SAISIR(c) function_LARTIC 2024 Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2018 Import data from ENose-HeraclesII ASCII-text file. Script for importing data from the following text file: /Users/data_urines/Urines_20181205/Urines_20181211/M1_2_UR_PL15_002_016.Her.asc Flags pour la plateforme PULSAR --------------- Flag1 : importENosefile Flag2 : filename Flag3 : chromatograms_saisir, taille Flag4 : Tools Initialize variables.Return to thematic list · HOME
function [Taille, chromatogramme] = saisir_importENosefile2(filename)Source: saisir_importENosefile2.m
SAISIR(c) function_LARTIC 2022 Import data from ENose-HeraclesII exportation ASCII file. /Users/data_urines/Urines_20181211/M1_2_UR_PL15_002_016.Her.asc Flags pour la plateforme PULSAR --------------- Flag1 : importENosefile2 Flag2 : filename Flag3 : Taille, chromatogramme Flag4 : Tools Initialize variables.Return to thematic list · HOME
function spectre = saisir_importNIRcsvfile(filename, dataLines)Source: saisir_importNIRcsvfile.m
SAISIR(c) function_LARTIC 2025
Flags pour la plateforme PULSAR
---------------
Flag1 : importNIRcsvfile
Flag2 : filename, dataLines
Flag3 : spectre
Flag4 : Tools
Import data from a csv-text file
SAMPLE = IMPORTFILE(FILENAME) reads data from text file FILENAME
for the default selection. Returns the numeric data.
SAMPLE = IMPORTFILE(FILE, DATALINES) reads data for the specified
row interval(s) of text file FILENAME. Specify DATALINES as a
positive scalar integer or a N-by-2 array of positive scalar integers
for dis-contiguous row intervals.
Example:
sample = importfile("/Users/lartic/IR/NIR/sample_F4-R3.csv", [3, Inf]);
Input handling
If dataLines is not specified, define defaultsReturn to thematic list · HOMEfunction result = saisir_knn(mydata, groups, k)Source: saisir_knn.m
SAISIR(c)_function_LARTIC_function saisir_knn(result)
Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval,
Version: 1.0
(c)2026
KNN_SAISIR Classification KNN pour données SAISIR
Flags pour la plateforme PULSAR
---------------
Flag1 : KNN
Flag2 : result
Flag3 : display
Flag4 : Model
Syntaxe :
result = knn_saisir(mydata, groups)
result = knn_saisir(mydata, groups, k)
ENTREES
-------------------------------------------------------------------------
mydata : structure SAISIR contenant au minimum :
mydata.d matrice n x p
mydata.i identifiants des observations
mydata.v noms des variables
groups : structure SAISIR contenant les groupes :
groups.d vecteur n x 1 des codes numériques des groupes
groups.i identifiants des observations
groups.v normalement 'group'
groups.d2 informations textuelles associées, si présentes
groups.g structure de groupes SAISIR éventuelle
k : facultatif
[] ou omis -> recherche automatique
entier -> nombre de voisins imposé
SORTIE
-------------------------------------------------------------------------
result : structure contenant les prédictions KNN
result.d :
col. 1 = groupe observé
col. 2 = groupe prédit
col. 3 = classification correcte (1/0)
col. 4... = scores KNN des différentes classes
result.i : identifiants SAISIR
result.v : noms des variables
result.d2 : informations textuelles
result.model
result.k
result.performance
result.k_search
Exemples :
res = knn_saisir(mydata, groups);
res = knn_saisir(mydata, groups, 5);
========================================================================
Vérification de mydata
========================================================================Return to thematic list · HOMEfunction saisir_labelled_hist(X,col,startpos,endpos,(nclass),(charsize),(car))Source: saisir_labelled_hist.m
saisir_labelled_hist - draws an histogram in which each obs. name is considered as a label
function saisir_labelled_hist(X,col,startpos,endpos,(nclass),(charsize),(car))
Flags pour la plateforme PULSAR
---------------
Flag1 : labelled_hist
Flag2 : s, col, startpos, endpos, nclass, charsize, str1
Flag3 : edge ( Plot function)
Flag4 : Plot
Input arguments
===============
X : SAISIR data matrix
col : the column from which the histogram is drawn
startpos and endpos : the position in the row identifier strings considered as keys for coloration
nclass : number of desired classes
charsize : the size of character on the graph
str : (optional) if str (a string) is defined, all the observations are represented with
this string colored differently according to the extracted key.
by choosing str='--' (for example),it is possible to avoid overlapping identifiers.
This function build an histogram in which each observation is represented
by a colored code (key) extracted from the row identifiers.
Note: It is generally necessary to play with "nclass" and "charsize" to have a smart histogram
clf;Return to thematic list · HOMEfunction res=saisir_leave_one_out_pls1(X,y,ndim);Source: saisir_leave_one_out_pls1.m
saisir_leave_one_out_pls1 - PLS1 with leave_one out validation function res=saisir_leave_one_out_pls1(X,y,ndim); Flags pour la plateforme PULSAR --------------- Flag1 : PLS1 with leave_one out validation Flag2 : x, y, ndim Flag3 : res Flag4 : Model Input arguments: =============== X:SAISIR matrix of predictive variables (n x p) y:Saisir vector of the variable to be predicted (n x 1) ndim: (integer) maximal number of tested PLS dimensions Ouput arguments: =============== res with fields predy: SAISIR matrix of predicted y in leave-one-out (n x ndim) for all the dimensions tested. rmse: Root mean square error (1 x ndim) for all the dimensions tested r2: r2 value between observed and predicted y for all the dimensions tested. optimal_error: (double) minimal rmse among all the dimensions tested. optimal_dim: (integer) PLS dimension giving the best model. optimal_r2: r2 value for the best model. The function leaves out one observation and makes a model with the resulting observations. The left observations is predicted. This procedure is carried out for the n rows in X. This function is very slow and must be used only for small data set (typically less than 30 observations). Otherwise one must prefer a validation procedure.Return to thematic list · HOME
function res=saisir_leave_one_out_pls2(X,y,ndim);Source: saisir_leave_one_out_pls2.m
saisir_leave_one_out_pls2 - PLS2 with leave_one out validation
function res=saisir_leave_one_out_pls2(X,y,ndim);
Flags pour la plateforme PULSAR
---------------
Flag1 : PLS2 with leave_one out validation
Flag2 : x, y, ndim
Flag3 : res
Flag4 : Model
Input arguments:
===============
X:SAISIR matrix of predictive variables (n x p)
y:SAISIRr vector of the variables to be predicted (n x k)
ndim: (integer) maximal number of tested PLS dimensions
Ouput arguments:
===============
res with fields
col: vector of k cells. The cell res.col{i} contains the y predicted values
(n x ndim) associated with the variable i, for all the PLS dimensions
tested.
RMSEV:root mean square error (k x ndim) for all the variables (rows) and all the
dimensions (columns).
r2: r2 values (k x ndim) for all the variables (rows) and all the
dimensions (columns).
The function leaves out one observation and makes a model with the
resulting observations. The ys of the left observations are predicted.
This procedure is carried out for the n rows in X.
This function is very slow and must be used only for small data set
(typically less than 30 observations). Otherwise one must prefer a
validation procedure.Return to thematic list · HOMEfunction z=saisir_linkage(dis)Source: saisir_linkage.m
saisir_linkage - assesses a simple linkage vector from a matrix of distance function z=saisir_linkage(dis) Flags pour la plateforme PULSAR --------------- Flag1 : Linkage Flag2 : dis Flag3 : z Flag4 : Model Input argument ============= dis: a SAISIR matrix of distance (n x n, symetric) Output argument ============== z: z vector as required by the MATLAB function "dendrogram" From a complete square matrix of distances extracts the "unfolded" triangular matrix in order to enter the matlab program "linkage" with the option "ward" Returns the z vector as required by the MATLAB "dendrogram" function See also : saisir_dendro (dendrogram with SAISIR)Return to thematic list · HOME
function saisir_list(X,(start))Source: saisir_list.m
list - lists rows (only with a small number of columns) Flags pour la plateforme PULSAR --------------- Flag1 : list Flag2 : saisir, start Flag3 : None (display function) Flag4 : Tools function saisir_list(X,(start)) start: starting index in the list (default : 1)Return to thematic list · HOME
function spectrum_saisir = saisir_loadIRCSVFile(filePath, fileName)Source: saisir_loadIRCSVFile.m
Import data from text file Flags pour la plateforme PULSAR --------------- Flag1 : loadIRCSVFile Flag2 : filePath, fileName Flag3 : spectrum_saisir Flag4 : Tools Script for importing data from the transmitted text file: CSV return table object containing Intensity as 1st column and wavelength as 2nd column Set up the Import Options and import the dataReturn to thematic list · HOME
function [mydata] = saisir_log10(data, option)Source: saisir_log10.m
saisir_log10 - applies log10 transformation to a SAISIR matrix Flags pour la plateforme PULSAR --------------- Flag1 : Log10 transformation Flag2 : data, option Flag3 : mydata Flag4 : Tools Input arguments: --------------- data : SAISIR matrix coderow (optional) : string (code added to the row identifiers) codecol (optional): string (code added to the variables identifiers) Output argument: ---------------- X: SAISIR matrix with fields "d" (copy of "data"), "i" (identifiers of rows), "v" (identifiers of variables) Saisir means "statistique appliqu�e � l'interpretation des spectres infrarouge" or "statistics applied to the interpretation of IR spectra'Return to thematic list · HOME
function [lr1type]=saisir_lr1(X,y,maxdim,(ratioxy))Source: saisir_lr1.m
saisir_lr1 - Latent root regression function [lr1type]=saisir_lr1(X,y,maxdim,(ratioxy)) Computes a basic latent root model Flags pour la plateforme PULSAR --------------- Flag1 : lr1 - Latent root regression Flag2 : x, y, maxdim, ratioxy Flag3 : lr1type Flag4 : Model Input arguments: ================ X: SAISIR matrix of predictive variables (n x p) y: SAISIR vector of variables to be predicted (n x 1) maxdim (integer): maximal number of dimensions introduced in the model ratioxy (float) : positive number greater than 0 less than 1 giving the relative importance of x and y. 1: x important; 0 x not important Output argument: ================ lr1type with fields: predy: predicted y for all the models, up to maxdim dimensions (n x maxdim) corrcoef: correlation coefficents between y and predicted y (1 x maxdim) beta: regression coefficients for all the models (p x maxdim) averagey: average of y averagex: average of x ratioxy: copy of parameter ratioxyReturn to thematic list · HOME
function [discrtype] = saisir_maha(saisir, group, maxvar)Source: saisir_maha.m
MAHA - Forward stepwise variable selection for Discriminant Analysis
Description:
============
Performs a forward selection of predictive variables based on the highest
resubstitution classification success rate using Linear/Quadratic Discriminant Analysis.
CRITICAL NOTE FOR AUDIT:
=======================
This function evaluates performance on the training data itself (resubstitution).
Results are prone to optimistic bias (overfitting). Use for exploratory purposes only.
Flags pour la plateforme PULSAR
---------------
Flag1 : maha
Flag2 : saisir, group, maxvar
Flag3 : discrtype
Flag4 : VarSel
Input arguments:
================
saisir : SAISIR data structure (.d, .i, .v) of size (n_samples x n_variables).
group : SAISIR structure vector (.d, .i, .v) of true integer class labels (n_samples x 1).
maxvar : Integer specifying the maximum number of variables to select.
Output arguments:
=================
discrtype : Structure containing:
.step : A compliant SAISIR structure where:
.d = Matrix of size (maxvar x 1) with correct classification counts.
.i = Cell array of selected variable names in order of introduction.
.v = {'Correct_Classifications'}
.classed : A SAISIR vector (.d, .i, .v) containing predicted groups at the final step.Return to thematic list · HOMEfunction [discrtype] = saisir_maha1(saisir, group, maxvar, test, testgroup)Source: saisir_maha1.m
MAHA1 - Forward stepwise variable selection with an independent validation set
Description:
============
Performs a forward selection of predictive variables based on calibration data success,
and immediately evaluates the selection step on an independent test dataset.
Flags pour la plateforme PULSAR
---------------
Flag1 : maha1
Flag2 : saisir, group, maxvar, test, testgroup
Flag3 : discrtype
Flag4 : VarSel
Input arguments:
================
saisir : SAISIR calibration matrix structure (.d, .i, .v) (n1 x p).
group : SAISIR calibration class labels vector (.d, .i, .v) (n1 x 1).
maxvar : Integer specifying the maximum number of variables to select.
test : SAISIR independent test matrix structure (.d, .i, .v) (n2 x p).
testgroup : SAISIR independent test class labels vector (.d, .i, .v) (n2 x 1).
Output arguments:
=================
discrtype : Structure containing:
.step : A compliant SAISIR structure where:
.d = Matrix (maxvar x 2) -> Col 1: Calib success | Col 2: Test success
.i = Cell array of selected variable names in order of introduction.
.v = {'Calib_Correct', 'Test_Correct'}
.classed : SAISIR vector of predicted groups for the calibration set (final step).
.testclassed : SAISIR vector of predicted groups for the independent test set (final step).Return to thematic list · HOMEfunction[discrtype]=saisir_maha3(saisir,group,maxvar)Source: saisir_maha3.m
saisir_maha3 - simple discriminant analysis forward introducing variables no validation samples function[discrtype]=saisir_maha3(X,group,maxvar) Flags pour la plateforme PULSAR --------------- Flag1 : Maha3 Flag2 : saisir1, group1, maxvar Flag3 : discrtype Flag4 : VarSel Input arguments: ---------------- X :SAISIR matrix (n x p) of predictive variables group :SAISIR vector (n x 1) of integers indicating the group. Two observations belonging to the same group have the same group number maxvar : integer indicating the maximum number of variables to be introduced. Output arguments: ----------------- res with fields: ncorrect: vector of integers (1 x maxdim) indicating the number of correct classifications at each step. classed: SAISIR vector of integer (n x 1) indicating the predicted group number for the model with maxvar variables introduced. confusion: SAISIR confusion matrix (row: actual group, column : predicted group). varrank: vector of integer (1 x maxdim) indicating the index (rank) of the introduced variables. The function computes a linear discriminant analysis introducing up to maxvar variables. At each step, the more discriminating variable according to the maximisation of the trace of T-1B is introduced.Return to thematic list · HOME
function[discrtype]=saisir_maha4(saisir,group,maxvar)Source: saisir_maha4.m
saisir_maha4 - simple discriminant analysis forward
function[discrtype]=saisir_maha4(X,group,maxvar)
Flags pour la plateforme PULSAR
---------------
Flag1 : Maha4
Flag2 : saisir1, group1, maxvar
Flag3 : discrtype
Flag4 : VarSel
Input arguments:
----------------
X :SAISIR matrix (n x p) of predictive variables
group :SAISIR vector (n x 1) of integers indicating the group. Two observations
belonging to the same group have the same group number
maxvar : integer indicating the maximum number of variables to be
introduced.
Output arguments:
-----------------
res with fields:
ncorrect: vector of integers (1 x maxdim) indicating the number of
correct classifications at each step.
classed: SAISIR vector of integer (n x 1) indicating the predicted group number
for the model with maxvar variables introduced.
confusion: SAISIR confusion matrix (row: actual group, column : predicted group).
varrank: vector of integer (1 x maxdim) indicating the index ("rank") of the
introduced variables.
The function computes a linear discriminant analysis introducing up to
maxvar variables. At each step, the new variables giving the highest number
of correctly classified samples is introduced.Return to thematic list · HOMEfunction[discrtype]=saisir_maha6(saisir1,group1,maxvar,selected)Source: saisir_maha6.m
saisir_maha6 - simple discriminant analysis forward introducing variables with validation samples
function[discrtype]=saisir_maha6(X,group,maxvar,selected)
Flags pour la plateforme PULSAR
---------------
Flag1 : Maha6
Flag2 : saisir1, group1, maxvar, selected
Flag3 : discrtype
Flag4 : VarSel
Input arguments:
===============
X: SAISIR matrix (n x p) of data
group: SAISIR vector of integer (n x 1) indicating the group number of the
observations. Two observations sharing a same group number belong to the
same qualitative group
maxvar: integer giving the maximal number of variables introduced in the
model
selected: Matlab vector (n x 1) the elments of which are equal to 0
(observation placed in the calibration set, or 1 (observations placed in
the validation set).
Ouput argument:
==============
discrtype with fields
ncorrect: vector of integers (1 x maxvar) giving the number of correctly
classified observations in the calibration set.
classed: SAISIR vector of integer giving the predicted group of the
calibration set.
confusion: matlab confusion matrix of the calibration set for the final
step.
sconfusion: matlab confusion matrix of the validation set for the final
step.
sclassed: SAISIR vector of integer giving the predicted group of the
validation set.
nscorrect: vector of integers (1 x maxvar) giving the number of correctly
classified observations in the validation (supplementary) set.
sclassed: vector of integers (1 x maxvar) giving the predicted group of
in the validation.
nscorrect: vector of integers (1 x maxvar) giving the number of correctly
classified observations in the validation set.
The function computes a linear discriminant analysis introducing up to maxvar variable
at each step, the more discriminating variable
according to the maximisation of the trace of T-1B is introduced
the collection is divided in cal. sample and test samples according to selected:
selected=0 , sample placed in calibration, =1 verification
Typical use
===========
load data;
g=saisir_create_group1(data,1,2); %% supposing that the identifiers contain a key
for forming the qualitative group in position of characters 1 and 2
sel=saisir_random_select(size(data.d,1),round(size(data.d,1)/3));%% a third in
validation
res=saisir_maha6(data,g,5,del);
saisir_xdisp('Evolution of correct classification in the calibration set',res.ncorrect);
saisir_xdisp('Evolution of correct classification in the validation set', res.nscorrect);Return to thematic list · HOMEfunction R = saisir_mannwhitney(mydata, mygroups, varargin)Source: saisir_mannwhitney.m
SAISIR(c)_function_LARTIC - function saisir_mannwhitney(mydata, mygroups, varargin) Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2026 SAISIR_MANNWHITNEY Test de Mann–Whitney (ranksum) pour 2 groupes (SAISIR). R = saisir_mannwhitney(mydata, mygroups) R = saisir_mannwhitney(mydata, mygroups, 'Alpha', 0.05, 'Tail', 'both', 'Method', 'auto') Sortie: R.table : table avec statistiques par variable OptionsReturn to thematic list · HOME
function saisir_map(X,col1,col2,(col1label),(col2label),(title),(charsize),(margin))Source: saisir_map.m
saisir_map - graph of map of data using identifiers as names function saisir_map(X,col1,col2,(col1label),(col2label),(title),(charsize),(margin)) Flags pour la plateforme PULSAR --------------- Flag1 : 2D map Flag2 : saisir, col1, col2, labcol1, labcol2, titre, charsize, marg Flag3 : None (plotting function) Flag4 : Plot Input arguments --------------- X: SAISIR matrix col1, col2 : index of the two columns to be represented col1label (optional): Label of the variable forming the X-axis col2label (optional): Label of the variable forming the Y-axis title (optional) : title of the graph charsize (optional) : size of the plotted characters marg (optional) : margin value allowing an extension of the axis in order to cope with long identifiers (default value: 0.05) For the French users: there is a synonym function "carte". Use preferably "saisir_map"Return to thematic list · HOME
function saisir_map3D(X,col1,col2,col3,(label1),(label2),(label3),(title),(charsize))Source: saisir_map3D.m
saisir_map3D - Draws a 3D map function saisir_map3D(X,col1,col2,col3,(label1),(label2),(label3),(title),(charsize)) Flags pour la plateforme PULSAR --------------- Flag1 : 3D map Flag2 : saisir, col1, col2, col3, startpos, endpos, labcol1, labcol2, labcol3, titre, charsize Flag3 : None (plotting function) Flag4 : Plot Input arguments: =============== X: SAISIR matrix (n x p) co1, col2, col3: indices of he columns to be represented as X, Y and Z in the 3D plot (integers). label1,label2, label3: label of axes on X, Y, Z (optional, strings or vectors of char) charsize: size of the characters (optional, default :6) synonymous of "carte3D" (French name). Use preferably saisir_map3DReturn to thematic list · HOME
function [saisir] = saisir_matrix2saisir(data,coderow,codecol)Source: saisir_matrix2saisir.m
saisir_matrix2saisir - transforms a Matlab matrix in a saisir structure X = saisir_matrix2saisir(data,(coderow),(codecol)) Flags pour la plateforme PULSAR --------------- Flag1 : matrix2saisir Flag2 : data, coderow, codecol Flag3 : saisir Flag4 : Tools Input arguments: --------------- data : Matlab matrix coderow (optional) : string (code added to the row identifiers) codecol (optional): string (code added to the variables identifiers) Output argument: ---------------- X: SAISIR matrix with fields "d" (copy of "data"), "i" (identifiers of rows), "v" (identifiers of variables) Saisir means "statistique appliquee à l'interpretation des spectres infrarouge" or "statistics applied to the interpretation of IR spectra' See the manual of SAISIR for understanding the rationale of this structure. Typical use: =========== A=[1 2 3 4; 5 6 7 8]; B=saisir_matrix2saisir(A,'row # ', 'Column # '); % >> B.d % ans = % 1 2 3 4 % 5 6 7 8 % >> B.i % ans = % row # 1 % row # 2 % >> B.v % ans = % Column # 1 % Column # 2 % Column # 3 % Column # 4Return to thematic list · HOME
function P = saisir_mbpca_parameters()Source: MBPCA/saisir_mbpca_parameters.m
MBPCA_PARAMETERS Paramètres généraux de l'analyse MB-PCA.Return to thematic list · HOME
function dis = saisir_mdistance(X1,X2,metric)Source: saisir_mdistance.m
saisir_mdistance - computes distances between the two tables using metric "metric" function dis = saisir_mdistance(X1,X2,metric) Flags pour la plateforme PULSAR --------------- Flag1 : Mdistance Flag2 : saisir1, saisir2, metric Flag3 : saisir Flag4 : Model Input arguments: ================ X1: SAISIR matrix ( n1 x p) X2: SAISIR matrix (n2 x p) metric: SAISIR matrix (p x p) of the metric Output argument: ================ dis: SAISIR matrix of distances between observations (n1 x n2) according to the metric "metric" example of use (computing Mahalanobis distances): ================================================ data=saisir_matrix2saisir(rand(50,10));%% dummy data data1=saisir_center(data);%% centered data metric=saisir_matrix2saisir(inv(data1.d'*data1.d)); dis=saisir_mdistance(data1,data1,metric);%% Mahalanobis distance between observationsReturn to thematic list · HOME
function[moyenne]=saisir_mean(saisir)Source: saisir_mean.m
saisir_mean - computes the mean of the columns, following the saisir format function[xmean]=saisir_mean(X); Flags pour la plateforme PULSAR --------------- Flag1 : Mean Flag2 : saisir Flag3 : moyenne Flag4 : Correction Input argument ============== X: SAISIR matrix (n x p) Ouput argument ============== xmean: SAISIR vector (1 x p) of the meanReturn to thematic list · HOME
function saisir_mean_replicats(mydata, firstLetterGroup, lastLetterGroup, firstLetterRep, lastLetterRep)Source: saisir_mean_replicats.m
saisir_mean_replicats - Perform an averaging of analytical replicates contained in the dataset
function saisir_mean_replicats(mydata, firstLetterGroup, lastLetterGroup, firstLetterRep, lastLetterRep)
INPUTS :
mydata : structure SAISIR avec champs .d (données), .i (noms), .v (variables)
firstLetterGroup, lastLetterGroup :
firstLetterRep, lastLetterRep :
OUTPUTS :
avg_mydata : structure SAISIR moyenne par groupe (replicats définis par caractères firstLetter-lastLetter)
Flags pour la plateforme PULSAR
---------------
Flag1 : Mean of replicates
Flag2 : mydata, firstLetterGroup, lastLetterGroup, firstLetterRep, lastLetterRep
Flag3 : avg_mydata
Flag4 : Correction
Extraire identifiants de réplicats (caractères firstLetter-lastLetter)
replicate_ids = cellfun(@(x) x(firstLetter:lastLetter), cellstr(mydata.i), 'UniformOutput', false);
[unique_ids, ~, group_idx] = unique(replicate_ids);
% Initialiser la nouvelle matrice de données moyennées
num_replicats = length(unique_ids);
data_mean = zeros(num_replicats, size(mydata.d, 2));
new_names = cell(num_replicats, 1);
for k = 1:num_replicats
idx = (group_idx == k);
data_mean(k, :) = mean(mydata.d(idx, :), 1);
% Générer un nom pour le groupe (prend le 1er nom associé comme modèle)
new_names{k} = ['AVG_' replicate_ids{find(idx, 1)}];
end
Identifier les groupes via caractères 1-4 + 6-7Return to thematic list · HOMEfunction[mediane]=saisir_median(saisir)Source: saisir_median.m
saisir_mean - computes the median of the columns, following the saisir format function[xmean]=saisir_median(X); Input argument ============== X: SAISIR matrix (n x p) Ouput argument ============== xmedian: SAISIR vector (1 x p) of the meanReturn to thematic list · HOME
function res=saisir_mfa(collection);Source: saisir_mfa.m
saisir_mfa - Multiple factor analysis
function res=saisir_mfa(collection);
Flags pour la plateforme PULSAR
---------------
Flag1 : Multiple factor analysis
Flag2 : collection
Flag3 : mfaResults
Flag4 : Model
Input argument:
===============
collection: VECTOR OF SAISIR structures
example of building a collection : collection{1}=table1; collection{2}=table2; collection{3}=table3
in which table1, table2, table are SAISIR structure
Each table must include the same observations, but not necessarily the same variables.
WARNING! In this version, the variables are not normalised !
Let n be the number of observations, and t the number of tables
Let WHOLE be the matrix of appended tables normalized according to MFA (dimensions n x m)
Let k be the rank of WHOLE
Output arguments:
================
res with fields:
score (n x k) : scores of the individuals (compromise)
eigenvec ( m x k) : eigenvectors of the PCA on WHOLE (no direct use)
eigenval (1 x k) : eigenvalues of the PCA on WHOLE
average (1 x m) : averages of the variables of WHOLE
var_score (m x k) : scores of the variables
proj {1xt cell} : projectors for computing the projection of new observations of each table
first_eigenval (1xt) : first eigenvalues of the individual PCAS on each table
trajectory (q x k) : individual score of each row of each table (q = total number of rows in all the tables q=n*t)
id_group (q x 1) : identification of the belonging of the observation_score into a given table
table_score (t x k) : scores of the tablesReturn to thematic list · HOMEfunction [names] = saisir_mir_style(names1)Source: saisir_mir_style.m
MIR_STYLE - Inverts the sign of MIR spectra wavenumbers for conventional plotting [names] = saisir_mir_style(names1) Flags pour la plateforme PULSAR --------------- Flag1 : MIR style Flag2 : names1 Flag3 : names Flag4 : Tools Input argument: =============== names1 : Character matrix or cell array of strings representing wavenumbers Output argument: ================ names : Character matrix (SAISIR compliant) with inverted numerical values --- 1. Input Verification ---Return to thematic list · HOME
function X1=saisir_moving_average(X,window_size)Source: saisir_moving_average.m
saisir_moving_average - Moving average of signals function X1=saisir_moving_average(X,window_size) Flags pour la plateforme PULSAR --------------- Flag1 : Moving average of signals Flag2 : saisir1, window_size Flag3 : x Flag4 : Correction Input arguments =============== X:SAISIR matrix of data (normally digitized signals such as spectra) window_size: integer giving the number of data points which are locally averaged (odd number). Ouput arguments =============== X1: matrix of averaged data The function replaces a given variable by its average in the range defined by "window_size". (window_size-1)/2 variables are lost at the begining and the end of the signal. For example with window_size = 5 a given variable x(i) of index i is replaced by the local average (x(i-2)+x(i-1)+x(i)+x(i+1)+x(i+2))/5Return to thematic list · HOME
function [X1] = saisir_moving_max(X,window_size)Source: saisir_moving_max.m
saisir_moving_max - replaces the central point of a moving window by the maximum value function [X1] = saisir_moving_max(X,window_size) Flags pour la plateforme PULSAR --------------- Flag1 : Moving maximum Flag2 : saisir1, window_size Flag3 : saisir Flag4 : Correction Input arguments =============== X:SAISIR matrix of data (normally digitized signals such as spectra) window_size: integer giving the number of data points on which the max value is computed. Ouput arguments =============== X1: matrix of local maxima The function replaces a given variable by the maximum value in the range defined by "window_size". (window_size-1)/2 variables are lost at the begining and the end of the signal. For example with window_size = 5 a given variable x(i) of index i is replaced by the local maximum of variables x(i-2); x(i-1); x(i): x(i+1); x(i+2)Return to thematic list · HOME
function [saisir] = saisir_moving_min(saisir1,window_size)Source: saisir_moving_min.m
saisir_moving_min - replaces the central point of a moving window by the minimum value saisir_moving_min(X,window_size) Flags pour la plateforme PULSAR --------------- Flag1 : Moving minimum Flag2 : saisir1, window_size Flag3 : saisir Flag4 : Correction Input arguments =============== X:SAISIR matrix of data (normally digitized signals such as spectra) window_size: integer giving the number of data points on which the min value is computed. Ouput arguments =============== X1: matrix of local minima The function replaces a given variable by the minimum value in the range defined by "window_size". (window_size-1)/2 variables are lost at the begining and the end of the signal. For example with window_size = 5 a given variable x(i) of index i is replaced by the local minimum of variables x(i-2); x(i-1); x(i): x(i+1); x(i+2)Return to thematic list · HOME
function [X1] = saisir_msc(X,(reference))Source: saisir_msc.m
saisir_msc - Multiplicative scatter correction on spectra function [X1] = saisir_msc(X,(reference)) Flags pour la plateforme PULSAR --------------- Flag1 : Msc - Multiplicative scatter correction Flag2 : saisir1, reference Flag3 : saisir Flag4 : Correction Input arguments: ================ X:SAISIR matrix of data (n x p) reference (optional): SAISIR vector of a reference spectrum (default: average of X) Output: ====== X1: data corrected by the Multiplicative scatter correction method.Return to thematic list · HOME
function X12=saisir_mult(X1,X2);Source: saisir_mult.m
saisir_mult - matrix multiplication following the SAISIR format function X12=saisir_mult(X1,X2); Flags pour la plateforme PULSAR --------------- Flag1 : Multiplication Flag2 : a, b Flag3 : ab Flag4 : Tools Input arguments: =============== X1 and X2 : SAISIR matrices dimensionned (n x p) and (p x m) respectively Output argument: =============== X12: SAISIR matrix (n x m) , result of the multiplication of X1 with X2 Little use!Return to thematic list · HOME
function res=saisir_multiple_regression(x,y);Source: saisir_multiple_regression.m
saisir_multiple_regression - Simple Multiple linear regression (all the variables) function res=saisir_multiple_regression(x,y); Flags pour la plateforme PULSAR --------------- Flag1 : Multiple linear regression Flag2 : x, y Flag3 : res, STATS Flag4 : Model Input arguments =============== X: SAISIR matrix of predictive variables (n x p) y: SAISIR vector of observed y (n x 1); Output argument =============== res with fields ypred: predicted y beta0: intercept of the model (double) beta: regression coefficient r2: r2 value RMSEC: Root mean square error of calibrationReturn to thematic list · HOME
function res=saisir_multiway_pca(collection);Source: saisir_multiway_pca.m
saisir_multiway_pca - Multi way principal component analysis
function res=saisir_multiway_pca(collection);
Flags pour la plateforme PULSAR
---------------
Flag1 : Multi way PCA
Flag2 : collection
Flag3 : res
Flag4 : Model
Input argument:
==============
collection : ARRAY OF SAISIR matrices
example of building a collection : collection col{1)=table1;col{2)=table2; col{3)=table3
in which table1, table2, table are SAISIR structure
Each table must include the same observations, but not necessarily the same variables.
WARNING! In this version, the variables are not normalised !
Let n be the number of observations, and t the number of tables
Let WHOLE be the matrix of appended tables(dimensions n x m)
Let k be the rank of WHOLE
Output argument:
===============
res with fields:
score (n x k) : scores of the individuals (compromise)
eigenvec ( m x k) : eigenvectors of the PCA on WHOLE (no direct use)
eigenval (1 x k) : eigenvalues of the PCA on WHOLE
average (1 x m) : averages of the variables of WHOLE
var_score (m x k) : scores of the variables
proj {1xt cell) : projectors for computing the projection of new observations of each table
trajectory (q x k) : individual score of each row of each table (q = total number of rows in all the tables)
id_group (q x 1) : identification of the belonging of the observation_score into a given table
table_score (t x k) : scores of the tables
This function is identical to "saisir_mfa" except that the tables are simply set in such a way that their norm are set to 1.Return to thematic list · HOMEfunction[cor]=saisir_nancor(x1,x2)Source: saisir_nancor.m
saisir_nancor - Matrix of correlation with missing data function[cor]=saisir_nancor(X1,X2) Flags pour la plateforme PULSAR --------------- Flag1 : Correlation with missing data Flag2 : x1, x2 Flag3 : cor Flag4 : Tools Input arguments: ================ X1 and X2: SAISIR matrices dimensioned (n x p1) and (n x p2) respectively. Output argument: ================ cor: SAISIR matrix (dimensioned p1 x p2). An element cor.d(a,b) is the correlation coefficient between the column a of X1 and b of X2.Return to thematic list · HOME
function [saisir] = saisir_norm_col(saisir1,(mode))Source: saisir_norm_col.m
saisir_norm_col - divides each column by the corresponding standard deviation function [saisir] = saisir_norm_col(saisir1,(mode)) Flags pour la plateforme PULSAR --------------- Flag1 : Normalization of columns Flag2 : saisir1, mode Flag3 : saisir Flag4 : Correction Input arguments ============== saisir1: SAISIR data matrix mode (optional): 0 or 1 division by n-1 or by n respectively Output argument ============== saisir: SAISIR data matrix with the same fields as saisir1, but with each column divided by the corresponding standard deviation divide each column by the corresponding standard deviation mode (optional): 0 or 1 division by n-1 or by n respectively default : 1 OBSOLETE: USE PREFERABLY FUNCTION "saisir_standardize"Return to thematic list · HOME
function X_saisir = saisir_normc(X_saisir)Source: saisir_normc.m
saisir_normc - Wrapper SAISIR sécurisé pour normaliser les spectres (lignes) à une norme de 1 Flags pour la plateforme PULSAR --------------- Flag1 : Normc Flag2 : X_saisir Flag3 : X_saisir Flag4 : Correction Input: ====== X_saisir : Objet SAISIR (n x p) ou matrice brute de données spectrales Output: ======= X_saisir : Objet SAISIR avec les spectres normalisés (lignes de la matrice .d normalisées à une norme de 1) Il utilise la fonction normc d'origine. 1. Extraction des donnéesReturn to thematic list · HOME
function [pcatype]=saisir_pca(X,(var_score))Source: saisir_normed_pca.m
saisir_normed_pca - PCA with normalisation of data
function[pcatype]=saisir_normed_pca(X)
function [pcatype]=saisir_pca(X,(var_score))
Assesses principal component analysis (on not normalised data)
Flags pour la plateforme PULSAR
---------------
Flag1 : normed_pca
Flag2 : saisir
Flag3 : pcatype
Flag4 : Model
Input arguments:
----------------
saisir : SAISIR matrix structure of raw (not normalised) data
Output arguments:
----------------
pcatype with fields:
score :PC score
eigenvec :eigenvectors (loadings)
eigenval :eigenvalues
average :average observation
var_score :scores of the variables
std: standard deviations of the columns of X
NOTA :the weight of the observations are equal to 1/(number of rows)
ALL the possible scores are calculated
SEE ALSO : saisir_pca, saisir_cumulate_covariance, saisir_covariance_pca, saisir_normed_pca
saisir_correlation_plot, saisir_apply_pca
typical example:
===============
p=normed_pca(data);%% PCA
saisir_map(p.score,1,2);%% PC plot 1-2
figure;
saisir_correlation_plot(p.score,1,2, data);%% correlation with chemistryReturn to thematic list · HOMEfunction[res]=saisir_nuee(saisir,ngroup,nchanged)Source: saisir_nuee.m
saisir_nuee - Nuee dynamique (KCmeans)
function[res]=saisir_nuee(X,ngroup,(nchanged))
Clusters the data into ngroup according to the KCmeans method ("nue dynamique");
Flags pour la plateforme PULSAR
---------------
Flag1 : Nuee dynamique (KCmeans)
Flag2 : saisir, ngroup, nchanged
Flag3 : res
Flag4 : Model
Input arguments
==============
X: SAISIR data matrix
ngroup (integer): number of groups asked for
nchanged (optional):stop iteration when there are still nchanged groups
which have changed in the previous iteration
This allows sparing some time. nchanged must be small in comparison with
the number of rows of X
Output argument
==============
res with fields
group: SAISIR vector of groups. Observations with the same group number
have been classified in the same group.
centre: barycenter of the groups.
Warning: the function may reduce the number of groupsReturn to thematic list · HOMEfunction str=saisir_num2str1(vector,ndigit);Source: saisir_num2str1.m
saisir_num2str1 - Justified num2string function str=saisir_num2str1(vector,ndigit); Flags pour la plateforme PULSAR --------------- Flag1 : Number to string Flag2 : vector, ndigit Flag3 : str Flag4 : Tools Input arguments: =============== vector : Matlab vector of integers ndigit : positive integer This function transforms numbers into matrices of char. The function justifies the strings by adding zeros. If the first argument is a row vector, it is transposed % %Example % %======= x=[1 2 100]; x1=saisir_num2str1(x,5); x1 % 00001 % 00002 % 00100 The main use of this function is to help building smart row names in SAISIR matrices using the system of extractable fields in the names.Return to thematic list · HOME
function[pcatype] = saisir_pca(mydata,var_score)Source: saisir_pca.m
SAISIR(c)_function_LARTIC - function saisir_pca(mydata,var_score)
Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval,
Version: 1.0
(c)2024
saisir_pca - principal component analysis on raw data (not normalised data)
Flags pour la plateforme PULSAR
---------------
Flag1 : PCA
Flag2 : mydata
Flag3 : pcatype
Flag4 : Modele
Input arguments:
---------------
mydata: SAISIR matrix containing 3 fields : .d .i .v
.d for data, a numeric data matrix with samples in line and variables in columns (double type)
.i for identifiers, a column containing a list of sample names as string (char type)
.v for variables, a column containing a list of variables as numeric values (double type)
var_score : optional (0: only scores of observations
1: gives also the scores of the variables (default : 0)
Output arguments:
----------------
pcatype with fields:
score :PC score
eigenvec :eigenvectors (loadings)
eigenval :eigenvalues
average :average observation
var_score : (if input arg. "varscore" defined) scores of the variables
NOTA :the weight of the observations are equal to 1/(number of rows)
ALL the possible scores are calculated
SEE ALSO : normed_pca, cumulate_covariance, covariance_pca, normed_pca
correlation plot, apply_pca
typical example:
spectra: n x p, chemistry n x k
p=pca(spectra);%% PCA
map(p.score,1,2);%% PC plot 1-2
correlation_plot(p.score,1,2, chemistry);%% correlation with chemistry
if ~issaisir(mydata)
endReturn to thematic list · HOMEfunction res=saisir_pca_cano(collection,ndim,graph);Source: saisir_pca_cano.m
saisir_pca_cano - generalized canonical analysis after PCAs on each table
function res=saisir_pca_cano(collection,ndim,graph);
========================================================================
Flags pour la plateforme PULSAR
---------------
Flag1 : PCA canonical analysis
Flag2 : collection, ndim, graph
Flag3 : res
Flag4 : Model
input argument :
===============
collection: array of SAISIR matrices with the same number of rows (see
below)
ndim : dimension of each individual PCA (must be less than the smallest
number of variables
graph : if different from 0 : display examples of graph
let n be the number of observations in each table, k the number of tables
Output argument:
===============
res with fields
compromise : PCA giving the compromise
observation_score : scores of each observation of each table (nxk rows)
id_group : groups identifying each observation in observation_score (for graph)
projector : struct array giving the vectors allowing the projection of each data set
score_correlation: : correlations between compromise scores and table scores
table_average : struct array giving the average of each original data table
Adapted from : G. Saporta. Probabilit�s, analyse des donn�es et statistiques.
: Edition Technip, page 192 and followings.
========================================================================
The function first computes PCA on each of the SAISIR matrices in
"collection". Only the ndim PC scores are kept in each matrix.
Canonical analysis is carried out on the series of scores.
This procedure avoids to have inversion of the original matrices. The use
of few scores guarantees that the computation is feasible, even if the
original matrices have colinear variables.
Note :
the argument collection is obtained for example by
collection(1)=data1;collection(2)=data2; ...;collection(k)=datak;
In which data1, data2, ..., datak are SAISIR matrices with the same number
of rows.Return to thematic list · HOMEfunction[res]=saisir_pca_cross_ridge_regression(x,y,range,selected)Source: saisir_pca_cross_ridge_regression.m
saisir_pca_cross_ridge_regression - PCA ridge regression with crossvalidation function[res]=saisir_pca_cross_ridge_regression(X,y,krange,selected) Flags pour la plateforme PULSAR --------------- Flag1 : PCA ridge regression - crossvalidation Flag2 : x, y, range, selected Flag3 : res Flag4 : Model Input argument: ============== X: SAISIR matrix (n x p) of predictive variables y: SAISIR vector (n x 1) of the variable to be predicted range: MATLAB vector of integers (1 x q) selected: MATLAB vector (n x 1) with elements = 0 (selected in calibration) or 1 ( selected in validation) Outut argument: ============== res with fields: predy: predicted y in the validation set (q columns) obsy: observed y of the validation set (1 column) r2: r2 between observed and predicted values in the validation set (vector with q elements) rmsecv: root mean square error of validation (1 x q) ridgetype: calibration model (see function "saisir_pca_ridge_regression") This function divides a collection in calibration and verification set using the input argument "selected" and applies the saisir_pca_ridge_regression on the validation set The function calculates as many ridge regression models as the number of elements in "range" In ridge regression, the product X'X is replaced by X'X +kI. In the present function, k is in fact the eigenvalue of the corresponding PCA component for example, if krange = [1 3 5], that means that the tested values of k are the eigenvalues #1, #3, #5. The rationale of this, is that k in saisir_ridge_regression is very difficult to find it is a good idea to test a value in the range of the observed eigenvalues Typical example =============== Let DATA (n x p) be the SAISIR matrix of predictive variables and y (n x 1) the variable to be predicted. myrange=1:20 %% testing the eigenvalues from 1 to 20 sel=saisir_random_select(size(DATA.d,1), round(DATA.d,1/3));%% 1/3 in validation [res]=saisir_pca_cross_ridge_regression(DATA,y,1:10,sel);%% testing the 10 first eigenvalues saisir_xy_plot(res.predy,10, res.obsy,1);%% display of the 10th model See also: saisir_pca_ridge_regression, saisir_ridge_regression, saisir_ridge_regression1, saisir_apply_ridge_regression nind=size(x.d,1); nend=sum(selected);Return to thematic list · HOME
function[ridgetype]=saisir_pca_ridge_regression(pcatype,y,range)Source: saisir_pca_ridge_regression.m
saisir_pca_ridge_regression - Basic ridge regression after PCA function[ridgetype]=saisir_pca_ridge_regression(pcatype,y,range) Flags pour la plateforme PULSAR --------------- Flag1 : PCA ridge regression Flag2 : pcatype, y, range Flag3 : ridgetype Flag4 : Model Input arguments =============== pcatype: structure, output argument of function "PCA" y: variable to be predicted (n x 1) range: MATLAB vector of positive integers (1 x k) Output arguments: ================ ridgetype with fields: beta: coefficients of the model (p x k), applicable on X krange: (1 X q) values of the coefficient k of ridge regressions averagex: average of original predictive variables (1 x p) averagey: average of y (1 x 1) rmsec: root mean square of validation (1 x q) predy: y predicted (n x q) corr: correlation coefficient (1 x q] between predicted and observed values The function calculates as many ridge regression models as the number of elements in "range" In ridge regression, the product X'X is replaced by X'X +kI. In the present function, k is in fact the eigenvalue of the corresponding PCA component for example, if krange = [1 3 5], that means that the tested values of k are the eigenvalues #1, #3, #5. The rationale of this, is that k in ridge_regression is very difficult to find it is a good idea to test a value in the range of the observed eigenvalues Typical example =============== Let DATA (n x p) be the SAISIR matrix of predictive variables and y (n x 1) the variable to be predicted. mypca=saisir_pca(DATA); % myrange=1:20 %% testing the eigenvalues from 1 to 20 res=saisir_pca_ridge_regression(mypca,y,myrange) saisir_xdisp(res.rmsec.d);%% displaying (for example) the errors See also saisir_ridge_regression, saisir_ridge_regression1, saisir_apply_ridge_regression, saisir_pca_cross_ridge_regression.Return to thematic list · HOME
function res=saisir_pca_stat(pca_type, col1, col2);Source: saisir_pca_stat.m
saisir_pca_stat - Gives some complementary statistics on PCA observations function res=saisir_pca_stat(pca_type, col1, col2); Flags pour la plateforme PULSAR --------------- Flag1 : PCA statistics Flag2 : pcatype, col1, col2 Flag3 : res Flag4 : Model Input argument : =============== pca_type: output argument of function "saisir_pca" col1, col2: number of the PC components of the PCA to be analyzed Ouput argument: =============== res: Saisir Matrix with 7 columns : QTL, col1 CO2col1, CTRcol1, col2, CO2col2, CTRCol2 QLT : squared cosinus with the plan (quality of the representation of the observations) CO2col1 and CO2col2 : squared cosinus of the angle between the observation and the axis We have QLT=CO2col1 + CO2col2 CTRcol1 and CTRcol2 : Contribution of the observation to the component. From G.Saporta, Probabilit�s analyse des donn�es et statistiques, Ed Technip, page 182 Typical example: p=saisir_pca(DATA); res=saisir_pca_stat(p,1,2);%% stats for components #1 and #2 saisir_saisir2excel(res,'pca results');%% to be looked at with ExcelReturn to thematic list · HOME
function createScoresFigure(obj, PCx, PCy, firstLetter, lastLetter)Source: saisir_pcaFigure.m
SAISIR(c) class_LARTIC 2024 - Classe pcaFigure
Flags pour la plateforme PULSAR
---------------
Flag1 : pcaFigure
Flag2 : val
Flag3 : None ( Plotting class )
Flag4 : Plot
Ce script décrit une classe Matlab nommee pcaFigure
Il permet de cree une variable d'un nouveau type dans le workspace, ce
type est celui d'une classe.
En programmation, il existe differents types simples de donnees : integer,
double, boolean, string, char etc...
le type classe est un type complexe et structuré. Complexe parce qu'il
contient d'autres types (simples) et des fonctions qui agissent sur
les donnees de la classe. Les donnees que la classe utilise sont
stockees dans des variables internes à la classe qu'on appelle des
"proprietes" ou property en anglais.
Les fonctions mises en oeuvre dans la classe sont appelees des
"méthodes", elles ne peuvent travailler que sur les proprietes de la
classe.
Au final, une classe est une sorte de conteneur de donnees et de
fonctions structurees de maniere claire et systematique.
Une classe doit toujours s'appuyee sur une classe existante, par
defaut on utilise une classe de base (ou classe ancetre). Dans le cas
du langage utilise dans Matlab, la classe de base est la classe
"handle"
le caractere "<" utilisé dans la definition de la classe indique que la classe pcaFigure herite de la classe ancetre handle.
pcaFigure reçoit donc dès le debut les proprietes et les methodes de la classe handle.
On dit que la classe pcaFigure herite du comportement de base definit dans la classe handle.
Objectifs de cette classe : afficher les resultats d'une ACP
automatiquement ainsi que le graphe appele scree-plot
Constructor :
Input arguments :
- val : structure contenant les resultats d'une ACP (scores, loadings, eigenvalues, average, info) - format saisir pcatype
- exemple : val.score.d , val.score.i , val.score.v
La classe pcaFigure contient les methodes suivantes :
function createScoresFigure(obj, PCx, PCy, firstLetter, lastLetter)
function createScreePlot(obj)Return to thematic list · HOMEfunction[res]=saisir_pcareconstruct(pcatype,score,maxdim)Source: saisir_pcareconstruct.m
saisir_pcareconstruct - reconstructs original data from a PCA model and a file of score function[res]=saisir_pcareconstruct(pcatype,score,nscore) Flags pour la plateforme PULSAR --------------- Flag1 : PCA reconstruct Flag2 : pcatype, score, maxdim Flag3 : res Flag4 : Model Input arguments: =============== pcatype: output argument of function"PCA" score: SAISIR matrix of scores (computed from the same pcatype model) maxdim: number of components involved in the reconstruction of the data Output argument: ================ res: SAISIR matrix of reconstructed data. The quality of the reoncstruction depends on the number of scores introduced (variable "maxdim"). From the previously computed scores, the function rebuilds the original data matrix.Return to thematic list · HOME
function [pcrtype]=saisir_pcr(X,y,maxdim)Source: saisir_pcr.m
saisir_pcr - PCR (components introduced in the order of eigenvalues) function [pcrtype]=saisir_pcr(X,y,maxdim) assesses a basic pcr model Flags pour la plateforme PULSAR --------------- Flag1 : PCR regression - order of eigenvalues Flag2 : x, y, maxdim Flag3 : pcrtype Flag4 : Model Input arguments --------------- X : SAISIR matrix (n x p y : SAISIR vector (n x 1) maxdim : maximal dimensions of the model (integer) Output arguments ---------------- pcrtype with fields pca: Structure giving the PCA results (see function "saisir_pca") beta: regression coefficients APPLICABLE ON THE PC SCORES (ndim x 1) predy: predicted y up to ndim dimensions (n x ndim) r2: determination coefficients between predicted and observed values (1 x ndim) averagey: mean of y (number) beta1:regression coefficients APPLICABLE ON THE X DATA centred (ndim x p) obsy: observed y (copy of input argument y) rmsec: root mean square error of calibration (n - dim -1) degrees f freedomReturn to thematic list · HOME
function [pcrtype]=saisir_pcr1(X,y,dim)Source: saisir_pcr1.m
saisir_pcr1 - Basic model of PCR (components introduced in the order of eigenvalues) function [pcrtype]=saisir_pcr1(X,y,dim) Flags pour la plateforme PULSAR --------------- Flag1 : PCR regression - order of eigenvalues Flag2 : x, y, dim Flag3 : res Flag4 : Model Input arguments: =============== X: SAISIR matrix (n x p) of predictive data y: SAISIR matrix (n x k) of variables to be predicted (k variables) dim: (integer) dimension of the model Output argument =============== pcrtype with fields: pca: result of pca applied on X (see function "saisir_pca") beta: coefficients of the models (p x k) obtained with "dim" dimensions averagex: average of x (1 x p) averagey: average of y (1 x k) info: 'predicting several y with xxx dimensions' r2: determination coefficient for the ys (1 x k) predy: predicted y (n x k). This function makes models for all the ys which are in "y" . The models are built only with "dim" dimensions. See also : saisir_pcr (only one y, but the dimensions are scanned),saisir_apply_pcrReturn to thematic list · HOME
function h = saisir_plot_ICADA(res, varargin)Source: ICA-DA/saisir_plot_ICADA.m
SAISIR_PLOT_ICADA Tableau de bord graphique d'un modele saisir_ICADA.
H = SAISIR_PLOT_ICADA(RES) exploite la structure renvoyee par
saisir_ICADA et affiche :
1. la carte des scores ICA ;
2. les signaux ICA ;
3. la matrice de confusion de validation croisee ;
4. le rapport de Fisher des composantes ;
5. les performances par classe ;
6. une synthese numerique du modele.
Parametres nom-valeur :
'Components' : deux IC pour la carte (defaut [1 2])
'SignalComponents' : IC a afficher comme signaux (defaut 1:4)
'Group' : groupes a utiliser pour la carte des scores
(defaut RES.groupIndex)
'ClassNames' : noms des classes (defaut RES.classNames)
'ShowLabels' : true, false ou 'auto' (defaut 'auto')
'MaxLabels' : maximum d'etiquettes en mode auto (defaut 40)
'ConfidenceEllipses' : ellipses a 95 %% (defaut true)
'MarkerSize' : taille des marqueurs (defaut 48)
'LineWidth' : epaisseur des signaux (defaut 1.5)
'Title' : titre general (defaut 'ICA-DA')
'XLabelSignals' : titre de l'axe spectral (defaut 'Variable')
'ReverseX' : inverser l'axe spectral (defaut false)
Exemple :
h = saisir_plot_ICADA(res,'Components',[1 3], ...
'SignalComponents',[1 2 3],'ReverseX',true);
Voir aussi saisir_ICADA
Flags pour la plateforme PULSAR
---------------
Flag1 : Display_ICA_Results
Flag2 : res, varargin
Flag3 : plot_ICADA
Flag4 : Plot
-------------------------------------------------------------------------
Controles et options
-------------------------------------------------------------------------Return to thematic list · HOMEfunction saisir_plotmatrix1(s,startpos,endpos,charsize)Source: saisir_plotmatrix1.m
saisir_plotmatrix1 - biplots of columns of matrices with colors function saisir_plotmatrix1(s,startpos,endpos,charsize) Flags pour la plateforme PULSAR --------------- Flag1 : Plot matrix of columns with colors Flag2 : s, startpos, endpos, charsize Flag3 : None (Plotting function) Flag4 : Plot Input arguments: =============== s: SAISIR matrix (n x p) startpos: (Integer) Starting position of the color scale endpos: (Integer) Ending position of the color scale charsize: (Integer) Size of the characters in the plot (optional, default: 8)Return to thematic list · HOME
function [plstype]=saisir_pls(X,Y,dim)Source: saisir_pls.m
saisir_pls - PLS regression with "dim" dimensions function [plstype]=saisir_pls(X,Y,dim) Flags pour la plateforme PULSAR --------------- Flag1 : PLS regression Flag2 : x, y, ndim Flag3 : plstype Flag4 : Model Input arguments =============== X: SAISIR matrix of predictive data (n x p) Y: SAISIR matrix of variables to be predicted (n x k) ndim: (integer) number of dimensions asked Ouput arguments =============== plstype with fields beta: regression coefficients of the model (p x k) beta0: intercept of the models (1 x k) predy: predicted values (n x k) T: PLS scores of the PLS2 regression model (n x ndim) correlation: correlation coefficient (1 x k) This function assesses a pls2 model Several variables can be predicted, but only ndim dimensions are tested Preferably uses saisir_basic_pls or saisir_basic_pls2 Typical example =============== Let DATA be dimensionned (n x p) Let Y be dimensionned (n x k) plstype=saisir_pls(DATA,Y,10); Assesses the models with 10 dimensions for the k variables in YReturn to thematic list · HOME
function[plsdatype] = saisir_plsda(mydata, ndim, firstLetter, lastLetter)Source: saisir_plsda.m
saisir_plsda - Pls discriminant analysis following the saisir format function[plsdatype]=saisir_plsda(mydata,ndim, firstLetter, lastLetter) Input arguments: =============== X : SAISIR matrix of predictive variables (n x p) ndim: number of dimensions in the PLS model firstLetter, lastLetter: positions of the char used to build samples groups from the names of samples. The results is recorded into group group: SAISIR (n x 1) vector of integers of groups. Observations with the same number in group belong to the same group (missing group not allowed) Flags pour la plateforme PULSAR --------------- Flag1 : PLS-DA Flag2 : mydata, ndim, firstLetter, lastLetter Flag3 : plsdatype Flag4 : Model Output arguments ================ plsdatype with fields beta :coeff for predicting the indicator matrix beta0 :intercept for predicting the indicator matrix t :PLS latent variable predy :predicted indicator matrix classed :predicted groups according to method #0 ncorrect :number of rightly classified samples according to method #0 (attribution to index of max of predicted Y) confusion :confusion matrix according to method #0 ncorrect1 :number of rightly classified samples according to method #1 (mahalanobis distance on latent variable t) confusion1 :confusion matrix according to method #1 tbeta :coeff for predicting the latent variables t tbeta0 :intercept for predicting the indicator matrix linear :linear form for direct prediction of group linear0 :%the min of x'*linear + linear0 gives the predicted group (this is equivalent with considering Mahalanobis distances) groups detectionReturn to thematic list · HOME
function [normSpectrum, quotients, medianQuotient] = saisir_pqn(refSpectrum, testSpectra, varargin)Source: saisir_pqn.m
saisir_pqn - Normalisation de données spectrales par quotient probabiliste (PQN) Flags pour la plateforme PULSAR --------------- Flag1 : PQN - Probabilistic Quotient Normalization Flag2 : refSpectrum, testSpectra Flag3 : normSpectrum, quotients, medianQuotient Flag4 : Correction Syntax: ======= [normSpectrum, quotients, medianQuotient] = saisir_pqn(refSpectrum, testSpectra, 'ShowPlot', true) Input arguments: ================ refSpectrum : Objet SAISIR (ou vecteur 1 x N) du spectre de référence testSpectra : Objet SAISIR (ou matrice M x N) des spectres à normaliser 'ShowPlot' : Logique (true/false) pour afficher l'histogramme des quotients (default: false) Output arguments: ================= normSpectrum : Objet SAISIR des spectres normalisés (M x N) quotients : Objet SAISIR des quotients calculés par variable (M x N) medianQuotient: Objet SAISIR des quotients médians par spectre (M x 1) References: =========== [1] F. Dieterle, A. Ross, G. Schlotterbeck, H. Senn, Anal. Chem. 78, 4281–4290 (2006). 1. Gestion et déballage des formats SAISIR (Extraction des matrices .d)Return to thematic list · HOME
function quaddis_type = saisir_quaddis(x, g)Source: saisir_quaddis.m
QUADDIS - Quadratic Discriminant Analysis (Training Phase)
Description:
============
Performs Quadratic Discriminant Analysis (QDA) calibration assuming a
multinormal distribution within each qualitative group.
Flags pour la plateforme PULSAR
---------------
Flag1 : quaddis
Flag2 : x, g
Flag3 : quaddis_type
Flag4 : Model
Input arguments:
================
x : SAISIR matrix structure (.d, .i, .v) of predictive variables (n x p).
g : SAISIR vector structure (.d, .i, .v) of true group labels (n x 1).
Output arguments:
=================
quaddis_type : Structure containing compliant SAISIR objects:
.ncorrect100 : Global classification success percentage (scalar).
.confus : Confusion matrix SAISIR object.
.mean : Group means SAISIR object.
.predgroup : Predicted groups SAISIR object.
.density : Pseudo-densities SAISIR object.
.proba : Group assignment probabilities SAISIR object.
.model : Internal calibration metrics (for saisir_apply_quaddis calculation).Return to thematic list · HOMEfunction [plstype]=saisir_quickpls(X,y,ndim)Source: saisir_quickpls.m
saisir_quickpls - Quick PLS regression from 1 to ndim dimensions function [plstype]=saisir_quickpls(X,y,ndim) Flags pour la plateforme PULSAR --------------- Flag1 : Quick PLS regression Flag2 : x, y, ndim Flag3 : plstype Flag4 : Model Input arguments: =============== X: SAISIR matrix (n x p) of predictive data y: SAISIR vector (n x 1) of variable to be predicted ndim: maximum dimensions of the model output argument: =============== plstype with fields: BETA: regression coefficient of the models (p x ndim) BETA0:intercept of the models (p x 1) PREDY: predicted y for all the models (n x ndim) T: PLS scores (n x ndim) RMSEC: root mean square error of calibration (1 x ndim) r2: r2 coefficient (1 x ndim) This function calculates the PLS models for 1 to ndim dimensions. All the models are kept The algorithm is not the NIPALS algorithm, but another one which is faster. This function makes use of function pls (normally in the directory "pls" see also: saisir_basic_pls, saisir_basic_pls2 (slower but giving more complete outputs)Return to thematic list · HOME
function[saisir]=saisir_random_saisir(nrow,ncol)Source: saisir_random_saisir.m
saisir_random_saisir - Creation of a random matrix function[X]=saisir_random_saisir(nrow,ncol) Flags pour la plateforme PULSAR --------------- Flag1 : Random Saisir matrix Flag2 : nrow, ncol Flag3 : saisir Flag4 : Tools Input arguments =============== nrow, ncol: integers (number of rows and columns of the resulting matrix) Output argument =============== X: matrix of random elements (nrow x ncol)Return to thematic list · HOME
function [selected] = saisir_random_select(nSel, nselect, (nrepeat))Source: saisir_random_select.m
SAIIR_RANDOM_SELECT - Building a vector of random elements 0 or 1
function [selected] = saisir_random_select(nSel, nselect, (nrepeat))
Flags pour la plateforme PULSAR
---------------
Flag1 : Random vector
Flag2 : nSel, nselect, nrepeat
Flag3 : selected
Flag4 : Tools
Input arguments:
================
nSel : (Integer) Total number of elements in the output vector "selected".
nselect : (Integer smaller than nSel) Number of elements taking the value 1.
nrepeat : (Integer, optional) Number of consecutive replicates. Organizes
the selection by blocks of 'nrepeat' groups.
Output arguments:
=================
selected : MATLAB row vector (1 x nSel) with elements equal to 1 or 0.
Description:
============
This function builds up a MATLAB vector of nSel elements with nselect
elements equal to 1 in random positions, and (nSel - nselect) equal to 0.
nrepeat (optional) randomly selects nselect values, but organized by block
of nrepeat groups. For example, if nrepeat = 3, a possible result is:
[0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 ...]
This function is useful for dividing a collection into two sets, for
example in many functions of SAISIR allowing a validation test.
The case with "nrepeat" defined corresponds to the situation in which the
replicates are in equal numbers and consecutive in the data collection.
DEPENDENCY:
===========
Requires the "Statistics and Machine Learning Toolbox" (for the 'random' function).
Typical use: randomly building a calibration and validation set
==============================================================
[n,p] = size(DATA.d);
sel = saisir_random_select(n, round(n/3)); %% A third in validation
cal = saisir_selectrow(DATA, sel==0); %% building the calibration set
val = saisir_selectrow(DATA, sel==1); %% building the validation set
See also: saisir_random_splitrowReturn to thematic list · HOMEfunction[saisir1,saisir2]=saisir_random_splitrow(saisir, nselect)Source: saisir_random_splitrow.m
saisir_random_splitrow - random selection of rows function[X1,X2]=saisir_random_splitrow(X, nselect) Flags pour la plateforme PULSAR --------------- Flag1 : Random selection of rows Flag2 : saisir, nselect Flag3 : saisir1, saisir2 Flag4 : Tools Input argument ============= X: SAISIR matrix (n x p) nselect: integer, less than p. Output arguments ================ X1, X2: SAISIR matrices of the resulting split This function randomly divides a matrix in two matrices: X1: with nselect rows, and X2 with n-nselect rows Typical use : building a calibration and a validation set ======================================================== [n,p]=size(DATA.d); [cal val]=saisir_random_splitrow(DATA, round(n*2/3));%% two third in calibration cal and val are respectively the calibration and validation setsReturn to thematic list · HOME
function X1=saisir_randomize(X)Source: saisir_randomize.m
saisir_randomize - Builds a file of randomly attributed vector in X1 function X1=saisir_randomize(X) Flags pour la plateforme PULSAR --------------- Flag1 : Randomize data Flag2 : s Flag3 : saisir Flag4 : Tools Input argument ============= X: SAISIR matrix (n x p) Output argument: X1: SAISIR matrix (n x p) with the rows randomly allocated This function randomly changes the rank (indices) of the observations. This useful for validation test, when comparing the results with the hazard.Return to thematic list · HOME
function fileInfo = saisir_read_eNoseFileInfo(filename, dataLines)Source: saisir_read_eNoseFileInfo.m
IMPORTFILE Import data from a text file
YO1000M2040 = IMPORTFILE(FILENAME) reads data from text file FILENAME
for the default selection. Returns the data as a cell array.
YO1000M2040 = IMPORTFILE(FILE, DATALINES) reads data for the
specified row interval(s) of text file FILENAME. Specify DATALINES as
a positive scalar integer or a N-by-2 array of positive scalar
integers for dis-contiguous row intervals.
Example:
Yo1000M2040 = importfile("/Users/lartic/Downloads/Projets_collaboratifs_du_departement/EF_INAF/Boisson_pois_M2/2022_05 _09/17_46_54/Unknown/Yo1000_M2_040.Her.asc", [1, 13]);
See also READTABLE.
Auto-generated by MATLAB on 21-Mar-2024 11:07:53
Flags pour la plateforme PULSAR
---------------
Flag1 : read_eNoseFileInfo
Flag2 : filename, dataLines
Flag3 : fileInfo
Flag4 : Tools
Input arguments:
===============
filename : the full path of the file to read
dataLines : the row interval(s) to read (optional, default is [1, Inf])
Output argument:
===============
fileInfo : a cell array containing the data read from the file
Input handling
If dataLines is not specified, define defaultsReturn to thematic list · HOMEfunction [ident, nident] = saisir_readident(filename, (namesize))Source: saisir_readident.m
SAISIR_@READIDENT - Loads a text file containing identifiers/strings
function [ident, nident] = saisir_readident(filename, (namesize))
Flags pour la plateforme PULSAR
---------------
Flag1 : READIDENT
Flag2 : filename, namesize
Flag3 : ident, nident
Flag4 : Tools
Input arguments:
================
filename : (String) File name or absolute path of the text file to read.
namesize : (Integer, optional) Maximum size of the strings to be truncated/padded.
If omitted, the function adapts to the longest string automatically.
Output arguments:
=================
ident : Matrix of characters (padded with spaces).
nident : Number of rows (identifiers) successfully read.
Description:
============
Loads an array of strings from a text file into a standard MATLAB char matrix.
If namesize is provided, strings are strictly constrained to that size.
If namesize is omitted, it dynamically fits the maximum length found in the file
to prevent any accidental data truncation.
1. Safety check on file existenceReturn to thematic list · HOMEfunction res=saisir_regression_score(x,beta,(y))Source: saisir_regression_score.m
saisir_regression_score - build a factorial space for regression function res=saisir_regression_score(x,beta,(y)) ------------------ Flags pour la plateforme PULSAR --------------- Flag1 : Regression score Flag2 : x, beta, y Flag3 : res Flag4 : Model Input arguments: =============== x : data matrix (n x p) beta : vector of regression coefficients (p x 1) y :(optional) known y value Output argument: =============== res with fields score : regression scores (also y split) reconstructed_norm2: squared norms of the scores cumulated_norm2: cumulated squared norms of the scores projector: matrix such as score=x*projector eigenvec_sum: sum of the eigenvectors of PCA (linked to the theory) xmean: mean of x r2 : if (y defined) r2 of the cumulated model Given a data matrix x and the regression coefficients beta, the function build up a matrix of orthogonal scores such as predicted y is equal to the sum of this scores The scores can be used to examine the observations "oriented" in the prediction of y. As the scores are ranked as a function of their ability to predict y, It is possible to examine the observations beginning by the first scores.Return to thematic list · HOME
function result = saisir_remove(sampleStruct, ToBeRemoved)Source: saisir_remove.m
SAISIR_REMOVE - Retire les lignes de la structure SAISIR dont les noms sont dans ToBeRemoved Syntaxe : result = saisir_remove(sampleStruct, ToBeRemoved) Entrées : sampleStruct : structure SAISIR avec les champs .d, .i, .v ToBeRemoved : cellule de chaînes à retirer (correspondant aux lignes de .i) Sortie : result : structure SAISIR nettoyée des lignes dont les noms sont dans ToBeRemoved Vérification des champs requisReturn to thematic list · HOME
function [B1 B2]=saisir_reorder(A1,A2)Source: saisir_reorder.m
saisir_reorder - reorders the data of files A1 and A2 according to their identifiers function [B1 B2]=saisir_reorder(A1,A2) Flags pour la plateforme PULSAR --------------- Flag1 : Reorder( identifiers ) Flag2 : s1, s2 Flag3 : saisir1, saisir2 Flag4 : Input arguments: =============== A1, A2: SAISIR matrices in which the rows have at least some identifiers in common Output arguments ================ B1, B2: reordered matrices. This function makes it possible to realign the rows of A1 and A2, in order to have the identifiers corresponding. This is necessary for any predictive method (particularly regressions). The function discards the observations which are not present in A1 and A2. The matrix B1 corresponds to A1 and matrix B2 to A2 Fails if A1 or A2 contains duplicate identifiers of rows. A2 is leader (B1 is as close as possible from the order of A2) Typical example: =============== Let X and y matrices to be reordered [X1, y1]=saisir_reorder(X,y); In X1 and y1 the rows have now the same identifiers (with possibly some lost of observations). If the function fails because some identifiers are in duplicates, use the function "saisir_check_name" to identifies these duplicated identifiers, and remove some of themReturn to thematic list · HOME
function str1=saisir_repeat_string(str,ntimes);Source: saisir_repeat_string.m
saisir_repeat_string - build a matricx of char by repeating a string
function str1=saisir_repeat_string(str,ntimes);
Flags pour la plateforme PULSAR
---------------
Flag1 : Repeat string
Flag2 : str, ntimes
Flag3 : str1
Flag4 : Tools
Input arguments:
===============
- str : a character string
- ntimes: number of repetition
Output argument:
================
- str1 the matrix of char with the repeated string.
example:
>> saisir_repeat_string('Vanessa',3)
ans =
Vanessa
Vanessa
Vanessa
Useful for building identifiers in SAISIR
See also: saisir_addcodeReturn to thematic list · HOMEfunction [EEMcorr,mask] = saisir_restore_EEM(EEM,Lex,correction)Source: Fluorescence/saisir_restore_EEM.m
RESTORE_EEM Reconstruction dosable des zones artificiellement supprimées d'une EEM EEM(:,1) : longueurs d'onde d'émission Lem EEM(:,2:end) : intensités de fluorescence Lex : longueurs d'onde d'excitation correction : intensité de la correction entre 0 et 1 Exemples : EEMcorr = restore_EEM(EEM,Lex,0.25); % correction légère EEMcorr = restore_EEM(EEM,Lex,0.50); % correction moyenne EEMcorr = restore_EEM(EEM,Lex,1.00); % correction complète Valeur par défautReturn to thematic list · HOME
function [ridgetype]=saisir_ridge_regression(X,y,krange)Source: saisir_ridge_regression.m
saisir_ridge_regression - Basic ridge regression function [ridgetype]=saisir_ridge_regression(X,y,krange) Flags pour la plateforme PULSAR --------------- Flag1 : Ridge regression Flag2 : x, y, krange Flag3 : ridgetype Flag4 : Model Input arguments: =============== X: SAISIR matrix of predictive variables (n x p) y: SAISIR vector of observed y (n x 1) krange: MATLAB vector of k-values to be tested in the ridge regression Let ntest = length(krange) Output argument: =============== ridgetype with fields beta: beta coefficients associated with th ntest k-values as defined in "krange" averagex: average of X averagey: average of y rmsec: Root mean square error of calibration (ntest x 1 ) predy: predicted y for each test k-value (n x ntest) r2: r2 for each tested k-value (ntest x 1); return as many beta as the number of elements in krangeReturn to thematic list · HOME
function [ridgetype] = saisir_ridge_regression1(x, y, normrange)Source: saisir_ridge_regression1.m
saisir_ridge_regression1 - Régression Ridge basée sur la norme ciblée de Beta Flags pour la plateforme PULSAR --------------- Flag1 : Ridge Regression - Norm Targeting Flag2 : x, y, normrange Flag3 : ridgetype Flag4 : Model Syntax: ======= [ridgetype] = saisir_ridge_regression1(x, y, normrange) Input arguments: ================ x : Objet SAISIR des variables prédictives (n échantillons x p variables) y : Objet SAISIR de la variable observée à prédire (n échantillons x 1) normrange : Vecteur MATLAB des normes de beta à tester (1 x ntest) Output argument: ================ ridgetype : Structure contenant des objets SAISIR imbriqués : .beta : Objet SAISIR des coefficients (p variables x ntest) .predy : Objet SAISIR des y prédits (n échantillons x ntest) .rmsec : Objet SAISIR du Root Mean Square Error (ntest x 1) .r2 : Objet SAISIR des coefficients R² (ntest x 1) .k : Objet SAISIR des valeurs de ridge k calculées (ntest x 1) .expected_norm : Vecteur MATLAB des normes cibles (ntest x 1) .averagex : Moyenne de X (1 x p) .averagey : Moyenne de y (scalaire) See also: saisir_ridge_regressionReturn to thematic list · HOME
function [plsmodel, X_clean, Y_clean, outlier_names] = saisir_robust_pls(Xsaisir, Ysaisir, ncomp, alpha)Source: saisir_robust_pls.m
SAISIR_ROBUST_PLS - Régression PLS robuste sur structures SAISIR Syntaxe : [plsmodel, X_clean, Y_clean, outlier_names] = saisir_robust_pls(Xsaisir, Ysaisir, ncomp, alpha) Flags pour la plateforme PULSAR --------------- Flag1 : Robust_PLS Flag2 : Xsaisir, Ysaisir, ncomp, alpha Flag3 : plsmodel, X_clean, Y_clean, outlier_names Flag4 : Model Inputs arguments: : Xsaisir : structure SAISIR des prédicteurs Ysaisir : structure SAISIR des réponses ncomp : nombre max de composantes PLS à tester alpha : seuil (ex : 0.975) pour la détection des outliers Sorties : plsmodel : struct contenant les résultats PLS + prédictions .PREDY et R² X_clean : structure SAISIR nettoyée des X Y_clean : structure SAISIR nettoyée des Y outlier_names : noms des individus retirés Vérification de cohérenceReturn to thematic list · HOME
function [X] = saisir_row_center(X1)Source: saisir_row_center.m
saisir_row_center - subtracts the average row to each row function [X] = saisir_row_center(X1) Flags pour la plateforme PULSAR --------------- Flag1 : Row centering Flag2 : saisir1 Flag3 : saisir Flag4 : CorrectionReturn to thematic list · HOME
function rv = saisir_rv(X, Y)Source: saisir_rv.m
Calcule le coefficient RV entre deux structures saisir X et Y Les champs X.d et Y.d doivent être numériques, centrés, avec mêmes lignes VérificationsReturn to thematic list · HOME
function saisir_saisir2ascii(X,filename,separator)Source: saisir_saisir2ascii.m
saisir_saisir2ascii - Saves a saisir file into a simple ASCII format function saisir_saisir2ascii(X,filename,separator) Flags pour la plateforme PULSAR --------------- Flag1 : Saisir2Ascii Flag2 : saisir, filename, separator Flag3 : none ( File ) Flag4 : Tools Input arguments =============== X: SAISIR matrix to be saved filename: (string) name of the saved file separator:(string with a single char) separator character Output argument =============== none Transform a saisir file into a simple .txt file and save it on disk separator is a single character like ' ' or ';' or its ASCII code; The extension '.txt' is added to the filename Typical example: =============== saisir_saisir2ascii(data,'mydata',';'); Saves the SAISIR matrix "data", under the name "data.txt", with ";" as separatorReturn to thematic list · HOME
function saisir_saisir2excel(X,filename)Source: saisir_saisir2excel.m
saisir_saisir2excel - Saves a saisir file in a format compatible with Excel function saisir_saisir2excel(X,filename) Flags pour la plateforme PULSAR --------------- Flag1 : Saisir2Excel Flag2 : saisir, filename Flag3 : none ( File ) Flag4 : Tools Input arguments =============== X: SAISIR matrix to be saved filename: (string) name of the saved file Output argument =============== none Transformq a saisir file into a simple .CSV file and save it on disk The separator is ";" The extension '.csv' is added to the filename Typical example: =============== saisir_saisir2excel(data,'mydata'); Saves the SAISIR matrix "data", under the name "data.csv", with ";" as separator This file is read by ExcelReturn to thematic list · HOME
function T = saisir_saisir2table(mydata)Source: saisir_saisir2table.m
SAISIR(c) function_LARTIC 2024 function T = saisir_saisir2table(mydata) Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2024 This function creates a Matlab table object from a SAISIR strcture See also : saisir_table2saisir function that makes the inverse process Flags pour la plateforme PULSAR --------------- Flag1 : Saisir2Table Flag2 : mydata Flag3 : T Flag4 : Tools INPUT mydata : data SAISIR structure OUTPUT T : a Matlab table object Example of use: T = saisir_saisir2table(mydata); T.Properties T.Properties.VariableNames download SAISIR package at : https://lartic.fsaa.ulaval.ca/chimiometrie/enseignement-saisirReturn to thematic list · HOME
function index = saisir_seekstring(x, str1)Source: saisir_seekstring.m
SEEKSTRING - Finds row indices containing a specific substring
Flags pour la plateforme PULSAR
---------------
Flag1 : SeekString
Flag2 : x, str1
Flag3 : index
Flag4 : Tools
Description:
============
Returns a vector containing the row indices of a character matrix or
a cell array of strings 'x' where the substring 'str1' is present.
Input arguments:
================
x : Character matrix (n x p) or cell array of strings containing text to search.
str1 : String or character vector (1 x k) representing the substring to search for.
Output argument:
================
index : Row vector of integers containing the indices of rows in 'x'
where 'str1' was found. Returns empty [] if no match is found.
Typical example:
================
matching_rows = saisir_seekstring(DATA.i, 'target_name');
1. Clean and trim input search string (removes leading and trailing whitespaces)Return to thematic list · HOMEfunction [X1] = saisir_select_from_identifier(X,startpos,str)Source: saisir_select_from_identifier.m
saisir_select_from_identifier - Uses identifier of rows for selecting samples
function [X1] = saisir_select_from_identifier(X,startpos,str)
Flags pour la plateforme PULSAR
---------------
Flag1 : Select from identifier
Flag2 : saisir, startpos, str
Flag3 : saisir1
Flag4 : VarSel
Input arguments:
===============
X : SAISIR matrix
startpos : beginning position in the character strings of the identifiers
of rows ('.i')
str: string which is used as selection key.
Output argument:
===============
X1 : SAISIR matrix of the selected rows
Creates the data collection "X1" which is the subset of "X"
the identifiers of which contain the string str, in starting position startpos
%Example :
%========
%Let X be a SAISIR matrix
%Let X.i being
%'wheat1'
%'barle2'
%'ricex1'
%'wheat2'
%The 'wheat' samples are extracted through
mywheat= saisir_select_from_identifier(X,1,'wheat');
This select the rows with identifiers 'wheat1' and 'wheat2'Return to thematic list · HOMEfunction [X1] = saisir_select_from_variable(X,startpos,str)Source: saisir_select_from_variable.m
saisir_select_from_variable - use identifier of columns for selecting variables
function [X1] = saisir_select_from_variable(X,startpos,str)
Flags pour la plateforme PULSAR
---------------
Flag1 : Select from variable
Flag2 : saisir, startpos, str
Flag3 : saisir1
Flag4 : VarSel
Input arguments:
===============
X : SAISIR matrix
startpos : beginning position in the character strings of the identifiers
of columns ('.v')
str: string which is used as selection key.
Output argument:
===============
X1 : SAISIR matrix of the selected columns
Creates the data collection "X1" which is the subset of "X"
the variable identifiers of which contain the string str, in starting position startpos
are selected
see also : saisir_select_from_identifierReturn to thematic list · HOMEfunction [X] = saisir_selectcol(X1,index)Source: saisir_selectcol.m
saisir_selectcol - creates a new data matrix with the selected columns function [X] = saisir_selectcol(X1,index) Flags pour la plateforme PULSAR --------------- Flag1 : Select columns Flag2 : saisir1, index Flag3 : saisir Flag4 : VarSel Input arguments =============== X1: SAISIR matrix (n x p) Index: vector of integer or of booleans Output argument =============== X: matrix with n rows reduced to the selected variables %Typical example: %=============== reduced=saisir_selectcol(DATA,[1 5 6]); %% selects the columns #1, #5, #6 and builds the reduced matrix (with 3 columns) in "reduced" %See also: saisir_selectrow, saisir_deletecol, saisir_deleterow, saisir_appendcol, saisir_appendrow, saisir_appendcol1, saisir_appendrow1 on commence par recopier tous les champs dans la nouvelle structureReturn to thematic list · HOME
function results = saisir_selective_pca(mydata, startPos, endPos, varargin)Source: saisir_selective_pca.m
SAISIR(c) function_LARTIC 2025 - PCA SAISIR après SNV + sélection automatique de variables spectrales discriminantes PCA SAISIR après SNV + sélection automatique de variables IR discriminantes Groupes : mygroups = saisir_create_group1(mydata, startPos, endPos); indices dans mygroups.d USAGE : R = saisir_selective_pca(mydata, 1, 3, 'nTop', 40, 'alpha', 0.01); ---------- Options ----------Return to thematic list · HOME
function [X] = saisir_selectrow(X1,index)Source: saisir_selectrow.m
saisir_selectrow - creates a new data matrix with the selected rows function [X] = saisir_selectrow(X1,index) Flags pour la plateforme PULSAR --------------- Flag1 : Select rows Flag2 : saisir1, index Flag3 : saisir Flag4 : VarSel Input arguments =============== X1: SAISIR matrix (n x p) Index: vector of integer or of booleans Output argument =============== X: matrix with n columns reduced to the selected rows %Typical example: %=============== reduced=saisir_selectrow(DATA,[1 5 6]); %% selects the rows #1, #5, #6 and builds the reduced matrix (with 3 rows) in "reduced" See also: saisir_selectcol, saisir_deletecol, saisir_deleterow, saisir_appendcol, saisir_appendrow, saisir_appendcol1, saisir_appendrow1 on commence par recopier tous les champs dans la nouvelle structureReturn to thematic list · HOME
function h = saisir_sensory_profile(X, range, max_score, xtitle)Source: saisir_sensory_profile.m
SENSORY_PROFILE - Modern graphical representation of sensory profiles (Spider / Radar plot) h = saisir_sensory_profile(X, range, max_score, xtitle) Flags pour la plateforme PULSAR --------------- Flag1 : SENSORY_PROFILE Flag2 : X, range, max_score, xtitle Flag3 : h Flag4 : Plot Input arguments: ================ X : Valid SAISIR matrix structure (.d, .i, .v) range : Vector of indices of the rows (samples/judges) to be displayed max_score : Maximal score used in the scale (axis limits) xtitle : (Optional) Title of the graph Output arguments: ================= h : Vector of graphics handles associated with the profiles (lines) --- 1. Control of Input Arguments ---Return to thematic list · HOME
function [B,G] = saisir_sgolaycoef(k,F)Source: saisir_sgolaycoef.m
saisir_sgolaycoef - Computes the Savitsky-Golay coefficients function [B,G] = saisir_sgolaycoef(k,F) Flags pour la plateforme PULSAR --------------- Flag1 : Savitsky-Golay coefficients Flag2 : k, F Flag3 : B, G Flag4 : Tools where the polynomial order is K and the frame size is F (an odd number) No direct useReturn to thematic list · HOME
function handle=saisir_show_vector(X, (nrow) ,(csize),(xlab),(ylab),(title))Source: saisir_show_vector.m
saisir_show_vector - represents a row of a matrix as a succession identifiers function handle=saisir_show_vector(X, (nrow) ,(csize),(xlab),(ylab),(title)) Flags pour la plateforme PULSAR --------------- Flag1 : Show vector Flag2 : s, nligne, csize, xlab, ylab, titre Flag3 : h Flag4 : Plot Input arguments =============== X: SAISIR matrix (n x p) nrow: index of the row to be displayed (integer less than n, default : 1) csize: size of the character (default : 10) xlab, ylab, title: label on axis X, axis Y, title , respectively (default: none The identifiers of the columns are plotted with X being the index of the variable and Y the actual value of the variable for the selected row "nrow" Main use : examining the output of "saisir_anavar1" and "saisir_anovan1" functions on discrete variablesReturn to thematic list · HOME
function [beta beta0]=saisir_simple_regression(X,y);Source: saisir_simple_regression.m
saisir_simple_regression - mono_linear regressions function [beta beta0]=saisir_simple_regression(X,y); Flags pour la plateforme PULSAR --------------- Flag1 : Simple regression Flag2 : X, y Flag3 : beta, beta0 Flag4 : Model Input arguments =============== X:SAISIR matrix of predictive variables (n x p) y:SAISIR vector of the variable to be predicted (n x 1) Ouput arguments =============== beta:SAISIR vector of the regression coefficients (1 x p) beta0:SAISIR vector of the intercepts (1 x p) y is predicted by each column i of X according to ypred=X.d(:,i)*beta.d(i)+beta0.d(i); There are thus as many mono-linear models as the number of columns in XReturn to thematic list · HOME
function [X1] = saisir_snv(X)Source: saisir_snv.m
SAISIR(c)_function_LARTIC - snv(mydata) - Standard normal variate correction on spectra function [X1] = saisir_snv(X) Flags pour la plateforme PULSAR --------------- Flag1 : SNV Flag2 : mydata Flag3 : saisir Flag4 : Correction Input argument: ============== X:SAISIR matrix of spectra (n x p) Output argument: ============== X1:SAISIR matrix of SNV-corrected spectra (n x p) SNV (Standard Normal Variate)is commonly used in spectroscopy. It basically consists in centering and standardizing the ROWS (not the columns) of the data matrix. This procedure may reduce the scatter deformation of spectra. on commence par recopier tous les champs dans la nouvelle structureReturn to thematic list · HOME
function s1 = saisir_sort(s, col, minmax)Source: saisir_sort.m
SAISIR_SORT - Sorts the rows of a SAISIR matrix according to a specific column s1 = saisir_sort(s, col, minmax) Flags pour la plateforme PULSAR --------------- Flag1 : SAISIR_SORT Flag2 : s, col, minmax Flag3 : s1 Flag4 : Tools Input arguments: ================ s : Valid SAISIR structure containing fields .d, .i, .v col : (Integer) Index of the column on which the data rows are sorted minmax : 0 for increasing/ascending order (default), 1 for decreasing/descending order Output arguments: ================= s1 : SAISIR matrix sorted according to the column "col" --- 1. Control of Input Arguments ---Return to thematic list · HOME
function [spcrtype]=saisir_spcr(X,y,maxdim, (maxrank)(corr_cov))Source: saisir_spcr.m
saisir_spcr - stepwise Principal component regression function [spcrtype]=saisir_spcr(X,y,maxdim, (maxrank)(corr_cov)) The PC scores are introduced in the order of their regression coefficient or their covariance with y Flags pour la plateforme PULSAR --------------- Flag1 : Stepwise PCR Flag2 : x, y, maxdim, maxrank, corr_cov Flag3 : spcrtype Flag4 : Model Input arguments: =============== X : SAISIR matrix of predictive variables (n x p) y : SAISIR vector of observed y maxdim: (integer): naximum number of PC scores introduced in the regression model maxrank: (optional,integer): rank maximal of the PC score in the model Default value: all components possibly introduced. corr_cov : 1 introduction according to correlation coeff (corr_cov=1,default); or : 0 introduction according to covariance Ouput arguments: =============== spcrtype with fields pca: PCA structure (see function "saisir_pca") beta: beta coefficients (applicable on PC scores) selected_component: rank of the scores introduced in the model predy: predicted y values for all the steps of spcr r2: r2 for all the steps of spcr averagey: average value of y beta1: beta coefficients (applicable on X centred) obsy: observed y, copy of input argument y. rmsec: root mean square error of calibration for all the modelsReturn to thematic list · HOME
function res=saisir_split_average(X,startpos,endpos)Source: saisir_split_average.m
saisir_split_average - averages observations according to the identifiers
function res=saisir_split_average(X,startpos,endpos)
Flags pour la plateforme PULSAR
---------------
Flag1 : Split average
Flag2 : s, startpos, endpos
Flag3 : average_type
Flag4 : Tools
Input arguments:
===============
X:SAISIR matrix (n x p)
startpos, endpos: position in the row-identifier strings (".i")
Output argument:
===============
res with fieldss:
average: averages of the identified groups (p columns)
group: number of observations in each group.
The function extracts the characters in the row identifiers from "startpos"
to "endpos" and makes as many groups as the number of different strings
The observations are averaged according to these groupsReturn to thematic list · HOMEfunction [X1, X2]= saisir_splitrow(X,index)Source: saisir_splitrow.m
saisir_splitrow - splits a data matrix into 2 resulting matrices function [X1, X2]= saisir_splitrow(X,index) Flags pour la plateforme PULSAR --------------- Flag1 : Split row Flag2 : saisir, index Flag3 : saisir1, saisir2 Flag4 : Tools Input arguments =============== X:SAISIR matrix (n x p) index: MATLAB vector with k elements equal to 1 and n-k elements equal to 0 Output arguments =============== X1:SAISIR matrix (k x p) X2:SAISIR matrix ((n-k) x p) Divides X into two matrices X1 and X2 the first one correspond to kept rows (according to index = 1, or "true") the second one is the complement (index = 0, or "false") index is either indices of the rows (integers) or boolean. Typical example (division of DATA into a calibration and a validation sets): =============== [n,p]=size(DATA.d); sel=saisir_random_select(n,round(n/3));%% buiding a random vector of 0 and 1 [validation_set calibration_set]=saisir_splitrow(DATA,sel);%%creation of a calibration and validation set.Return to thematic list · HOME
function [saisir, xstd] = saisir_standardize(mydata,(mode))Source: saisir_standardize.m
SAISIR(c) function_LARTIC 2024_ saisir_standardize()remplace les NaN par la moyenne de colonne puis divise chaque colonne par son écart-type
function [saisir, xstd] = saisir_standardize(mydata,(mode))
Flags pour la plateforme PULSAR
---------------
Flag1 : standardize
Flag2 : mydata, mode
Flag3 : saisir, xstd
Flag4 : Correction
Input arguments
===============
mydata : matrice SAISIR (n x p)
mode : 0 -> normalisation par (n-1)
1 -> normalisation par n (défaut : 1)
Output arguments
================
saisir : matrice SAISIR (n x p) standardisée
xstd : vecteur SAISIR (1 x p) des écarts-types de colonnes,
calculés APRÈS imputation des NaN par la moyenne.Return to thematic list · HOMEfunction res=saisir_statis(collection);Source: saisir_statis.m
saisir_statis - Multiway method STATIS
function res=saisir_statis(collection);
Flags pour la plateforme PULSAR
---------------
Flag1 : STATIS
Flag2 : collection
Flag3 : res
Flag4 : Model
Input arguments
===============
collection:array of SAISIR matrices with the same number of rows (n)
Output arguments
================
Let n be the number of observations, and t the number of tables
the field of the outpout argument res are:
RV: [1x1 struct] matrix t x t of the RV value indicating the agreement
between the table (max value = 1)
eigenval1: [1x1 struct] first eigenvalue of the RV matrix
eigenvec1: [1x1 struct] first eigenvector of the RV matrix (t x 1) . Indicates the
weight associated with each table
-Wk: {1xt cell} cell of n x n array giving the scalar products between observations
-W_compromise n x n array giving the compromise of the array WK
eigenval2: [1x1 struct] r eigenvalues of W_compromise, with r the rank of
W_compromise.
score: [1x1 struct] (n x r ) Scores of the compromise of the observations. Can be
represented as factorial map
trajectory: [1x1 struct] (n*t x r) Projection of each row vector of each table in the space of observation_score
group: [1x1 struct] (n*t x 1) table giving the belonging of a given
row_vector to a table
table_score: [1x1 struct] (t x r) scores of the tables obtained from
diagonalisation of RV.
table_eigenval: [1x1 struct] (r x 1) eigenvalues of RV . The first one
is the same as eigenval1
The STATIS method is described in "C.Lavit, Analyse conjointe de tableaux qualitatif, Masson pub, 1988."
Basically the method attempts to establish a factorial compromise between table having
the same number of observations.
col is an ARRAY OF CELLS containing all the 2-D data tables (SAISIR format).
Each table must include the same observations, but not necessarily the same variables.
group is useful with the command 'carte_barycentre'
For example, a command such as "carte_barycentre(res.trajectory,2,3, res.group)" will produce the representation of
the row vector of each table for the score 2 and 3. The representation shows the compromise point and its link
to each vector of the tables.
"collection" is built up with commands like:
collection(1)=DATA1; collection(2)=DATA2; ...: collection(k)=DATA(K);
Warning ! Such commands work only if DATA are .d, .i, .v structures IN
THAT ORDER, with NO OTHER FIELDS. Otherwise, MATLAB refuses to build the
vector of SAISIR structure. Possibly use "saisir_check" for verifying this
point.
Version 17 august 2003Return to thematic list · HOMEfunction statsTable = saisir_stats_descriptives(SAISIR)Source: saisir_stats_descriptives.m
SAISIR(c) function_LARTIC 2025 SAISIR_STATS_DESCRIPTIVES Calcule les statistiques descriptives de base pour chaque variable dans la structure SAISIR (champ .d) INPUTS SAISIR: stucture de donnees SAISIR OUTPUT statsTable: variable de type table dont les intitulés de colonnes sont 'Mean', 'STD', 'CV', 'Min', 'Max' Vérification des champs requisReturn to thematic list · HOME
function[st]=saisir_std(saisir)Source: saisir_std.m
saisir_std - computes the standard_deviations of the columns, following the saisir format function[xstd]=saisir_std(X) Flags pour la plateforme PULSAR --------------- Flag1 : standard_deviation Flag2 : saisir Flag3 : st Flag4 : Correction Input argument ============== X: SAISIR matrix (n x p) Ouput argument ============== xstd: SAISIR vector (1 x p) of the standard deviationReturn to thematic list · HOME
function step_models = saisir_stepwise_regression(x, y, Pthres, confidence)Source: saisir_stepwise_regression.m
STEPWISE_REGRESSION - Forward/Backward Stepwise Linear Regression for SAISIR objects step_models = saisir_stepwise_regression(x, y, Pthres, confidence) Flags pour la plateforme PULSAR --------------- Flag1 : STEPWISE_REGRESSION Flag2 : x, y, Pthres, confidence Flag3 : step_models Flag4 : Model Input arguments: ================ x : SAISIR matrix of predictive data (nP x mP) y : SAISIR vector of the variable to be predicted (nP x 1) Pthres : Probability threshold (p-value) for entering or discarding a variable confidence : (Optional) Confidence interval threshold for coefficients (default = 0.05) Output argument: ================ step_models : Cell array where each cell contains a structural report of that step --- 1. Control of Input Arguments & Formats ---Return to thematic list · HOME
function [saisir] = saisir_string2saisir(data)Source: saisir_string2saisir.m
saisir_string2saisir - creation of a saisir file from a string table (first column=name) function [saisir] = saisir_string2saisir(data) Flags pour la plateforme PULSAR --------------- Flag1 : String to SAISIR Flag2 : data Flag3 : saisir Flag4 : Tools Input arguments: =============== data: 3 way matrix of character obtained by procedure readexcel1 Ouput argument: saisir: saisir struct with the data contained in data NORMALLY NO DIRECT USE creation of a saisir file from a string table obtained by procedure readexcel1 A DOS file which have been read from readexcel1 is a 3 way matrix of character under the form data(row,pos,col). For example, data(5,:,12) contains the string in row 5 and column 12. In the particular case of acceptable data for saisir transformation, the data format must be the following: 1) the first row data(1,:,:) must contain the identifier of variables (column) warning: for matrix presentation of the data, the string data(1,:,1) is of no use and is skipped by the program. 2) the first column(:,:,1) must contain the identifier of observations (rows) 3) the other lines and columns contains string which can be converted in number (or whitespace) such format is normally obtained by using readexcel1 (excel data saved as .csv) If the original excel file was not appropriate, it is possible that several columns contain string which could not be transformed in number (or white space). in this situation, it is possible to remove the undesired column using data(:,:,col)=[]; where col is the index of the column to be removed Note that the whitespace are replaced by NAN valuesReturn to thematic list · HOME
function saisir_string2text(str,filename)Source: saisir_string2text.m
saisir_string2text - save a vector of string in a .txt format function saisir_string2text(str,filename) Flags pour la plateforme PULSAR --------------- Flag1 : String to text Flag2 : str, filename Flag3 : None Flag4 : Tools Input argument ============== str:matrix of characters filename:string (vector of characters) Output argument ============== None This function saves a succession of strings (in a matrix of char) under the name "filename". The extension ".TXT" is added to the file nameReturn to thematic list · HOME
function saisir_submap(X,col1,col2,xstring,(col1label),(col2label),(title),(charsize),(marg))Source: saisir_submap.m
saisir_submap - partial display of observations function saisir_submap(X,col1,col2,xstring,(col1label),(col2label),(title),(charsize),(marg)) The scale of the COMPLETE map is used. Flags pour la plateforme PULSAR --------------- Flag1 : Submap Flag2 : s, col1, col2, xstring, labcol1, labcol2, titre, charsize, marg Flag3 : None(Plotting function) Flag4 : Plot Input arguments: =============== X: SAISIR matrix col1, col2 : index of the two columns to be represented (integer values) xstring : string in the names of identifiers which must be displayed col1label (optional): Label of the variable forming the X-axis col2label (optional): Label of the variable forming the Y-axis title (optional) : title of the graph charsize (optional) : size of the plotted characters marg (optional) : margin value allowing an extension of the axis in order to cope with long identifiers (default value: 0.05) example: Let X be a SAISIR matrix Let X.i being 'wheat1' 'barle2' 'ricex1' 'wheat2' 'barle3' ... The command "saisir_submap(X,5,3,'wh')" will plot the column 5 as X and 3 as Y Only the observations containing 'wh' in there names are displayed, but the general axis-scales are the one for the whole collection. Useful for emphasizing some groups in a complex plot.Return to thematic list · HOME
function [X1] = saisir_subtract_variable(X,ncol)Source: saisir_subtract_variable.m
saisir_subtract_variable - subtract a given variable to all the others function [X1] = saisir_subtract_variable(X,ncol) Flags pour la plateforme PULSAR --------------- Flag1 : Subtract variable Flag2 : saisir1, ncol Flag3 : saisir Flag4 : Tools Input arguments =============== X:SAISIR matrix ncol: (integer) column chosen for the subtraction Output argument ============== X1: SAISIR matrix in which the variable has been subtracted Subtracts the variable of indice ncol to each other variables of the observations Useful for correcting an y-shift of spectral data.Return to thematic list · HOME
function xsum=saisir_sum(X);Source: saisir_sum.m
saisir_sum - calculates the sum of the rows function xsum=saisir_sum(X); Flags pour la plateforme PULSAR --------------- Flag1 : Sum Flag2 : x Flag3 : som Flag4 : Tools Input argument ============== X: SAISIR matrix (n x p) Ouput argument ============== xsum: SAISIR vector (1 x p) of the sum of the rowsReturn to thematic list · HOME
function [zmin, zmax]=saisir_surface1(X)Source: saisir_surface1.m
saisir_surface1 - Represent a surface in three dimensions function [zmin, zmax]=saisir_surface1(X) Flags pour la plateforme PULSAR --------------- Flag1 : Surface1 3D Flag2 : saisir Flag3 : zmin, zmax Flag4 : Plot Input argument: ============== X:SAISIR matrix Output arguments: ================ zmin, zmax: max and min values in X.d new version 6/10/2006Return to thematic list · HOME
function [X1] = saisir_surface_std(X,(threshold))Source: saisir_surface_std.m
saisir_surface_std - divide each row by the sum of its corresponding columns function [X1] = saisir_surface_std(X,(threshold)) Flags pour la plateforme PULSAR --------------- Flag1 : Surface standardization Flag2 : saisir1, threshold Flag3 : saisir Flag4 : Correction Input arguments =============== X:SAISIR matrix Threshold: (small) positive or zero value If the sum is equal to 0, the elements of the corresponding row are set to 0. If threshold defined threshold (normally very small value) is added to data Only useful for avoiding "division by zero" warning Ouput argument =============== X1:corrected matrix The function assesses the sum of each row . Each value of each row is divided by the corresponding sum. In chromatography, this corresponds to giving the same surface to all the chromatograms. See also: saisir_snvReturn to thematic list · HOME
function [pcatype]=saisir_svd_pca(saisir)Source: saisir_svd_pca.m
saisir_svd_pca - NOT CENTERED Principal component analysis on raw data Flags pour la plateforme PULSAR --------------- Flag1 : PCA SVD Flag2 : saisir Flag3 : pcatype Flag4 : Model function [pcatype]=saisir_svd_pca(saisir) Assesses principal component analysis (on not normalised and NOT CENTERED data) Using the singular value decomposition (SVD) algorithm pcatype is a struct containing scores (coordinates) eigenvec :eigenvectors (loadings) eigenvec1 : egenvec normalized (laoding) eigenval :eigenvalues score : scores of observations score1 : scores of observations normalized NOTA: The weight of observations are equal to 1Return to thematic list · HOME
function saisir_symbol_map(HdlGraph, s,col1,col2,startpos,endpos,labcol1,labcol2,titre,charsize)Source: saisir_symbol_map.m
saisir_symbol_map - map with symbols : using a portion of the identifiers for
saisir_symbol_map(X,col1,col2,startpos,endpos,(col1label),(col2label),(title),(charsize))
Flags pour la plateforme PULSAR
---------------
Flag1 : Symbol map
Flag2 : HdlGraph, s, col1, col2, startpos, endpos, labcol1, labcol2, titre, charsize
Flag3 : None(Plotting function)
Flag4 : Plot
Input arguments:
===============
HdlGraph: handle of the graph to be plotted
s: SAISIR matrix
col1, col2 : index of the two columns to be represented (integer values)
startpos, endpos: position in the identifier strings of rows ('.i') for
the coloration
col1label (optional): Label of the variable forming the X-axis
col2label (optional): Label of the variable forming the Y-axis
title (optional) : title of the graph
charsize (optional) : size of the plotted characters
For the French users: there is a synonym function "carte_symbole".
Use preferably "saisir_symbol_map"
The coloration of the displayed descriptors depends on the arguments
startpos and endpos.
From the names of individual, the string name(sartpos:endpos) is extracted. Two observations
for which these strings are different, are represented with different symbols.
example:
Let X be a SAISIR matrix
Let X.i being
'wheat1'
'barle2'
'ricex1'
'wheat2'
'barle3'
...
The command 'saisir_symbol_map(X,5,3,1,5)' will plot the column 5 as X, 3, as Y
The characters are extracted from 1 to 5 , that is strings 'wheat', 'barley',
'ricex'.A different symbol will be given for each of this strings.
See also saisir_colored_map1, saisir_colored_map2 (same principle but with the
identifier name displayed)Return to thematic list · HOMEfunction saisir_symbol_map3D(s,col1,col2,col3,startpos,endpos,labcol1,labcol2,titre,charsize)Source: saisir_symbol_map3D.m
saisir_symbol_map - map with symbols : using a portion of the identifiers for
saisir_symbol_map(X,col1,col2,startpos,endpos,(col1label),(col2label),(title),(charsize))
Flags pour la plateforme PULSAR
---------------
Flag1 : Symbol map 3D
Flag2 : s, col1, col2, col3, startpos, endpos, labcol1, labcol2, titre, charsize
Flag3 : None(Plotting function)
Flag4 : Plot
Input arguments:
===============
X: SAISIR matrix
col1, col2, col3 : index of the three columns to be represented (integer values)
startpos, endpos: position in the identifier strings of rows ('.i') for
the coloration
col1label (optional): Label of the variable forming the X-axis
col2label (optional): Label of the variable forming the Y-axis
col3label (optional): Label of the variable forming the Z-axis
title (optional) : title of the graph
charsize (optional) : size of the plotted characters
For the French users: there is a synonym function "carte_symbole".
Use preferably "saisir_symbol_map"
The coloration of the displayed descriptors depends on the arguments
startpos and endpos.
From the names of individual, the string name(sartpos:endpos) is extracted. Two observations
for which these strings are different, are represented with different symbols.
example:
Let X be a SAISIR matrix
Let X.i being
'wheat1'
'barle2'
'ricex1'
'wheat2'
'barle3'
...
The command 'saisir_symbol_map(X,5,3,1,5)' will plot the column 5 as X, 3, as Y
The characters are extracted from 1 to 5 , that is strings 'wheat', 'barley',
'ricex'.A different symbol will be given for each of this strings.
See also saisir_colored_map1, saisir_colored_map2 (same principle but with the
identifier name displayed)Return to thematic list · HOMEfunction saisir_symbol_map3Dg(s,col1,col2,col3,startpos,endpos,groups, labcol1,labcol2,titre,charsize)Source: saisir_symbol_map3Dg.m
saisir_symbol_map - map with symbols : using a portion of the identifiers for
saisir_symbol_map(X,col1,col2,startpos,endpos,(col1label),(col2label),(title),(charsize))
Input arguments:
===============
X: SAISIR matrix
col1, col2 : index of the two columns to be represented (integer values)
startpos, endpos: position in the identifier strings of rows ('.i') for
the coloration
col1label (optional): Label of the variable forming the X-axis
col2label (optional): Label of the variable forming the Y-axis
title (optional) : title of the graph
charsize (optional) : size of the plotted characters
For the French users: there is a synonym function "carte_symbole".
Use preferably "saisir_symbol_map"
The coloration of the displayed descriptors depends on the arguments
startpos and endpos.
From the names of individual, the string name(sartpos:endpos) is extracted. Two observations
for which these strings are different, are represented with different symbols.
example:
Let X be a SAISIR matrix
Let X.i being
'wheat1'
'barle2'
'ricex1'
'wheat2'
'barle3'
...
The command 'saisir_symbol_map(X,5,3,1,5)' will plot the column 5 as X, 3, as Y
The characters are extracted from 1 to 5 , that is strings 'wheat', 'barley',
'ricex'.A different symbol will be given for each of this strings.
See also saisir_colored_map1, saisir_colored_map2 (same principle but with the
identifier name displayed)Return to thematic list · HOMEfunction mydata = saisir_table2saisir(myTable, datatype)Source: saisir_table2saisir.m
SAISIR(c) function_LARTIC 2024 function mydata = saisir_table2saisir(myTable, datatype) Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2024 This function creates a SAISIR structure from a Matlab table object See also : saisir_saisir2table function that makes the inverse process Flags pour la plateforme PULSAR --------------- Flag1 : Table2Saisir Flag2 : myTable, datatype, matrix Flag3 : mydata Flag4 : Tools INPUT ------------------------------------------------------------------------------ myTable : a Matlab table object (see table in Matlab help) mydata : a SAISIR structure datatype (optional) : define the data type to be converted : ex.: datatype = "IRMS" or datatype = "NMR" matrix : define the matrix on which these data have been collected. Ex.: matrix = "Milk"; matrix = "Apple juice"... OUTPUT ------------------------------------------------------------------------------ mydata : a SAISIR structure Example of use: T = saisir_table2saisir(myTable); T = saisir_table2saisir(myTable,'IRMS'); T = saisir_table2saisir(myTable,'IRMS','Milk'); T = saisir_table2saisir(myTable,[],'Milk'); T = saisir_table2saisir(myTable,'NMR',[]); T = saisir_table2saisir(myTable,[],[]); download SAISIR package at : https://lartic.fsaa.ulaval.ca/chimiometrie/enseignement-saisirReturn to thematic list · HOME
function handle=saisir_tcurve(X, ncol, (xlabel),(ylabel),(title))Source: saisir_tcurve.m
saisir_tcurve - representation of a column of a given matrix as a curve function handle=saisir_tcurve(X, ncol, (xlabel),(ylabel),(title)) Flags pour la plateforme PULSAR --------------- Flag1 : Curve Flag2 : s1, ncol, xlab, ylab, titre Flag3 : h Flag4 : Plot Input arguments; ================ X : SAISIR matrix ncol : column to be represented xlabel, ylabel (optional) : labels in X and Y title (optional) title of the graph. This function draws a column (typically a loading or an eigenvector) as a curve. If X.i can be interpreted as a vector of number (such as wavelengths), the X scale is given by this vector. Otherwise, the X-axis is simply given by the rank of the variables A function "tcourbe" is a synonym of this function.Return to thematic list · HOME
function handle=saisir_tcurves(X, range, (xlabel),(ylabel),(title))Source: saisir_tcurves.m
saisir_tcurves - represents several columns of a matrix as curves function handle=saisir_tcurves(X, range, (xlabel),(ylabel),(title)) Flags pour la plateforme PULSAR --------------- Flag1 : Curves Flag2 : s, range, xlab, ylab, titre Flag3 : h Flag4 : Plot Input arguments =============== X:SAISIR matrix (n x p) range: indices of the selected columns (Matlab vector of integers) xlabel, ylabel, title: legends ub x,y and title (strings) Typical use : showing loadings of PLS or PCA =========== p=saisir_pca(spectra); saisir_tcurves(p.eigenvec,1:4);%% First 4 loadings pf PCAReturn to thematic list · HOME
function handle=saisir_trajectory_curve(X,col1,col2,startpos,endpos);Source: saisir_trajectory_curve.m
saisir_trajectory_curve - plots coloured XYcurves function handle=saisir_trajectory_curve(X,col1,col2,startpos,endpos); The function represents the columns col1 and col2 as curves (ark) The observations which have the same strings in their identifiers are joined. The points are joined consecutively according to their order (rank) in x. Flags pour la plateforme PULSAR --------------- Flag1 : Trajectory curve Flag2 : x, col1, col2, startpos, endpos Flag3 : h Flag4 : Plot Input arguments: ================ X : saisir matirx col1, col2 : columns of x to be represented. startpos, endpos : positions in identifiers indicating which identifiers are to be joined. exemple of use : time series ============== identifiers of rows (x.i) like A01; A02; A03... A100; B01 ... B100; C01 ... with 1 ... 100 indicating times, and A B .. observations varying with time Command: saisir_trajectory_curve(x,1,2,1,1); Join the point labelled 'A' together; the ones labelled 'B' ... and so onReturn to thematic list · HOME
function [X] = saisir_transpose(X1)Source: saisir_transpose.m
saisir_transpose - transposes a data matrix following the saisir format function [X] = saisir_transpose(X1) Flags pour la plateforme PULSAR --------------- Flag1 : Transpose Flag2 : saisir1 Flag3 : saisir Flag4 : Tools Input argument ============= X1: SAISIR matrix ( n x p) Output argument =============== X: SAISIR matrix (p x n), transpose of X1 transposition of a struct at the saisir formatReturn to thematic list · HOME
function [sel, resultats] = saisir_variables_discriminantes( ...Source: saisir_variables_discriminantes.m
Return to thematic list · HOMEfunction R = saisir_welchtest(mydata, mygroups, varargin)Source: saisir_welchtest.m
SAISIR(c)_function_LARTIC - function saisir_welchtest(mydata, mygroups, varargin) Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2026 SAISIR_WELCHTEST - Welch test (equivalent to t-test, but more robust than t-test) on raw data (not normalised data) SAISIR_WELCHTEST Test t de Welch (variances inégales) pour 2 groupes (SAISIR). R = saisir_welchtest(mydata, mygroups) R = saisir_welchtest(mydata, mygroups, 'Alpha', 0.05, 'Tail', 'both') Sortie: R.table : table avec statistiques par variable OptionsReturn to thematic list · HOME
function saisir_xdisp(varargin)Source: saisir_xdisp.m
saisir_xdisp -smart display of heterogeneous variables
function saisir_xdisp(varargin)
Flags pour la plateforme PULSAR
---------------
Flag1 : Display ( xdisp )
Flag2 : varargin
Flag3 : None (Display only)
Flag4 : Tools
Input argument
==============
varagin: variables number of arguments either number or string
The function avoids those boring "numstr" and brackets [] in displaying
text.
Example: saisir_xdisp('pi is equal to',pi, 'Don''t you know ','Charlie Brown ?',' age :',6 );
equivalent to
disp(['pi is equal to ', num2str(pi) ' Don''t you know ' 'Charlie Brown ?' ' age ' num2str(6)]);Return to thematic list · HOMEfunction [myRawData, mydata] = saisir_xls2saisir(filename)Source: saisir_xls2saisir.m
XLS2SAISIR - Reads an Excel file and converts it to a clean SAISIR structure [myRawData, mydata] = saisir_xls2saisir(filename) Flags pour la plateforme PULSAR --------------- Flag1 : XLS2SAISIR Flag2 : filename Flag3 : myRawData, mydata Flag4 : Tools Input arguments: ================ filename : (String) Name or path of the Excel file (.xls or .xlsx) Output arguments: ================= myRawData : The raw cell array as read from the Excel file mydata : Valid SAISIR structure with aligned .d, .i, and .v fields --- 1. Filename standardization ---Return to thematic list · HOME
function handle=saisir_xy_plot(X, xcol, Y, ycol,start_pos,end_pos);Source: saisir_xy_plot.m
saisir_xy_plot - Biplot of one column of X versus one column of Y function handle=saisir_xy_plot(X, xcol, Y, ycol,start_pos,end_pos); Flags pour la plateforme PULSAR --------------- Flag1 : XY plot - Biplot Flag2 : x, xcol, y, ycol, start_pos, end_pos Flag3 : None (Plotting function) Flag4 : Plot Input arguments: ================ X,Y : SAISIR matrices (with the same number of rows) xcol, ycol : rank number (index) of the columns to be plotted if start_pos and end_pos defined: colored plot according to the characters of the row identifiers at position start_pos:end_posReturn to thematic list · HOME
function saisir_xyz_colored_map1(s,col1,col2,col3,startpos,endpos)Source: saisir_xyz_colored_map1.m
saisir_xyz_colored_map1 - Draws a colored 3D map from a Saisir file saisir_xyz_colored_map1(X,col1,col2,col3,startpos,endpos) Flags pour la plateforme PULSAR --------------- Flag1 : Colored 3D map Flag2 : s, col1, col2, col3, startpos, endpos Flag3 : None (Plotting function) Flag4 : Plot Input arguments =============== X: Saisir matrix col1, col2, col3 : indices of the columns represented in X, Y, Z startpos, endpos: number indicating the beginning and ending character in the name identifiers. Two different strings will have different colors.Return to thematic list · HOME
classdef saisirObjectHelp < dynamicpropsSource: saisirObjectHelp.m
SAISIR(c) function_LARTIC 2024 Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2024 This class creates a saisirObjectHelp object from a SAISIR structure mydata saisirObjectHelp open a browser windows containing the description of mydata structure in table form download SAISIR package at : https://lartic.fsaa.ulaval.ca/chimiometrie/enseignement-saisirReturn to thematic list · HOME
Source: MBPCA/script_MBPCA_main.m
======================================================================== MB-PCA MULTIBLOC - SCRIPT PRINCIPAL ========================================================================Return to thematic list · HOME
function mydata = table2saisir(myTable, datatype)Source: table2saisir.m
SAISIR(c) function_LARTIC 2024 function mydata = table2saisir(myTable, datatype) Author : Christophe B.Y. Cordella, LARTIC, FSAA, Ulaval, Version: 1.0 (c)2024 This function creates a SAISIR structure from a Matlab table object See also : saisir2table function that makes the inverse process INPUT mydata : a SAISIR structure datatype (optional) : define the data type to be converted : ex.: datatype = "IRMS" or datatype = "NMR" matrix : define the matrix on which these data have been collected. Ex.: matrix = "Milk"; matrix = "Apple juice"... OUTPUT myTable : Matlab table object (see table in Matlab help) Example of use: T = table2saisir(myTable); T = table2saisir(myTable,'IRMS'); T = table2saisir(myTable,'IRMS','Milk'); T = table2saisir(myTable,[],'Milk'); T = table2saisir(myTable,'NMR',[]); T = table2saisir(myTable,[],[]); download SAISIR package at : https://lartic.fsaa.ulaval.ca/chimiometrie/enseignement-saisirReturn to thematic list · HOME