# Created by Octave 3.2.4, Tue Nov 23 12:52:46 2010 EST <mockbuild@jetta.math.Princeton.EDU.private>
# name: cache
# type: cell
# rows: 3
# columns: 14
# name: <cell-element>
# type: string
# elements: 1
# length: 12
chisqouttest
# name: <cell-element>
# type: string
# elements: 1
# length: 1538
 Chi-squared test for outlier
 
 Description:
 
      Performs a chisquared test for detection of one outlier in a
      vector.
 
 Usage:
 
      [pval,chisq] = chisqouttest(x,variance,opposite)
 
 Arguments:
 
        x: a numeric vector of data values. 
 
 variance: known variance of population. if not given, estimator from
           sample is taken, but there is not so much sense in such test
           (it is similar to z-scores) 
 
 opposite: a logical indicating whether you want to check not the value
           with  largest difference from the mean, but opposite (lowest,
           if most suspicious is highest etc.)
 
 Details:
 
      This function performs a simple test for one outlier, based on
      chisquared distribution of squared differences between data and
      sample mean. It assumes known variance of population.  It is
      rather not recommended today for routine use, because several more
      powerful  tests are implemented (see other functions mentioned
      below).  It was discussed by Dixon (1950) for the first time, as
      one of the tests taken into account by him.
 
 Value:
 
 chisq: the value of chisquared-statistic.
 
  pval: the p-value for the test.
 
 Note:
 
      This test is known to reject only extreme outliers, if no known
      variance is specified.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Dixon, W.J. (1950). Analysis of extreme values. Ann. Math. Stat.
      21, 4, 488-506.
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Chi-squared test for outlier
 
 Description:
 
      Performs a chisquared test

# name: <cell-element>
# type: string
# elements: 1
# length: 10
cochrancdf
# name: <cell-element>
# type: string
# elements: 1
# length: 661
 p-values for Cochran outlying variance test

 Description:
 
      This functions calculates p-values
      for Cochran test for outlying variance.
 
 Usage:
 
       [res] = cochrancdf(q,n,k)
 
 Arguments:
 
        q: vector of quantiles. 
 
        n: number of values in each group (if not equal, use arithmetic
           mean). 
 
        k: number of groups.
 
 Value:
 
      Vector of p-values.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Snedecor, G.W., Cochran, W.G. (1980). Statistical Methods (seventh
      edition). Iowa State University Press, Ames, Iowa.
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 45
 p-values for Cochran outlying variance test


# name: <cell-element>
# type: string
# elements: 1
# length: 10
cochraninv
# name: <cell-element>
# type: string
# elements: 1
# length: 699
 Critical values for Cochran outlying variance test

 Description:
 
      This functions calculates quantiles (critical values) 
      for Cochran test for outlying variance.
 
 Usage:
 
       [res] = cochraninv(p,n,k)
 
 Arguments:
 
        p: vector of probabilities. 
 
        n: number of values in each group (if not equal, use arithmetic
           mean). 
 
        k: number of groups.
 
 Value:
 
      Vector of critical values.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Snedecor, G.W., Cochran, W.G. (1980). Statistical Methods (seventh
      edition). Iowa State University Press, Ames, Iowa.
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 52
 Critical values for Cochran outlying variance test


# name: <cell-element>
# type: string
# elements: 1
# length: 11
cochrantest
# name: <cell-element>
# type: string
# elements: 1
# length: 1105
 Test for outlying or inlying variance
 
 Description:
 
      This test is useful to check if largest variance in several groups
      of data is "outlying" and this group should be rejected.
      Alternatively, if one group has very small variance, we can test
      for "inlying" variance.
 
 Usage:
 
      [pval,C] = cochrantest(x,inlying,n)
 
 Arguments:
 
        x: A vector of variances or matrix of observations. 
 
        n: If object is a vector, n should be another vector, giving
           number of data in each corresponding group. If object is a
           matrix, n should be omitted.
 
  inlying: Test smallest variance instead of largest.
 
 Details:
 
      The corresponding p-value is calculated using 'cochrancdf' function.
 
 Value:
 
        C: the value of Cochran-statistic.
 
  p.value: the p-value for the test.
 
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Snedecor, G.W., Cochran, W.G. (1980). Statistical Methods (seventh
      edition). Iowa State University Press, Ames, Iowa.
 
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Test for outlying or inlying variance
 
 Description:
 
      This test is usef

