# Faq how do manually calculate the limits for scores

Jump to navigation Jump to search

### Issue:

How do I manually calculate the limits for scores?

### Possible Solutions:

Individual scores limits can be calculated using the code below, given a PCA model (`modl`), the pc of interest (`pc`), and the % confidence limit level desired (`limitsvalue`):

```>> pc = 2;  %which PC to calculate limit for
>> limitsvalue = 95;  % confidence level (in %)
>> L = modl.detail.ssq(pc,2);            %get eigenvalue
>> m = length(modl.detail.includ{1,1});  %get number of samples
>> scorelimit = sqrt(L * tsqlim(m,1,limitsvalue));
```

To calculate scores limits for PCR models, the above must be slightly modified because the eigenvalues are stored in a different field. Replace the `L = ...` line above with this:

```>> L = modl.detail.pcassq(pc,2);         %get PCR model eigenvalue
```

For PLS models, you must approximate `L` (the eigenvalue) from the RMSE of the calibration data scores:

```>> L = rmse(modl.loads{1,1}(:,pc)).^2;   %estimate PLS model eigenvalue
```

This code assumes that no samples were excluded in the model. If any samples were excluded, use the `modl.detail.includ{1}` field to calculate `L` from only the included samples.

Notes:

To calculate limits for T2 and Q, see the related FAQ.

Still having problems? Please contact our helpdesk at helpdesk@eigenvector.com