Home > freetb4matlab > outliers > scores.m

scores

PURPOSE ^

% Calculate scores of the sample

SYNOPSIS ^

function [res]=scores(x,type,prob,lim)

DESCRIPTION ^

% Calculate scores of the sample
% 
% Description:
% 
%      This function calculates normal, t, chi-squared, IQR and MAD
%      scores of given data.
% 
% Usage:
% 
%      [res]=scores(x,type,prob,lim) 
% 
% Arguments:
% 
%        x: a vector or matrix of data. Matrices are treated columnwise
%           (each column as independent dataset).
% 
%     type: '0' calculates normal scores (differences between each value
%           and the mean divided by sd, DEFAULT), '1' calculates t-Student scores
%           (transformed by '(z*sqrt(n-2))/sqrt(z-1-t^2)' formula,
%           '2' gives chi-squared scores (squares of differences
%           between values and mean divided by variance. For the '3'
%           type, all values lower than first and greater than third
%           quartile is considered, and difference between them and
%           nearest quartile divided by IQR are calculated. For the
%           values between these quartiles, scores are always equal to
%           zero. '4' gives MAD scores - differences between each value and median,
%           divided by median absolute deviation.
% 
%     prob: If set (default is NA), the corresponding p-values instead of scores are
%           given. If value is set to 1, p-values are returned. Otherwise,
%           a logical vector is formed, indicating which values are
%           exceeding specified probability. In 'z' and 'mad' types,
%           there is also possibility to set this value to zero, and then
%           scores are confirmed to (n-1)/sqrt(n) value, according to 
%           Shiffler (1998). The '3' (IQR) type does not support
%           probabilities, but 'lim' value can be specified.
% 
%      lim: This value can be set for '3' (IQR) type of scores, to form
%           logical vector, which values has this limit exceeded. 
% 
% Value:
% 
%      A vector of scores, probabilities, or logical vector.
% 
% Author(s):
% 
%      Lukasz Komsta, ported from R package 'outliers'.
%    See R News, 6(2):10-13, May 2006
% 
% References:
% 
%      Schiffler, R.E (1998). Maximum Z scores and outliers. Am. Stat.
%      42, 1, 79-80.
%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sat 16-May-2009 00:04:49 by m2html © 2003