# name: <cell-element>
# type: string
# elements: 1
# length: 8
dixoncdf
# name: <cell-element>
# type: string
# elements: 1
# length: 104
 This function is simple wrapper to dixoninv with 'rev=1' parameter.
 For more info see 'help dixoninv'

# name: <cell-element>
# type: string
# elements: 1
# length: 68
 This function is simple wrapper to dixoninv with 'rev=1' parameter.

# name: <cell-element>
# type: string
# elements: 1
# length: 8
dixoninv
# name: <cell-element>
# type: string
# elements: 1
# length: 1488
 Critical values and p-values for Dixon tests
 
 Description:
 
      Approximated quantiles (critical values) and distribution function
      (giving p-values) for Dixon tests for outliers.
 
 Usage:
 
      [q]=dixoninv(p, n, type, rev) 
 
 Arguments:
 
        p: vector of probabilities. 
 
        n: length of sample. 
 
     type: integer value: 10, 11, 12, 20, or 21. For description see
           'dixontest'. 
 
      rev: function 'dixoninv' with this parameter set to TRUE acts as
           'dixoncdf' to omit the repetition of code. 'dixoncdf' is the wrapper.
 
 Details:
 
      This function is based on tabularized Dixon distribution, given by
      Dixon (1950) and corrected by Rorabacher (1991). Continuity is
      reached due to smart interpolation using 'qtable' function. By
      now, numerical procedure to obtain these values for n>3 is not
      known.
 
 Value:
 
      Critical value or p-value (vector).
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Dixon, W.J. (1950). Analysis of extreme values. Ann. Math. Stat.
      21, 4, 488-506.
 
      Dixon, W.J. (1951). Ratios involving extreme values. Ann. Math.
      Stat. 22, 1, 68-78.
 
      Rorabacher, D.B. (1991). Statistical Treatment for Rejection of
      Deviant Values: Critical Values of Dixon Q Parameter and Related
      Subrange Ratios at the 95 percent Confidence Level. Anal. Chem.
      83, 2, 139-146.
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Critical values and p-values for Dixon tests
 
 Description:
 
      Approximat

# name: <cell-element>
# type: string
# elements: 1
# length: 9
dixontest
# name: <cell-element>
# type: string
# elements: 1
# length: 2075
 Dixon tests for outlier
 
 Description:
 
      Performs several variants of Dixon test for detecting outlier in
      data sample.
 
 Usage:
 
      [pval,Q] = dixontest(x,type,opposite,twosided)
 
 Arguments:
 
        x: a numeric vector or matrix of data values. Each column of a
           matrix is treated as independent sample set.
 
 opposite: a logical (0,1) indicating whether you want to check not the value
           with  largest difference from the mean, but opposite (lowest,
           if most suspicious is highest etc.). Default 0.
 
     type: an integer specyfying the variant of test to be performed.
           Possible values are compliant with these given by Dixon
           (1950): 10, 11, 12, 20, 21. If this value is set to zero, a
           variant of the test is chosen according to sample size (10
           for 3-7, 11 for 8-10, 21 for 11-13,  22 for 14 and more). The
           lowest or highest value is selected automatically, and can be
           reversed used 'opposite' parameter. 
 
 two.sided: treat test as two-sided (default=1). 
 
 Details:
 
      The p-value is calculating by interpolation using 'dixoncdf' and
      'qtable'. According to Dixon (1951) conclusions, the critical
      values can be obtained numerically only for n=3. Other critical
      values are obtained by simulations, taken from original Dixon's
      paper, and regarding corrections given by Rorabacher (1991).
 
 Value:
 
 	Q: the value of Dixon Q-statistic.
 
  	pval: the p-value for the test.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Dixon, W.J. (1950). Analysis of extreme values. Ann. Math. Stat.
      21, 4, 488-506.
 
      Dixon, W.J. (1951). Ratios involving extreme values. Ann. Math.
      Stat. 22, 1, 68-78.
 
      Rorabacher, D.B. (1991). Statistical Treatment for Rejection of
      Deviant Values: Critical Values of Dixon Q Parameter and Related
      Subrange Ratios at the 95 percent Confidence Level. Anal. Chem.
      83, 2, 139-146.
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Dixon tests for outlier
 
 Description:
 
      Performs several variants of Di

