4.0

4.0 | 1 rating Rate this file 22 Downloads (last 30 days) File Size: 3.48 KB File ID: #30762

Soft Independent Modeling of Class Analogy (SIMCA)

by

 

15 Mar 2011 (Updated )

M-files for classes modeling and prediction by SIMCA

| Watch this File

File Information
Description

 Model for Soft Independent Modeling of Class Analogy (SIMCA)
 
 simca_model=simca(x,classes)

 input:
 x (samples x descriptors) for calibration
 classes (samples x 1) classes numbers (must be >0)
 
 output:
 simca_model struct with:
     models (1 x No. classes) struct with: (one for each class)
         x (samples x descriptors) input for this class
         clas (samples x 1) numbers for this class
         S (samples x pc) scores for this model
         L (descriptors x pc) loadings for this model
         ev (pc x 1) eigenvalues for this model
         T2 (samples x 1) T² for samples of this model
         Q2 (samples x 1) Q² for samples of this model
         T2lim (1 x 1) T² limit for this model
         Q2lim (1 x 1) Q² limit for this model
     stats (1 x 1) struct with:
         classes (No. classes x 1) class types
         T2 (samples x 1) T² for calibration samples
         Q2 (samples x 1) Q² for calibration samples
         class_c (samples x 1) Predicted classes for calibration samples
         RMSEP (1 x 1) Root Mean Square Error for Calibration
         R2 (1 x 1) Correlation Coefficient for calibration
         suc (1 x 1) Success (%) of classification for calibration samples

--------------------------------------------------------------------------

 Classes prediction using SIMCA model

 simca_pred = simcapred(x,model,classes)
 
 input:
 x (samples x descriptors) new samples for prediction
 model (struct) with SIMCA calibration parameters
 classes (samples x 1) classes numbers (must be >0) (optional for model test)
 
 output:
 simca_pred struct with:
     class_p (samples x 1) predicted classes for new samples
     T2 (samples x 1) T² for new samples
     Q2 (samples x 1) Q² for new samples
     RMSEP (1 x 1) Root Mean Square Error for Prediction (only if 'classes' is supplied)
     R2 (1 x 1) Correlation Coefficient for Prediction (only if 'classes' is supplied)
     suc (1 x 1) Success (%) of classification for new samples (only if 'classes' is supplied)

Required Products Statistics Toolbox
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
20 Jan 2014 Cleiton Nunes

Angela,
Example of data format:
x=[
1 2 4 4 5
3 2 4 6 5
5 4 3 6 6
6 4 7 5 6
6 3 5 4 6
6 7 4 5 6
]

classes=[
1
1
1
2
2
2
]

10 Jan 2014 angela

I want you can give me data format for x and classes,Thank You!

28 Mar 2013 yang yang

Does the statement, ca = sqrt(2)*erfinv(cl/100), on line 148 in the file of simca.m represents the upper 1 − α quantile of the standard normal distribution? Does it equals to norminv(α,0,1)in Matlab?

27 Mar 2013 yang yang

SVD: X=U*sigma*V'
PCA: X'*X=V*sigma^2*V'
Thus,eigenvalues are on the diagonal of sigma^2.
The calculation for Qlim in the file of SIMCA.m might be fixed for the vector eive consisting of the singular values rather than the eigenvalues.

19 Mar 2013 Cleiton Nunes

Thanks Yang Yang. It was fixed.

18 Mar 2013 yang yang

The statement,
t = E*inv(diag(eive(1:cpret).^.5)), on line 115 in simca file might be written as
t = E*inv(diag(eive(1:cpret))).

29 Oct 2011 norhashila

I had try this one and its works!But, I'm not sure how to use the simca_pred. I don't know how to replace the model in the function. When I replace the model with simca_model, the simca_pred stats have the same stat value with simca_model. Could you please explain?

Updates
16 Mar 2011

Correlation coefficients changed from R to R2.

19 Mar 2013

Line 115 in sinca.m was rewritten as:
t = E*inv(diag(eive(1:cpret)))
in place of:
t = E*inv(diag(eive(1:cpret).^.5))

Line 45 in sincapred.m was rewritten as:
nt = nE*inv(diag(eive(1:nl)))
in place of:
nt = nE*inv(diag(eive(1:nl).^.5))

Contact us