1 / 157

Exercices Multivariate Data Analysis

Exercices Multivariate Data Analysis. Topic 1 Multivariate Data Analysis. Topic 1 Theory: Multivariate Data Analysis Introduction to Multivariate Data Analysis Principal Component Analysis (PCA) Multivariate Linear Regression (MLR, PCR and PLSR) Laboratory exercises : Introduction to MATLAB

danielsm
Download Presentation

Exercices Multivariate Data Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ExercicesMultivariate Data Analysis

  2. Topic 1 Multivariate Data Analysis Topic 1 Theory: Multivariate Data Analysis Introduction to Multivariate Data Analysis Principal Component Analysis (PCA) Multivariate Linear Regression (MLR, PCR and PLSR) Laboratory exercises:Introduction to MATLAB Examples of  PCA (cluster analysis of samples, identification and geographical distribution of contamination sources/patterns…) Examples of Multivariate Regression (prediction of concentration of chemicals from spectral analysis, investigation of correlation patterns and of the relative importance of variables,… Romà Tauler (IDAEA, CSIC, Barcelona) Febrero 2009

  3. Introduction to MATLAB. What is MATLAB? Matlab is a contraction for “Matrix Laboratory" and, though originally designed as a tool for the manipulation of matrices, is now capable of performing a wide range of numerica computations. Matlab also possess esextensive graphics capabilities.

  4. Introduction to MATLAB • Command line programming environment • command window prompt (») • Matrix algebra: scalars, vectors, matrices • Work / use: • Interactively at the command line • Create/use programs (functions or scripts) • Toolboxes add on additional functionality

  5. The MATLAB Workspace Workspace is where: variables are stored, create variables, manipulate and operate on variables Save workspace variables Information about variables in the workspace: who and whos »whos Name Size Bytes Class fsparse 100x100 1604 sparse array modstruct 1x1 130 struct array my3D 10x20x104 166400 double array mymat 5x4 160 double array myvect 1x3 24 double array somechars 1x8 16 char array zcells 2x2 167082 cell array Grand total is 41766 elements using 335416 bytes

  6. MATLAB Data Types • double -- double precision floating point • -- number array (this is the traditional • -- MATLAB matrix or array) • sparse -- 2-D real (or complex) sparse matrix • struct -- Structure array • cell -- cell array • char -- Character array • logical -- Logical arrays (1,0) • <class_name> -- Custom object class • dataset -- Standard Data Object

  7. Command Line Help: help functionname; lookfor method; which functionname helpwin

  8. Importing Data into MATLAB MATLAB can read flat ASCII files Import Wizard A variety of image formats can be imported with IMREAD function (JPEG, BMP, TIFF, etc.) Various spreadsheet import functions Custom developed routines for reading binary instrument files Additional Functions for Importing Data ‘xlsfinfo’ - reads sheetnames from .xls file ‘xlsread’ - reads in data from .xls file

  9. Format types

  10. A = [1 2 0; 2 5 -1; 4 10 -1] A = 1 2 0 2 5 -1 4 10 -1 >>B = A' B = 1 2 4 2 5 10 0 -1 -1 >>C = A .* B C = 1 4 0 4 25 -10 0 -10 1 The same for the ./and.\operators NaNconcept: NaN is the IEEE arithmetic representation for Not-a-Number. A NaN is obtained as a result of mathematically undefined operations like 0.0/0.0 and inf-inf.

  11. Useful functions for beginners: HELP:On-line help, display text at command line. LOOKFOR:Search all M-files for keyword. WHOS:List current variables, long form. MAX:Largest component. MIN:Smallest component. ROUND, CEIL, FLOOR, FIX:Rounding. SQUEEZE:Remove singleton dimensions. FIND:Find indices of nonzero elements. MEAN:Average or mean value. ISNAN:True for Not-a-Number. FLIPUD:Flip matrix in up/down direction. FLIPDIM:Flip matrix along specified dimension. RESHAPE:Change size. PERMUTE:Permute array dimensions. REPMAT:Replicate and tile an array. EVAL:Execute string with MATLAB expression.

  12. Indexing into Three-way (and higher) Arrays MATLAB supports three-way and higher arrays Indexing extends easily to multi-way: »x = round(rand(4,5,2)*10) x(:,:,1) = 10 9 8 9 9 2 8 4 7 9 6 5 6 2 4 5 0 8 4 9 x(:,:,2) = 1 1 3 4 8 4 2 2 9 5 8 2 0 5 2 0 6 7 4 7 »x(:,:,2) = ones(4,5)*5 x(:,:,1) = 10 9 8 9 9 2 8 4 7 9 6 5 6 2 4 5 0 8 4 9 x(:,:,2) = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5

  13. Cell Arrays Cell arrays are a handy way to store different length matrices from batch process data, example at left »x = cell(4,1) x = [] [] [] [] »x{1} = rand(4,5); »x{2} = rand(10,5); »x{3} = rand(6,5); »x{4} = rand(8,5); »x x = [ 4x5 double] [10x5 double] [ 6x5 double] [ 8x5 double] »x{1} ans = 0.8381 0.8318 0.3046 0.3028 0.3784 0.0196 0.5028 0.1897 0.5417 0.8600 0.6813 0.7095 0.1934 0.1509 0.8537 0.3795 0.4289 0.6822 0.6979 0.5936

  14. help diary DIARY Save text of MATLAB session. DIARY FILENAME causes a copy of all subsequent command window input and most of the resulting command window output to be appended to the named file. If no file is specified, the file 'diary' is used. DIARY OFF suspends it. DIARY ON turns it back on. DIARY, by itself, toggles the diary state. Use the functional form of DIARY, such as DIARY('file'), when the file name is stored in a string. See also <a href="matlab:help save">save</a>. Reference page in Help browser <a href="matlab:doc diary">doc diary</a> doc diary diary

  15. Introduction to Linear Algebra • Definitions • scalar, vector, matrix • Linear Algebra Operations • vector and matrix addition • vector and matrix multiplication • projection • Gaussian elimination • the concept of rank • matrix inverses • rank deficiency • ......

More Related