# name: <cell-element>
# type: string
# elements: 1
# length: 9
grubbscdf
# name: <cell-element>
# type: string
# elements: 1
# length: 106
 This function is simple wrapper to grubbsinv with 'rev=1' parameter.
 For more info see 'help grubbsinv'

# name: <cell-element>
# type: string
# elements: 1
# length: 69
 This function is simple wrapper to grubbsinv with 'rev=1' parameter.

# name: <cell-element>
# type: string
# elements: 1
# length: 9
grubbsinv
# name: <cell-element>
# type: string
# elements: 1
# length: 2110
 Calculate critical values and p-values for Grubbs tests
 
 Description:
 
      This function is designed to calculate critical values for Grubbs
      tests for outliers detecting and to approximate p-values
      reversively.
 
 Usage:
 
      [q]=grubbsinv(p, n, type, rev) 
 
 Arguments:
 
        p: vector of probabilities. 
 
        n: sample size. 
 
     type: Integer value indicating test variant. 10 is a test for one
           outlier (side is detected automatically and can be reversed
           by 'opposite' parameter). 11 is a test for two outliers on
           opposite tails, 20 is test for two outliers in one tail. 
 
      rev: if set to TRUE, function 'grubbsinv' acts as 'grubbscdf' (grubbscdf
           is really wrapper to grubbsinv to omit repetition of the code).
 
 Details:
 
      The critical values for test for one outlier is calculated
      according to approximations given by Pearson and Sekar (1936). The
      formula is simply reversed to obtain p-value.
 
      The values for two outliers test (on opposite sides) are
      calculated according to David, Hartley, and Pearson (1954). Their
      formula cannot be rearranged to obtain p-value, thus such values
      are obtained by simple bisection method.
 
      For test checking presence of two outliers at one tail, the
      tabularized distribution (Grubbs, 1950) is used, and
      approximations of p-values are interpolated using 'qtable'.
 
 Value:
 
      A vector of quantiles or p-values.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Grubbs, F.E. (1950). Sample Criteria for testing outlying
      observations. Ann. Math. Stat. 21, 1, 27-58.
 
      Pearson, E.S., Sekar, C.C. (1936). The efficiency of statistical
      tools and a criterion for the rejection of outlying observations.
      Biometrika, 28, 3, 308-320.
 
      David, H.A, Hartley, H.O., Pearson, E.S. (1954). The distribution
      of the ratio, in a single normal sample, of range to standard
      deviation. Biometrika, 41, 3, 482-493.
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Calculate critical values and p-values for Grubbs tests
 
 Description:
 
     

# name: <cell-element>
# type: string
# elements: 1
# length: 10
grubbstest
# name: <cell-element>
# type: string
# elements: 1
# length: 2896
 Grubbs tests for one or two outliers in data sample
 
 Description:
 
      Performs Grubbs' test for one outlier, two outliers on one tail,
      or two outliers on opposite tails, in small sample.
 
 Usage:
 
      [pval,G,U] = grubbstest(x,type,opposite,twosided)
 
 Arguments:
 
        x: a numeric vector or matrix of data values. Matrices are treated
           columnwise (each column as independent set).
 
 opposite: a logical (default 0) indicating whether you want to check not the value
           with largest difference from the mean, but opposite (lowest,
           if most suspicious is highest etc.)
 
     type: Integer value indicating test variant. 10 is a test for one
           outlier (side is detected automatically and can be reversed
           by 'opposite' parameter). 11 is a test for two outliers on
           opposite tails, 20 is test for two outliers in one tail. Default 10.
 
 two.sided: Logical value indicating if there is a need to treat this
           test as two-sided. Default 0.
 
 Details:
 
      The function can perform three tests given and discussed by Grubbs
      (1950).
 
      First test (10) is used to detect if the sample dataset contains
      one outlier, statistically different than the other values. Test
      is based by calculating score of this outlier G (outlier minus
      mean and divided by sd) and comparing it to appropriate critical
      values. Alternative method is calculating ratio of variances of
      two datasets - full dataset and dataset without outlier. The
      obtained value called U is bound with G by simple formula.
 
      Second test (11) is used to check if lowest and highest value are
      two outliers on opposite tails of sample. It is based on
      calculation of ratio of range to standard deviation of the sample. 
 
      Third test (20) calculates ratio of variance of full sample and
      sample without two extreme observations. It is used to detect if
      dataset contains two outliers on the same tail.
 
      The p-values are calculated using 'grubbscdf' function.
 
 Value:
 
 G,U: the value statistic. For type 10 it is difference between
           outlier and the mean divided by standard deviation, and for
           type 20 it is sample range divided by standard deviation.
           Additional value U is ratio of sample variances with and
           withour suspicious outlier. According to Grubbs (1950) these
           values for type 10 are bound by simple formula and only one
           of them can be used, but function gives both. For type 20 the
           G is the same as U.
 
  pval: the p-value for the test.
 
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 References:
 
      Grubbs, F.E. (1950). Sample Criteria for testing outlying
      observations. Ann. Math. Stat. 21, 1, 27-58.
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Grubbs tests for one or two outliers in data sample
 
 Description:
 
      Per

# name: <cell-element>
# type: string
# elements: 1
# length: 7
outlier
# name: <cell-element>
# type: string
# elements: 1
# length: 874
 Find value with largest difference from the mean
 
 Description:
 
      Finds value with largest difference between it and sample mean,
      which can be an outlier.
 
 Usage:
 
      [out] = outlier(x,opposite,logical) 
 
 Arguments:
 
        x: a data sample, vector in most cases. If argument is a
          matrix, each column is treated as independent dataset. 
 
 opposite: if set to 1 (default 0), gives opposite value (if largest value has
           maximum difference from the mean, it gives smallest and vice
           versa)
 
  logical: if set to 1 (default 0), gives vector of logical values, and possible
           outlier position is marked by 1, others are 0
 
 Value:
 
      A vector of value(s) with largest difference from the mean.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
      
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Find value with largest difference from the mean
 
 Description:
 
      Finds 

# name: <cell-element>
# type: string
# elements: 1
# length: 6
qtable
# name: <cell-element>
# type: string
# elements: 1
# length: 1050
 Interpolate tabularized distribution
 
 Description:
 
      This function calculates critical values or p-values which cannot
      be obtained numerically, and only tabularized version is
      available. 
 
 Usage:
 
      [q] = qtable(p,probs,quants)
 
 Arguments:
 
        p: vector of probabilities. 
 
    probs: vector of given probabilities. 
 
   quants: vector of given corresponding quantiles. 
 
 Details:
 
      This function is mainly internal routine used to obtain Grubbs and Dixon
      critical values. It fits linear or cubical regression to closests
      values of its argument, then uses obtained function to obtain
      quantile by interpolation. But noone disables to call it directly in
      any purpose :)
 
 Value:
 
      q: A vector of interpolated values
 
 Note:
 
      You can simply do "reverse" interpolation (p-value calculating) by
      reversing probabilities and quantiles (2 and 3 argument).
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Interpolate tabularized distribution
 
 Description:
 
      This function calc

# name: <cell-element>
# type: string
# elements: 1
# length: 9
rmoutlier
# name: <cell-element>
# type: string
# elements: 1
# length: 1030
 Remove the value(s) most differing from the mean
 
 Description:
 
      This function can remove the outliers or replace by sample mean or median.
 
 Usage:
 
      [res] = rmoutlier(x,fill,median,opposite)
 
 Arguments:
 
        x: a dataset, most frequently a vector. If argument is a
           matrix, each column is treated as independent dataset. 
 
     fill: If set to 1 (default 0), the median or mean is placed instead of
           outlier. Otherwise,  the outlier(s) is/are simply removed. 
 
   median: If set to 1 (default 0), median is used instead of mean in outlier
           replacement. 
 
 opposite: if set to 1 (default 0), replaces opposite value (if largest value has
           maximum difference from the mean, it replaces smallest and vice
           versa)
 
 Value:
 
      A dataset of the same type as argument, with outlier(s) removed or
      replaced by appropriate means or medians.
 
 Author(s):
 
      Lukasz Komsta, ported from R package "outliers".
	See R News, 6(2):10-13, May 2006
 
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Remove the value(s) most differing from the mean
 
 Description:
 
      This f

# name: <cell-element>
# type: string
# elements: 1
# length: 6
scores
# name: <cell-element>
# type: string
# elements: 1
# length: 2074
 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.
 

# name: <cell-element>
# type: string
# elements: 1
# length: 80
 Calculate scores of the sample
 
 Description:
 
      This function calculates

