Module_Stat_Procedures

Copyright 2021 IRD

This file is part of statpack.

statpack is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

statpack is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You can find a copy of the GNU Lesser General Public License in the statpack/doc directory.

Authors: Pascal Terray (LOCEAN/IPSL, Paris, France)


MODULE EXPORTING SUBROUTINES AND FUNCTIONS FOR UNIVARIATE STATISTICAL COMPUTATIONS

LATEST REVISION : 20/08/2021


subroutine comp_unistat ( x, first, last, xstat, xnobs, nobias )

Purpose

COMP_UNISTAT computes estimates of univariate statistics from a data vector.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector of the data vector.
  • FIRST = false the current subvector is not the first subvector of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector of the data vector.
  • LAST = false the current subvector is not the last subvector of the data vector.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(7)

On entry, after the first call to COMP_UNISTAT (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT. XSTAT should not be changed between calls to COMP_UNISTAT.

On exit, when LAST=true, XSTAT contains the following statistics :

  • XSTAT(1) contains the mean value of the data vector.
  • XSTAT(2) contains the variance of the data vector.
  • XSTAT(3) contains the standard deviation of the data vector.
  • XSTAT(4) contains the coefficient of skewness of the data vector.
  • XSTAT(5) contains the coefficient of kurtosis of the data vector.
  • XSTAT(6) contains the minimum of the data vector.
  • XSTAT(7) contains the maximum of the data vector.

The size of XSTAT must verify: size(XSTAT) = 7.

XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data vector. XNOBS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present, the pertinent statistics are set to Nan code.

subroutine comp_unistat ( x, first, last, xstat, dimvar, xnobs, nobias )

Purpose

COMP_UNISTAT computes estimates of univariate statistics from a data matrix.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which basic univariate statistics are desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix of the data matrix.
  • LAST = false the current submatrix is not the last submatrix of the data matrix.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(:,7)

On entry, after the first call to COMP_UNISTAT (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT. XSTAT should not be changed between calls to COMP_UNISTAT.

On exit, when LAST=true, each column of XSTAT contains the following statistics on all variables:

  • XSTAT(:,1) contains the mean values.
  • XSTAT(:,2) contains the variances.
  • XSTAT(:,3) contains the standard deviations.
  • XSTAT(:,4) contains the coefficients of skewness.
  • XSTAT(:,5) contains the coefficients of kurtosis.
  • XSTAT(:,6) contains the minima.
  • XSTAT(:,7) contains the maxima.

The shape of XSTAT must verify:

  • size(XSTAT,1) = size(X,DIMVAR) ;
  • size(XSTAT,2) = 7 .
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data matrix. XNOBS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present, the pertinent statistics are set to Nan code.

subroutine comp_unistat ( x, first, last, xstat, xnobs, nobias )

Purpose

COMP_UNISTAT computes estimates of univariate statistics from a tridimensional data array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(:,:,7)

On entry, after the first call to COMP_UNISTAT (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT. XSTAT should not be changed between calls to COMP_UNISTAT.

On exit, when LAST=true, each matrix of XSTAT contains the following statistics on all variables:

  • XSTAT(:,:,1) contains the mean values.
  • XSTAT(:,:,2) contains the variances.
  • XSTAT(:,:,3) contains the standard deviations.
  • XSTAT(:,:,4) contains the coefficients of skewness.
  • XSTAT(:,:,5) contains the coefficients of kurtosis.
  • XSTAT(:,:,6) contains the minima.
  • XSTAT(:,:,7) contains the maxima.

The shape of XSTAT must verify:

  • size(XSTAT,1) = size(X,1)
  • size(XSTAT,2) = size(X,2)
  • size(XSTAT,3) = 7 .
XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data array. XNOBS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present, the pertinent statistics are set to Nan code.

subroutine comp_unistat ( x, first, last, xstat, xnobs, nobias )

Purpose

COMP_UNISTAT computes estimates of univariate statistics from a fourdimensional data array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:,:)
On entry, input subarray containing size(X,4) observations on size(X,1) by size(X,2) by size(X,3) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(:,:,:,7)

On entry, after the first call to COMP_UNISTAT (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT. XSTAT should not be changed between calls to COMP_UNISTAT.

On exit, when LAST=true, each matrix of XSTAT contains the following statistics on all variables:

  • XSTAT(:,:,:,1) contains the mean values.
  • XSTAT(:,:,:,2) contains the variances.
  • XSTAT(:,:,:,3) contains the standard deviations.
  • XSTAT(:,:,:,4) contains the coefficients of skewness.
  • XSTAT(:,:,:,5) contains the coefficients of kurtosis.
  • XSTAT(:,:,:,6) contains the minima.
  • XSTAT(:,:,:,7) contains the maxima.

The shape of XSTAT must verify:

  • size(XSTAT,1) = size(X,1),
  • size(XSTAT,2) = size(X,2)
  • size(XSTAT,3) = size(X,3)
  • size(XSTAT,4) = 7 .
XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data array. XNOBS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present, the pertinent statistics are set to Nan code.

subroutine comp_unistat ( x, first, last, xstat, xmiss, xnobs, nobias )

Purpose

COMP_UNISTAT_MISS computes estimates of univariate statistics from a data vector possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector of the data vector.
  • FIRST = false the current subvector is not the first subvector of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector
    of the data vector.
  • LAST = false the current subvector is not the last subvector
    of the data vector.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(7)

On entry, after the first call to COMP_UNISTAT_MISS (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT_MISS. XSTAT should not be changed between calls to COMP_UNISTAT_MISS.

On exit, when LAST=true, XSTAT contains the following statistics :

  • XSTAT(1) contains the mean value of the data vector.
  • XSTAT(2) contains the variance of the data vector.
  • XSTAT(3) contains the standard deviation of the data vector.
  • XSTAT(4) contains the coefficient of skewness of the data vector.
  • XSTAT(5) contains the coefficient of kurtosis of the data vector.
  • XSTAT(6) contains the minimum of the data vector.
  • XSTAT(7) contains the maximum of the data vector.

The size of XSTAT must verify: size(XSTAT) = 7.

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of non-missing observations in the data vector. XNOBS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present, the pertinent statistics are set to XMISS.

subroutine comp_unistat ( x, first, last, xstat, xmiss, dimvar, xnobs, nobias )

Purpose

COMP_UNISTAT_MISS computes estimates of univariate statistics from a data matrix possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which basic univariate statistics are desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix
    of the data matrix.
  • LAST = false the current submatrix is not the last submatrix
    of the data matrix.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(:,7)

On entry, after the first call to COMP_UNISTAT_MISS (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT_MISS. XSTAT should not be changed between calls to COMP_UNISTAT_MISS.

On exit, when LAST=true, each column of XSTAT contains the following statistics on all variables:

  • XSTAT(:,1) contains the mean values.
  • XSTAT(:,2) contains the variances.
  • XSTAT(:,3) contains the standard deviations.
  • XSTAT(:,4) contains the coefficients of skewness.
  • XSTAT(:,5) contains the coefficients of kurtosis.
  • XSTAT(:,6) contains the minima.
  • XSTAT(:,7) contains the maxima.

The shape of XSTAT must verify:

  • size(XSTAT,1) = size(X,DIMVAR)
  • size(XSTAT,2) = 7 .
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

XNOBS (OUTPUT, OPTIONAL) integer(i4b), dimension(:)

On exit, XNOBS contains the number of non-missing observations on all variables. XNOBS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).

The size of XNOBS must verify: size(XNOBS) = size(X,DIMVAR).

NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present for some variables, the pertinent statistics are set to XMISS.

subroutine comp_unistat ( x, first, last, xstat, xmiss, xnobs, nobias )

Purpose

COMP_UNISTAT_MISS computes estimates of univariate statistics from a tridimensional data array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full tridimensional data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray
    of the data array.
  • LAST = false the current subarray is not the last subarray
    of the data array.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(:,:,7)

On entry, after the first call to COMP_UNISTAT_MISS (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT_MISS. XSTAT should not be changed between calls to COMP_UNISTAT_MISS.

On exit, when LAST=true, each matrix of XSTAT contains the following statistics on all variables:

  • XSTAT(:,:,1) contains the mean values.
  • XSTAT(:,:,2) contains the variances.
  • XSTAT(:,:,3) contains the standard deviations.
  • XSTAT(:,:,4) contains the coefficients of skewness.
  • XSTAT(:,:,5) contains the coefficients of kurtosis.
  • XSTAT(:,:,6) contains the minima.
  • XSTAT(:,:,7) contains the maxima.

The shape of XSTAT must verify:

  • size(XSTAT,1) = size(X,1)
  • size(XSTAT,2) = size(X,2)
  • size(XSTAT,3) = 7 .
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XNOBS (OUTPUT, OPTIONAL) integer(i4b), dimension(:,:)

On exit, XNOBS contains the numbers of non-missing observations on all variables. XNOBS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).

The shape of XNOBS must verify:

  • size(XNOBS,1) = size(X,1)
  • size(XNOBS,2) = size(X,2).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present for some variables, the pertinent statistics are set to XMISS.

subroutine comp_unistat ( x, first, last, xstat, xmiss, xnobs, nobias )

Purpose

COMP_UNISTAT_MISS computes estimates of univariate statistics from a fourdimensional data array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:,:)
On entry, input subarray containing size(X,4) observations on size(X,1) by size(X,2) by size(X,3) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full tridimensional data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XSTAT (INPUT/OUTPUT) real(stnd), dimension(:,:,:,7)

On entry, after the first call to COMP_UNISTAT_MISS (e.g. when FIRST=true), XSTAT is used as workspace to accumulate quantities on previous calls to COMP_UNISTAT_MISS. XSTAT should not be changed between calls to COMP_UNISTAT_MISS.

On exit, when LAST=true, each matrix of XSTAT contains the following statistics on all variables:

  • XSTAT(:,:,:,1) contains the mean values.
  • XSTAT(:,:,:,2) contains the variances.
  • XSTAT(:,:,:,3) contains the standard deviations.
  • XSTAT(:,:,:,4) contains the coefficients of skewness.
  • XSTAT(:,:,:,5) contains the coefficients of kurtosis.
  • XSTAT(:,:,:,6) contains the minima.
  • XSTAT(:,:,:,7) contains the maxima.

The shape of XSTAT must verify:

  • size(XSTAT,1) = size(X,1)
  • size(XSTAT,2) = size(X,2)
  • size(XSTAT,3) = size(X,3)
  • size(XSTAT,4) = 7 .
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XNOBS (OUTPUT, OPTIONAL) integer(i4b), dimension(:,:,:)

On exit, XNOBS contains the numbers of non-missing observations on all variables. XNOBS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).

The shape of XNOBS must verify:

  • size(XNOBS,1) = size(X,1)
  • size(XNOBS,2) = size(X,2)
  • size(XNOBS,3) = size(X,3).
NOBIAS (INPUT, OPTIONAL) logical(lgl)

On entry, when LAST=true and NOBIAS=true, unbiased estimates of skewness and kurtosis are computed. If NOBIAS=false or is absent, biased estimates are computed.

NOBIAS needs to be specified only on the last call to COMP_UNISTAT_MISS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than four valid observations were present for some variables, the pertinent statistics are set to XMISS.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xnobs )

Purpose

COMP_MVS computes estimates of mean, variance and standard-deviation from a data vector.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector of the data vector.
  • FIRST = false the current subvector is not the first subvector of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector of the data vector.
  • LAST = false the current subvector is not the last subvector of the data vector.
XMEAN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantity on previous calls to COMP_MVS. XMEAN should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XMEAN contains the mean value of the data vector.

XVAR (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantity on previous calls to COMP_MVS. XVAR should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XVAR contains the variance of the data vector.

XSTD (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantity on previous calls to COMP_MVS. XSTD should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XSTD contains the standard deviation of the data vector.

XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data vector. XNOBS needs to be specified only on the last call to COMP_MVS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid observation is present, the statistics are set to Nan code.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, dimvar, xnobs )

Purpose

COMP_MVS computes estimates of means, variances and standard-deviations from a data matrix.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which basic univariate statistics are desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix of the data matrix.
  • LAST = false the current submatrix is not the last submatrix of the data matrix.
XMEAN (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantities on previous calls to COMP_MVS. XMEAN should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XMEAN contains the mean values.

The size of XMEAN must verify: size(XMEAN) = size(X,DIMVAR).

XVAR (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantities on previous calls to COMP_MVS. XVAR should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XVAR contains the variances.

The size of XVAR must verify: size(XVAR) = size(X,DIMVAR).

XSTD (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantities on previous calls to COMP_MVS. XSTD should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XSTD contains the standard deviations.

The size of XSTD must verify: size(XSTD) = size(X,DIMVAR).

DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data matrix. XNOBS needs to be specified only on the last call to COMP_MVS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid observation is present, the statistics are set to Nan code.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xnobs )

Purpose

COMP_MVS computes estimates of means, variances and standard-deviations from a tridimensional data array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantities on previous calls to COMP_MVS. XMEAN should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XMEAN contains the mean values.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2).
XVAR (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantities on previous calls to COMP_MVS. XVAR should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XVAR contains the variances.

The shape of XVAR must verify:

  • size(XVAR,1) = size(X,1)
  • size(XVAR,2) = size(X,2).
XSTD (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantities on previous calls to COMP_MVS. XSTD should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XSTD contains the standard deviations.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2).
XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data array. XNOBS needs to be specified only on the last call to COMP_MVS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid observation is present, the statistics are set to Nan code.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xnobs )

Purpose

COMP_MVS computes estimates of means, variances and standard-deviations from a fourdimensional data array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:,:)
On entry, input subarray containing size(X,4) observations on size(X,1) by size(X,2) by size(X,3) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantities on previous calls to COMP_MVS. XMEAN should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XMEAN contains the mean values.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2)
  • size(XMEAN,3) = size(X,3).
XVAR (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantities on previous calls to COMP_MVS. XVAR should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XVAR contains the variances.

The shape of XVAR must verify:

  • size(XVAR,1) = size(X,1)
  • size(XVAR,2) = size(X,2)
  • size(XVAR,3) = size(X,3).
XSTD (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantities on previous calls to COMP_MVS. XSTD should not be changed between calls to COMP_MVS.

On exit, when LAST=true, XSTD contains the standard deviations.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2)
  • size(XSTD,3) = size(X,3).
XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of observations in the data array. XNOBS needs to be specified only on the last call to COMP_MVS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid observation is present, the statistics are set to Nan code.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xmiss, xnobs )

Purpose

COMP_MVS_MISS computes estimates of mean, variance and standard-deviation from a data vector possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector of the data vector.
  • FIRST = false the current subvector is not the first subvector of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector of the data vector.
  • LAST = false the current subvector is not the last subvector of the data vector.
XMEAN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantity on previous calls to COMP_MVS_MISS. XMEAN should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XMEAN contains the mean value of the data vector.

XVAR (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantity on previous calls to COMP_MVS_MISS. XVAR should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XVAR contains the variance of the data vector.

XSTD (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantity on previous calls to COMP_MVS_MISS. XSTD should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XSTD contains the standard deviation of the data vector.

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XNOBS (OUTPUT, OPTIONAL) integer(i4b)
On exit, XNOBS contains the number of non-missing observations in the data vector. XNOBS needs to be specified only on the last call to COMP_MVS_MISS (e.g. when LAST=true).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid (non-missing) observation is present, the pertinent statistics are set to XMISS.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xmiss, dimvar, xnobs )

Purpose

COMP_MVS_MISS computes estimates of means, variances and standard-deviations from a data matrix possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which basic univariate statistics are desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix of the data matrix.
  • LAST = false the current submatrix is not the last submatrix of the data matrix.
XMEAN (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XMEAN should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XMEAN contains the mean values.

The size of XMEAN must verify: size(XMEAN) = size(X,DIMVAR).

XVAR (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XVAR should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XVAR contains the variances.

The size of XVAR must verify: size(XVAR) = size(X,DIMVAR).

XSTD (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XSTD should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XSTD contains the standard deviations.

The size of XSTD must verify: size(XSTD) = size(X,DIMVAR).

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

XNOBS (OUTPUT, OPTIONAL) integer(i4b), dimension(:)

On exit, XNOBS contains the numbers of non-missing observations on all variables. XNOBS needs to be specified only on the last call to COMP_MVS_MISS (e.g. when LAST=true).

The size of XNOBS must verify: size(XNOBS) = size(X,DIMVAR).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid (non-missing) observation is present for some variables, the pertinent statistics are set to XMISS.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xmiss, xnobs )

Purpose

COMP_MVS_MISS computes estimates of means, variances and standard-deviations from a tridimensional data array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XMEAN should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XMEAN contains the mean values.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2).
XVAR (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XVAR should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XVAR contains the variances.

The shape of XVAR must verify:

  • size(XVAR,1) = size(X,1)
  • size(XVAR,2) = size(X,2).
XSTD (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XSTD should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XSTD contains the standard deviations.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2).
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XNOBS (OUTPUT, OPTIONAL) integer(i4b), dimension(:,:)

On exit, XNOBS contains the numbers of non-missing observations on all variables. XNOBS needs to be specified only on the last call to COMP_MVS_MISS (e.g. when LAST=true).

The shape of XNOBS must verify:

  • size(XNOBS,1) = size(X,1)
  • size(XNOBS,2) = size(X,2).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid (non-missing) observation is present for some variables, the pertinent statistics are set to XMISS.

subroutine comp_mvs ( x, first, last, xmean, xvar, xstd, xmiss, xnobs )

Purpose

COMP_MVS_MISS computes estimates of means, variances and standard-deviations from a fourdimensional data array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:,:)
On entry, input subarray containing size(X,4) observations on size(X,1) by size(X,2) by size(X,3) variables from the array of data for which basic univariate statistics are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XMEAN is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XMEAN should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XMEAN contains the mean values.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2)
  • size(XMEAN,3) = size(X,3).
XVAR (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XVAR is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XVAR should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XVAR contains the variances.

The shape of XVAR must verify:

  • size(XVAR,1) = size(X,1)
  • size(XVAR,2) = size(X,2)
  • size(XVAR,3) = size(X,3).
XSTD (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_MISS (e.g. when FIRST=true), XSTD is used as workspace to accumulate quantities on previous calls to COMP_MVS_MISS. XSTD should not be changed between calls to COMP_MVS_MISS.

On exit, when LAST=true, XSTD contains the standard deviations.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2)
  • size(XSTD,3) = size(X,3).
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XNOBS (OUTPUT, OPTIONAL) integer(i4b), dimension(:,:,:)

On exit, XNOBS contains the numbers of non-missing observations on all variables. XNOBS needs to be specified only on the last call to COMP_MVS_MISS (e.g. when LAST=true).

The shape of XNOBS must verify:

  • size(XNOBS,1) = size(X,1)
  • size(XNOBS,2) = size(X,2)
  • size(XNOBS,3) = size(X,3).

Further Details

The subroutine computes the basic statistics with only one pass through the data.

If fewer than one valid (non-missing) observation is present for some variables, the pertinent statistics are set to XMISS.

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp )

Purpose

COMP_MVS_GRP computes estimates of univariate statistics by groups from a data vector.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which univariate statistics by groups are desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector
    of the data vector.
  • FIRST = false the current subvector is not the first subvector
    of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector
    of the data vector.
  • LAST = false the current subvector is not the last subvector
    of the data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data vector.

The size of XMEAN_GRP must verify: size(XMEAN_GRP) = NGRP .

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP. XSTD_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data vector.

The size of XSTD_GRP must verify: size(XSTD_GRP) = NGRP .

XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_MVS_GRP. XN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups of observations in the data vector.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present for some groups, the pertinent statistics are set to Nan code.

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp, dimvar )

Purpose

COMP_MVS_GRP computes estimates of univariate statistics by groups from a data matrix.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which univariate statistics by groups are desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix
    of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix
    of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix
    of the data matrix.
  • LAST = false the current submatrix is not the last submatrix
    of the data matrix.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3-DIMVAR) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3-DIMVAR) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data matrix.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,DIMVAR)
  • size(XMEAN_GRP,2) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP. XSTD_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data matrix.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,DIMVAR)
  • size(XSTD_GRP,2) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_MVS_GRP. XN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups for all the variables in the data matrix.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present for some groups, the pertinent statistics are set to Nan code.

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp )

Purpose

COMP_MVS_GRP computes estimates of univariate statistics by groups from a data tridimensional array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which univariate statistics by groups are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray
    of the data array.
  • FIRST = false the current subarray is not the first subarray
    of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray
    of the data array.
  • LAST = false the current subarray is not the last subarray
    of the data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP. XSTD_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_MVS_GRP. XN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups for all the variables in the data array.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present for some groups, the pertinent statistics are set to Nan code.

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp )

Purpose

COMP_MVS_GRP computes estimates of univariate statistics by groups from a data fourdimensional array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:,:)
On entry, input subarray containing size(X,4) observations on size(X,1) by size(X,2) by size(X,3) variables from the array of data for which univariate statistics by groups are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray
    of the data array.
  • FIRST = false the current subarray is not the first subarray
    of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray
    of the data array.
  • LAST = false the current subarray is not the last subarray
    of the data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,4) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,4) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = size(X,3)
  • size(XMEAN_GRP,4) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP. XSTD_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1),
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = size(X,3)
  • size(XSTD_GRP,4) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_MVS_GRP. XN_GRP should not be changed between calls to COMP_MVS_GRP.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups for all the variables in the data array.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present for some groups, the pertinent statistics are set to Nan code.

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp, xmiss )

Purpose

COMP_MVS_GRP_MISS computes estimates of univariate statistics by groups from a data vector possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which univariate statistics by groups are desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector
    of the data vector.
  • FIRST = false the current subvector is not the first subvector
    of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector
    of the data vector.
  • LAST = false the current subvector is not the last subvector
    of the data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data vector.

The size of XMEAN_GRP must verify: size(XMEAN_GRP) = NGRP .

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XSTD_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data vector.

The size of XSTD_GRP must verify: size(XSTD_GRP) = NGRP .

XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, XN_GRP contains the number of non-missing observations in the NGRP groups of observations in the data vector.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present for some groups of observations, the pertinent statistics are set to missing (XMISS value).

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp, xmiss, dimvar )

Purpose

COMP_MVS_GRP_MISS computes estimates of univariate statistics by groups from a data matrix possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which univariate statistics by groups are desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix
    of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix
    of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix
    of the data matrix.
  • LAST = false the current submatrix is not the last submatrix
    of the data matrix.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3-DIMVAR) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3-DIMVAR) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data matrix.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,DIMVAR)
  • size(XMEAN_GRP,2) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XSTD_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data matrix.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,DIMVAR)
  • size(XSTD_GRP,2) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, XN_GRP contains the numbers of non-missing observations in the NGRP groups for all the variables in the data matrix.

The shape of XN_GRP must verify:

  • size(XN_GRP,1) = size(X,DIMVAR)
  • size(XN_GRP,2) = NGRP.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present for some variables and/or groups of observations, the pertinent statistics are set to missing (XMISS value).

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp, xmiss )

Purpose

COMP_MVS_GRP_MISS computes estimates of univariate statistics by groups from a data tridimensional array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which univariate statistics by groups are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray
    of the data array.
  • FIRST = false the current subarray is not the first subarray
    of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray
    of the data array.
  • LAST = false the current subarray is not the last subarray
    of the data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XSTD_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XN_GRP contains the numbers of non-missing observations in the NGRP groups for all the variables in the data array.

The shape of XN_GRP must verify:

  • size(XN_GRP,1) = size(X,1)
  • size(XN_GRP,2) = size(X,2)
  • size(XN_GRP,3) = NGRP.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present for some variables and/or groups of observations, the pertinent statistics are set to missing (XMISS value).

subroutine comp_mvs_grp ( x, first, last, ngrp, ind, xmean_grp, xstd_grp, xn_grp, xmiss )

Purpose

COMP_MVS_GRP_MISS computes estimates of univariate statistics by groups from a data fourdimensional array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:,:)
On entry, input subarray containing size(X,4) observations on size(X,1) by size(X,2) by size(X,3) variables from the array of data for which univariate statistics by groups are desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray
    of the data array.
  • LAST = false the current subarray is not the last subarray
    of the data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,4) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,4) .

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XMEAN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = size(X,3)
  • size(XMEAN_GRP,4) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XSTD_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = size(X,3)
  • size(XSTD_GRP,4) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, after the first call to COMP_MVS_GRP_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_MVS_GRP_MISS. XN_GRP should not be changed between calls to COMP_MVS_GRP_MISS.

On exit, when LAST=true, XN_GRP contains the numbers of non-missing observations in the NGRP groups for all the variables in the data array.

The shape of XN_GRP must verify:

  • size(XN_GRP,1) = size(X,1)
  • size(XN_GRP,2) = size(X,2)
  • size(XN_GRP,3) = size(X,3)
  • size(XN_GRP,4) = NGRP.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present for some variables and/or groups of observations, the pertinent statistics are set to missing (XMISS value).

subroutine update_mvs ( xmean, xvar, xnobs, xmean2, xvar2, xnobs2 )

Purpose

UPDATE_MVS computes sample mean and corrected sum of squares for a sample of size XNOBS+XNOBS2 given the means and corrected sums of squares for two subsamples of size XNOBS and XNOBS2 as output by a call to COMP_MVS when LAST=false on the two subsamples separetely.

The sample means, standard-deviations for the sample of size XNOBS+XNOBS2 may be obtained by a call to COMP_MVS with LAST=true.

Arguments

XMEAN (INPUT/OUTPUT) real(stnd)

On entry, the sample mean of the first sample of size XNOBS.

On exit, the sample mean of the combined sample of size XNOBS+XNOBS2.

XVAR (INPUT/OUTPUT) real(stnd)

On entry, the corrected sum of squares of the first sample of size XNOBS.

On exit, the corrected sum of squares of the combined sample of size XNOBS+XNOBS2.

XNOBS (INPUT/OUTPUT) real(stnd)

On entry, the number of observations of the first sample.

On exit, the number of observations of the combined sample (i.e. XNOBS+XNOBS2).

XMEAN2 (INPUT) real(stnd)
On entry, the sample mean of the second sample of size XNOBS2.
XVAR2 (INPUT) real(stnd)
On entry, the corrected sum of squares of the second sample of size XNOBS2.
XNOBS2 (INPUT) real(stnd)
On entry, the number of observations of the second sample.

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS. The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs ( xmean, xvar, xnobs, xmean2, xvar2, xnobs2 )

Purpose

UPDATE_MVS computes sample means and corrected sums of squares by groups for a sample of size XNOBS+XNOBS2 given the means and corrected sums of squares for two subsamples of size XNOBS and XNOBS2 as output by a call to COMP_MVS when LAST=false on the two subsamples separetely.

The sample means, standard-deviations for the sample of size XNOBS+XNOBS2 may be obtained by a call to COMP_MVS with LAST=true.

Arguments

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the sample means of the first sample of size XNOBS.

On exit, the sample means of the combined sample of size XNOBS+XNOBS2.

XVAR (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the corrected sums of squares of the first sample of size XNOBS.

On exit, the corrected sums of squares of the combined sample of size XNOBS+XNOBS2.

The shape of XVAR must verify: size(XVAR) = size(XMEAN).

XNOBS (INPUT/OUTPUT) real(stnd)

On entry, the number of observations of the first sample.

On exit, the number of observations of the combined sample (i.e. XNOBS+XNOBS2).

XMEAN2 (INPUT) real(stnd), dimension(:)

On entry, the sample means of the second sample of size XNOBS2.

The shape of XMEAN2 must verify: size(XMEAN2) = size(XMEAN).

XVAR2 (INPUT) real(stnd), dimension(:)

On entry, the corrected sum of squares of the second sample of size XNOBS2.

The shape of XVAR2 must verify: size(XVAR2) = size(XMEAN).

XNOBS2 (INPUT) real(stnd)
On entry, the number of observations of the second sample.

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS. The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs ( xmean, xvar, xnobs, xmean2, xvar2, xnobs2 )

Purpose

UPDATE_MVS computes sample means and corrected sums of squares by groups for a sample of size XNOBS+XNOBS2 given the means and corrected sums of squares for two subsamples of size XNOBS and XNOBS2 as output by a call to COMP_MVS when LAST=false on the two subsamples separetely.

The sample means, standard-deviations for the sample of size XNOBS+XNOBS2 may be obtained by a call to COMP_MVS with LAST=true.

Arguments

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the sample means of the first sample of size XNOBS.

On exit, the sample means of the combined sample of size XNOBS+XNOBS2.

XVAR (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the corrected sums of squares of the first sample of size XNOBS.

On exit, the corrected sums of squares of the combined sample of size XNOBS+XNOBS2

The shape of XVAR must verify:

  • size(XVAR,1) = size(XMEAN,1)
  • size(XVAR,2) = size(XMEAN,2).
XNOBS (INPUT/OUTPUT) real(stnd)

On entry, the number of observations of the first sample.

On exit, the number of observations of the combined sample (i.e. XNOBS+XNOBS2).

XMEAN2 (INPUT) real(stnd), dimension(:,:)

On entry, the sample means of the second sample of size XNOBS2.

The shape of XMEAN2 must verify:

  • size(XMEAN2,1) = size(XMEAN,1)
  • size(XMEAN2,2) = size(XMEAN,2).
XVAR2 (INPUT) real(stnd), dimension(:,:)

On entry, the corrected sum of squares of the second sample of size XNOBS2.

The shape of XVAR2 must verify:

  • size(XVAR2,1) = size(XMEAN,1)
  • size(XVAR2,2) = size(XMEAN,2).
XNOBS2 (INPUT) real(stnd), dimension(:)
On entry, the number of observations of the second sample.

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS. The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs ( xmean, xvar, xnobs, xmean2, xvar2, xnobs2 )

Purpose

UPDATE_MVS computes sample means and corrected sums of squares by groups for a sample of size XNOBS+XNOBS2 given the means and corrected sums of squares for two subsamples of size XNOBS and XNOBS2 as output by a call to COMP_MVS when LAST=false on the two subsamples separetely.

The sample means, standard-deviations for the sample of size XNOBS+XNOBS2 may be obtained by a call to COMP_MVS with LAST=true.

Arguments

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the sample means of the first sample of size XNOBS.

On exit, the sample means of the combined sample of size XNOBS+XNOBS2.

XVAR (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the corrected sums of squares of the first sample of size XNOBS.

On exit, the corrected sums of squares of the combined sample of size XNOBS+XNOBS2.

The shape of XVAR must verify:

  • size(XVAR,1) = size(XMEAN,1)
  • size(XVAR,2) = size(XMEAN,2)
  • size(XVAR,3) = size(XMEAN,3).
XNOBS (INPUT/OUTPUT) real(stnd)

On entry, the number of observations of the first sample.

On exit, the number of observations of the combined sample (i.e. XNOBS+XNOBS2).

XMEAN2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the sample means of the second sample of size XNOBS2.

The shape of XMEAN2 must verify:

  • size(XMEAN2,1) = size(XMEAN,1)
  • size(XMEAN2,2) = size(XMEAN,2)
  • size(XMEAN2,3) = size(XMEAN,3).
XVAR2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the corrected sum of squares of the second sample of size XNOBS2.

The shape of XVAR2 must verify:

  • size(XVAR2,1) = size(XMEAN,1)
  • size(XVAR2,2) = size(XMEAN,2)
  • size(XVAR2,3) = size(XMEAN,3).
XNOBS2 (INPUT) real(stnd)
On entry, the number of observations of the second sample.

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS. The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP computes sample means and corrected sums of squares by groups for a sample of size sum(XN_GRP)+sum(XN_GRP2) given the means and corrected sums of squares for two subsamples of size sum(XN_GRP) and sum(XN_GRP2) as output by a call to COMP_MVS_GRP when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample of size sum(XN_GRP)+sum(XN_GRP2) may be obtained by a call to COMP_MVS_GRP with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the sample means for the groups computed on the first sample.

On exit, the sample means for the groups computed on the combined sample.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the sample corrected sums of squares for the groups computed on the first sample.

On exit, the sample corrected sums of squares for the groups computed on the combined sample.

The shape of XSTD_GRP must verify: size(XSTD_GRP) = size(XMEAN_GRP).

XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the first sample.

On exit, the number of observations in each group in the combined sample.

The size of XN_GRP must verify: size(XN_GRP) = size(XMEAN_GRP) .

XMEAN_GRP2 (INPUT) real(stnd), dimension(:)

On entry, the sample means for the groups computed on the second sample.

The shape of XMEAN_GRP2 must verify: size(XMEAN_GRP2) = size(XMEAN_GRP).

XSTD_GRP2 (INPUT) real(stnd), dimension(:)

On entry, the sample corrected sums of squares for the groups computed on the second sample.

The shape of XSTD_GRP2 must verify: size(XSTD_GRP2) = size(XMEAN_GRP).

XN_GRP2 (INPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the second sample.

The size of XN_GRP2 must verify: size(XN_GRP2) = size(XMEAN_GRP) .

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP.

The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP computes sample means and corrected sums of squares by groups for a sample of size sum(XN_GRP)+sum(XN_GRP2) given the means and corrected sums of squares for two subsamples of size sum(XN_GRP) and sum(XN_GRP2) as output by a call to COMP_MVS_GRP when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample of size sum(XN_GRP)+sum(XN_GRP2) may be obtained by a call to COMP_MVS_GRP with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the sample means for the groups computed on the first sample vector.

On exit, the sample means for the groups computed on the combined sample vector.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the sample corrected sums of squares for the groups computed on the first sample vector.

On exit, the sample corrected sums of squares for the groups computed on the combined sample vector.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP,2) = size(XMEAN_GRP,2).
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the first sample vector.

On exit, the number of observations in each group in the combined sample vector.

The size of XN_GRP must verify: size(XN_GRP) = size(XMEAN_GRP,2) .

XMEAN_GRP2 (INPUT) real(stnd), dimension(:,:)

On entry, the sample means for the groups computed on the second sample vector.

The shape of XMEAN_GRP2 must verify:

  • size(XMEAN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XMEAN_GRP2,2) = size(XMEAN_GRP,2)
XSTD_GRP2 (INPUT) real(stnd), dimension(:,:)

On entry, the sample corrected sums of squares for the groups computed on the second sample vector.

The shape of XSTD_GRP2 must verify:

  • size(XSTD_GRP2,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP2,2) = size(XMEAN_GRP,2).
XN_GRP2 (INPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the second sample vector.

The size of XN_GRP2 must verify: size(XN_GRP2) = size(XMEAN_GRP,2) .

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP.

The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP computes sample means and corrected sums of squares by groups for a sample of size sum(XN_GRP)+sum(XN_GRP2) given the means and corrected sums of squares for two subsamples of size sum(XN_GRP) and sum(XN_GRP2) as output by a call to COMP_MVS_GRP when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample of size sum(XN_GRP)+sum(XN_GRP2) may be obtained by a call to COMP_MVS_GRP with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the sample means for the groups computed on the first sample matrix.

On exit, the sample means for the groups computed on the combined sample matrix.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the first sample matrix.

On exit, the sample corrected sums of squares for the groups computed on the combined sample matrix.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP,3) = size(XMEAN_GRP,3).
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the first sample matrix.

On exit, the number of observations in each group in the combined sample matrix.

The size of XN_GRP must verify: size(XN_GRP) = size(XMEAN_GRP,3) .

XMEAN_GRP2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the sample means for the groups computed on the second sample matrix.

The shape of XMEAN_GRP2 must verify:

  • size(XMEAN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XMEAN_GRP2,2) = size(XMEAN_GRP,2)
  • size(XMEAN_GRP2,3) = size(XMEAN_GRP,3).
XSTD_GRP2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the second sample matrix.

The shape of XSTD_GRP2 must verify:

  • size(XSTD_GRP2,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP2,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP2,3) = size(XMEAN_GRP,3).
XN_GRP2 (INPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the second sample matrix.

The size of XN_GRP2 must verify: size(XN_GRP2) = size(XMEAN_GRP,3) .

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP.

The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP computes sample means and corrected sums of squares by groups for a sample of size sum(XN_GRP)+sum(XN_GRP2) given the means and corrected sums of squares for two subsamples of size sum(XN_GRP) and sum(XN_GRP2) as output by a call to COMP_MVS_GRP when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample of size sum(XN_GRP)+sum(XN_GRP2) may be obtained by a call to COMP_MVS_GRP with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample means for the groups computed on the first sample array.

On exit, the sample means for the groups computed on the combined sample array.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the first sample array.

On exit, the sample corrected sums of squares for the groups computed on the combined sample array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP,3) = size(XMEAN_GRP,3)
  • size(XSTD_GRP,4) = size(XMEAN_GRP,4).
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the first sample array.

On exit, the number of observations in each group in the combined sample array.

The size of XN_GRP must verify: size(XN_GRP) = size(XMEAN_GRP,4) .

XMEAN_GRP2 (INPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample means for the groups computed on the second sample array.

The shape of XMEAN_GRP2 must verify:

  • size(XMEAN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XMEAN_GRP2,2) = size(XMEAN_GRP,2)
  • size(XMEAN_GRP2,3) = size(XMEAN_GRP,3)
  • size(XMEAN_GRP2,4) = size(XMEAN_GRP,4).
XSTD_GRP2 (INPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the second sample array.

The shape of XSTD_GRP2 must verify:

  • size(XSTD_GRP2,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP2,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP2,3) = size(XMEAN_GRP,3)
  • size(XSTD_GRP2,4) = size(XMEAN_GRP,4).
XN_GRP2 (INPUT) real(stnd), dimension(:)

On entry, the number of observations in each group in the second sample array.

The size of XN_GRP2 must verify: size(XN_GRP2) = size(XMEAN_GRP,4) .

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP.

The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP_MISS computes sample means and corrected sums of squares by groups for a sample, possibly containing missing values, given the means and corrected sums of squares for two subsamples as output by a call to COMP_MVS_GRP_MISS when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample may be obtained by a call to COMP_MVS_GRP_MISS with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the sample means for the groups computed on the first sample vector.

On exit, the sample means for the groups computed on the combined sample vector.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the sample corrected sums of squares for the groups computed on the first sample vector.

On exit, the sample corrected sums of squares for the groups computed on the combined sample vector.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP,2) = size(XMEAN_GRP,2).
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the number of observations in each group in the first sample vector.

On exit, the number of observations in each group in the combined sample vector.

The shape of XSTD_GRP must verify:

  • size(XN_GRP,1) = size(XMEAN_GRP,1)
  • size(XN_GRP,2) = size(XMEAN_GRP,2).
XMEAN_GRP2 (INPUT) real(stnd), dimension(:,:)

On entry, the sample means for the groups computed on the second sample vector.

The shape of XMEAN_GRP2 must verify:

  • size(XMEAN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XMEAN_GRP2,2) = size(XMEAN_GRP,2).
XSTD_GRP2 (INPUT) real(stnd), dimension(:,:)

On entry, the sample corrected sums of squares for the groups computed on the second sample vector.

The shape of XSTD_GRP2 must verify:

  • size(XSTD_GRP2,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP2,2) = size(XMEAN_GRP,2).
XN_GRP2 (INPUT) real(stnd), dimension(:,:)

On entry, the number of observations in each group in the second sample vector.

The shape of XSTD_GRP must verify:

  • size(XN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XN_GRP2,2) = size(XMEAN_GRP,2).

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP_MISS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP_MISS.

The means, variances and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP_MISS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP_MISS computes sample means and corrected sums of squares by groups for a sample, possibly containing missing values, given the means and corrected sums of squares for two subsamples as output by a call to COMP_MVS_GRP_MISS when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample may be obtained by a call to COMP_MVS_GRP_MISS with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the sample means for the groups computed on the first sample matrix.

On exit, the sample means for the groups computed on the combined sample matrix.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the first sample matrix.

On exit, the sample corrected sums of squares for the groups computed on the combined sample matrix.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP,3) = size(XMEAN_GRP,3).
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, the number of observations in each group in the first sample matrix.

On exit, the number of observations in each group in the combined sample matrix.

The shape of XSTD_GRP must verify:

  • size(XN_GRP,1) = size(XMEAN_GRP,1)
  • size(XN_GRP,2) = size(XMEAN_GRP,2)
  • size(XN_GRP,3) = size(XMEAN_GRP,3).
XMEAN_GRP2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the sample means for the groups computed on the second sample matrix.

The shape of XMEAN_GRP2 must verify:

  • size(XMEAN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XMEAN_GRP2,2) = size(XMEAN_GRP,2)
  • size(XMEAN_GRP2,3) = size(XMEAN_GRP,3).
XSTD_GRP2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the second sample matrix.

The shape of XSTD_GRP2 must verify:

  • size(XSTD_GRP2,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP2,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP2,3) = size(XMEAN_GRP,3).
XN_GRP2 (INPUT) real(stnd), dimension(:,:,:)

On entry, the number of observations in each group in the second sample matrix.

The shape of XSTD_GRP must verify:

  • size(XN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XN_GRP2,2) = size(XMEAN_GRP,2)
  • size(XN_GRP2,3) = size(XMEAN_GRP,3).

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP_MISS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP_MISS.

The means, variances and and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP_MISS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine update_mvs_grp ( xmean_grp, xstd_grp, xn_grp, xmean_grp2, xstd_grp2, xn_grp2 )

Purpose

UPDATE_MVS_GRP_MISS computes sample means and corrected sums of squares by groups for a sample, possibly containing missing values, given the means and corrected sums of squares for two subsamples as output by a call to COMP_MVS_GRP_MISS when LAST=false on the two subsamples separetely.

The sample means, variances and standard-deviations for the sample may be obtained by a call to COMP_MVS_GRP_MISS with LAST=true.

Arguments

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample means for the groups computed on the first sample array.

On exit, the sample means for the groups computed on the combined sample array.

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the first sample array.

On exit, the sample corrected sums of squares for the groups computed on the combined sample array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP,3) = size(XMEAN_GRP,3)
  • size(XSTD_GRP,4) = size(XMEAN_GRP,4).
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:,:)

On entry, the number of observations in each group in the first sample array.

On exit, the number of observations in each group in the combined sample array.

The shape of XSTD_GRP must verify:

  • size(XN_GRP,1) = size(XMEAN_GRP,1)
  • size(XN_GRP,2) = size(XMEAN_GRP,2)
  • size(XN_GRP,3) = size(XMEAN_GRP,3)
  • size(XN_GRP,4) = size(XMEAN_GRP,4).
XMEAN_GRP2 (INPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample means for the groups computed on the second sample array.

The shape of XMEAN_GRP2 must verify:

  • size(XMEAN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XMEAN_GRP2,2) = size(XMEAN_GRP,2)
  • size(XMEAN_GRP2,3) = size(XMEAN_GRP,3)
  • size(XMEAN_GRP2,4) = size(XMEAN_GRP,4).
XSTD_GRP2 (INPUT) real(stnd), dimension(:,:,:,:)

On entry, the sample corrected sums of squares for the groups computed on the second sample array.

The shape of XSTD_GRP2 must verify:

  • size(XSTD_GRP2,1) = size(XMEAN_GRP,1)
  • size(XSTD_GRP2,2) = size(XMEAN_GRP,2)
  • size(XSTD_GRP2,3) = size(XMEAN_GRP,3)
  • size(XSTD_GRP2,4) = size(XMEAN_GRP,4).
XN_GRP2 (INPUT) real(stnd), dimension(:,:,:,:)

On entry, the number of observations in each group in the second sample array.

The shape of XSTD_GRP must verify:

  • size(XN_GRP2,1) = size(XMEAN_GRP,1)
  • size(XN_GRP2,2) = size(XMEAN_GRP,2)
  • size(XN_GRP2,3) = size(XMEAN_GRP,3).
  • size(XN_GRP2,4) = size(XMEAN_GRP,4).

Further Details

One possible application of this subroutine is to parallel processing. If one has two or more processors available, the sample can be split up into smaller subsamples, and the means and corrected sums of squares computed for each subsample independently using COMP_MVS_GRP_MISS. The means and corrected sums of squares for the original sample can then be calculated using UPDATE_MVS_GRP_MISS.

The means, variances and and standard-deviations for the original sample can be computed by a final call to COMP_MVS_GRP_MISS with LAST=true.

This subroutine is adapted from:

  1. Chan, T.F., Golub, G.H., and Leveque, R.J., 1979:
    Updating formulae and a pairwise algorithm for computing sample variances. STAN-CS-79-773, November 1979.

subroutine comp_anoma ( x, xmean, xstd )

Purpose

COMP_ANOMA computes (standardized) anomalies from a data vector.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which standardization is desired. If all the data are available at once, X can be the full data vector.
XMEAN (INPUT) real(stnd)
On entry, XMEAN contains the mean value of the data vector.
XSTD (INPUT, OPTIONAL) real(stnd)
On entry, if XSTD is present, XSTD contains the standard deviation of the data vector and the anomalies are standardized.

Further Details

It is assumed that the argument XSTD is greater than zero.

subroutine comp_anoma ( x, xmean, xstd, dimvar )

Purpose

COMP_ANOMA computes (standardized) anomalies from a data matrix.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which standardization is desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data vector.
XMEAN (INPUT) real(stnd), dimension(:)

On entry, XMEAN contains the mean values.

The size of XMEAN must verify: size(XMEAN) = size(X,DIMVAR).

XSTD (INPUT, OPTIONAL) real(stnd), dimension(:)

On entry, if XSTD is present, XSTD contains the standard deviations and the anomalies are standardized.

The size of XSTD must verify: size(XSTD) = size(X,DIMVAR).

DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

Further Details

It is assumed that elements of the array argument XSTD are greater than zero.

subroutine comp_anoma ( x, xmean, xstd )

Purpose

COMP_ANOMA computes (standardized) anomalies from a data matrix.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which standardization is desired. If all the data are available at once, X can be the full data array.
XMEAN (INPUT) real(stnd), dimension(:,:)

On entry, XMEAN contains the mean values.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2).
XSTD (INPUT, OPTIONAL) real(stnd), dimension(:,:)

On entry, if XSTD is present, XSTD contains the standard deviations and the anomalies are standardized.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2).

Further Details

It is assumed that elements of the array argument XSTD are greater than zero.

subroutine comp_anoma_miss ( x, xmiss, xmean, xstd )

Purpose

COMP_ANOMA_MISS computes (standardized) anomalies from a data vector possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which standardization is desired. If all the data are available at once, X can be the full data vector.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XMEAN (INPUT) real(stnd)
On entry, XMEAN contains the mean value of the data vector.
XSTD (INPUT, OPTIONAL) real(stnd)
On entry, if XSTD is present, XSTD contains the standard deviation of the data vector and the anomalies are standardized.

Further Details

It is assumed that the argument XMEAN is not missing.

It is assumed that the argument XSTD is greater than zero and is not missing.

subroutine comp_anoma_miss ( x, xmiss, xmean, xstd, dimvar )

Purpose

COMP_ANOMA_MISS computes (standardized) anomalies from a data matrix possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which standardization is desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data vector.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XMEAN (INPUT) real(stnd), dimension(:)

On entry, XMEAN contains the mean values.

The size of XMEAN must verify: size(XMEAN) = size(X,DIMVAR).

XSTD (INPUT, OPTIONAL) real(stnd), dimension(:)

On entry, if XSTD is present, XSTD contains the standard deviations and the anomalies are standardized.

The size of XSTD must verify: size(XSTD) = size(X,DIMVAR).

DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

Further Details

It is assumed that elements of the array argument XMEAN are not missing.

It is assumed that elements of the array argument XSTD are greater than zero and are not missing.

subroutine comp_anoma_miss ( x, xmiss, xmean, xstd )

Purpose

COMP_ANOMA_MISS computes (standardized) anomalies from a data matrix possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which standardization is desired. If all the data are available at once, X can be the full data array.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XMEAN (INPUT) real(stnd), dimension(:,:)

On entry, XMEAN contains the mean values.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2).
XSTD (INPUT, OPTIONAL) real(stnd), dimension(:,:)

On entry, if XSTD is present, XSTD contains the standard deviations and the anomalies are standardized.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2).

Further Details

It is assumed that elements of the array argument XMEAN are not missing.

It is assumed that elements of the array argument XSTD are greater than zero and are not missing.

subroutine comp_anoma_grp ( x, ngrp, ind, xmean_grp, xstd_grp )

Purpose

COMP_ANOMA_GRP computes (standardized) anomalies by groups from a data vector.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which standardization by groups is desired. If all the data are available at once, X can be the full data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group and this observation is not standardized.

The size of IND must verify: size(IND) = size(X) .

XMEAN_GRP (INPUT) real(stnd), dimension(:)

On entry, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data vector.

The size of XMEAN_GRP must verify: size(XMEAN_GRP) = NGRP .

XSTD_GRP (INPUT, OPTIONAL) real(stnd), dimension(:)

On entry, if XSTD_GRP is present, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data vector and the observations are standardized.

The size of XSTD_GRP must verify: size(XSTD_GRP) = NGRP .

Further Details

It is assumed that elements of the array argument XSTD_GRP are greater than zero.

subroutine comp_anoma_grp ( x, ngrp, ind, xmean_grp, xstd_grp, dimvar )

Purpose

COMP_ANOMA_GRP computes (standardized) anomalies by groups from a data matrix.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which standardization by groups is desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3-DIMVAR) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group and this observation is not standardized.

The size of IND must verify: size(IND) = size(X,3-DIMVAR) .

XMEAN_GRP (INPUT) real(stnd), dimension(:,:)

On entry, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data matrix.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,DIMVAR)
  • size(XMEAN_GRP,2) = NGRP.
XSTD_GRP (INPUT, OPTIONAL) real(stnd), dimension(:,:)

On entry, if XSTD_GRP is present, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data matrix and the observations are standardized.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,DIMVAR)
  • size(XSTD_GRP,2) = NGRP.
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

Further Details

It is assumed that elements of the array argument XSTD_GRP are greater than zero.

subroutine comp_anoma_grp ( x, ngrp, ind, xmean_grp, xstd_grp )

Purpose

COMP_ANOMA_GRP computes (standardized) anomalies by groups from a data matrix possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which standardization by groups is desired. If all the data are available at once, X can be the full data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group and this observation is not standardized.

The size of IND must verify: size(IND) = size(X,3) .

XMEAN_GRP (INPUT) real(stnd), dimension(:,:,:)

On entry, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = NGRP.
XSTD_GRP (INPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On entry, if XSTD_GRP is present, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data array and the observations are standardized.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = NGRP.

Further Details

It is assumed that elements of the array argument XSTD_GRP are greater than zero.

subroutine comp_anoma_grp_miss ( x, ngrp, ind, xmiss, xmean_grp, xstd_grp )

Purpose

COMP_ANOMA_GRP_MISS computes (standardized) anomalies by groups from a data vector possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which standardization by groups is desired. If all the data are available at once, X can be the full data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group and this observation is not standardized.

The size of IND must verify: size(IND) = size(X) .

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XMEAN_GRP (INPUT) real(stnd), dimension(:)

On entry, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data vector.

The size of XMEAN_GRP must verify: size(XMEAN_GRP) = NGRP .

XSTD_GRP (INPUT, OPTIONAL) real(stnd), dimension(:)

On entry, if XSTD_GRP is present, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data vector and the observations are standardized.

The size of XSTD_GRP must verify: size(XSTD_GRP) = NGRP .

Further Details

It is assumed that elements of the array argument XMEAN_GRP are not missing.

It is assumed that elements of the array argument XSTD_GRP are greater than zero and are not missing.

subroutine comp_anoma_grp_miss ( x, ngrp, ind, xmiss, xmean_grp, xstd_grp, dimvar )

Purpose

COMP_ANOMA_GRP_MISS computes (standardized) anomalies by groups from a data matrix possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which standardization by groups is desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3-DIMVAR) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group and this observation is not standardized.

The size of IND must verify: size(IND) = size(X,3-DIMVAR) .

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XMEAN_GRP (INPUT) real(stnd), dimension(:,:)

On entry, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data matrix.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,DIMVAR)
  • size(XMEAN_GRP,2) = NGRP.
XSTD_GRP (INPUT, OPTIONAL) real(stnd), dimension(:,:)

On entry, if XSTD_GRP is present, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data matrix and the observations are standardized.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,DIMVAR)
  • size(XSTD_GRP,2) = NGRP.
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

Further Details

It is assumed that elements of the array argument XMEAN_GRP are not missing.

It is assumed that elements of the array argument XSTD_GRP are greater than zero and are not missing.

subroutine comp_anoma_grp_miss ( x, ngrp, ind, xmiss, xmean_grp, xstd_grp )

Purpose

COMP_ANOMA_GRP_MISS computes (standardized) anomalies by groups from a data matrix possibly containing missing values.

Arguments

X (INPUT/OUTPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which standardization by groups is desired. If all the data are available at once, X can be the full data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group and this observation is not standardized.

The size of IND must verify: size(IND) = size(X,3) .

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XMEAN_GRP (INPUT) real(stnd), dimension(:,:,:)

On entry, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = NGRP.
XSTD_GRP (INPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On entry, if XSTD_GRP is present, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data array and the observations are standardized.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = NGRP.

Further Details

It is assumed that elements of the array argument XMEAN_GRP are not missing.

It is assumed that elements of the array argument XSTD_GRP are greater than zero and are not missing.

subroutine comp_composite ( x, first, last, ngrp, ind, xmean, xstd, xn, xmean_grp, xstd_grp, xn_grp, xcomp, u, prob, utest )

Purpose

COMP_COMPOSITE computes a composite analysis from a data vector.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which a composite analysis is desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector of the data vector.
  • FIRST = false the current subvector is not the first subvector of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector
    of the data vector.
  • LAST = false the current subvector is not the last subvector
    of the data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups in the analysis.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X) .

XMEAN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XMEAN contains the mean value from previous calls to COMP_COMPOSITE. XMEAN should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XMEAN contains the mean value of the data vector.

XSTD (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XSTD contains adjusted sum of squares from previous calls to COMP_COMPOSITE. XSTD should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XSTD contains the standard deviation of the data vector.

XN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XN contains count of observations from previous calls to COMP_COMPOSITE. XN should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XN contains the number of observations in the data vector.

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_COMPOSITE. XMEAN_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data vector.

The size of XMEAN_GRP must verify: size(XMEAN_GRP) = NGRP .

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_COMPOSITE. XSTD_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data vector.

The size of XSTD_GRP must verify: size(XSTD_GRP) = NGRP .

XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_COMPOSITE. XN_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups of observations in the data vector.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

XCOMP (OUTPUT, OPTIONAL) real(stnd), dimension(:)

On exit, the standardized profiles of the NGRP groups of observations in the data vector.

The size of XCOMP must verify: size(XCOMP) = NGRP .

U (OUTPUT, OPTIONAL) real(stnd), dimension(:)

On exit, the U statistics for the NGRP groups of observations in the data vector.

The size of U must verify: size(U) = NGRP .

PROB (OUTPUT, OPTIONAL) real(stnd), dimension(:)

On exit, the significance probabilities of the U statistics under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

The size of PROB must verify: size(PROB) = NGRP .

UTEST (INPUT/OUTPUT, OPTIONAL) real(stnd)

On entry, a probability. UTEST is the sum of the areas (equal) in both tails of the normal-distribution. UTEST must verify: 0. < P < 1.

On exit, the two-tail quantile of the normal-distribution, that is a value X such that the probability of the absolute value of U being greater than X is UTEST under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present, the statistics are set to Nan code.

The optional parameters need only to be specified when LAST=true.

For more details, on the statistics and tests computed by this subroutine, see:

  1. Terray, P., Delecluse, P., Labattu, S., Terray, L., 2003:
    Sea Surface Temperature associations with the Late Indian Summer Monsoon. Climate Dynamics, vol. 21, 593-618.

subroutine comp_composite ( x, first, last, ngrp, ind, xmean, xstd, xn, xmean_grp, xstd_grp, xn_grp, dimvar, xcomp, u, prob, utest )

Purpose

COMP_COMPOSITE computes a composite analysis from a data matrix.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which a composite analysis is desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix
    of the data matrix.
  • LAST = false the current submatrix is not the last submatrix
    of the data matrix.
NGRP (INPUT) integer(i4b)
On entry, the number of groups in the analysis.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3-DIMVAR) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3-DIMVAR) .

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XMEAN contains the mean values from previous calls to COMP_COMPOSITE. XMEAN should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XMEAN contains the mean values of the data matrix.

The size of XMEAN must verify: size(XMEAN) = size(X,DIMVAR).

XSTD (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XSTD contains adjusted sums of squares from previous calls to COMP_COMPOSITE. XSTD should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XSTD contains the standard deviations of the data matrix.

The size of XSTD must verify: size(XSTD) = size(X,DIMVAR).

XN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XN contains count of observations from previous calls to COMP_COMPOSITE. XN should not be changed between calls to COMP_COMPOSITE.

On exit, XN contains the number of observations in the data matrix.

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_COMPOSITE. XMEAN_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data matrix.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,DIMVAR)
  • size(XMEAN_GRP,2) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_COMPOSITE. XSTD_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data matrix.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,DIMVAR)
  • size(XSTD_GRP,2) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_COMPOSITE. XN_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups for all the variables in the data matrix.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

XCOMP (OUTPUT, OPTIONAL) real(stnd), dimension(:,:)

On exit, the standardized profiles of the NGRP groups of observations in the data matrix.

The shape of XCOMP must verify:

  • size(XCOMP,1) = size(X,DIMVAR)
  • size(XCOMP,2) = NGRP.
U (OUTPUT, OPTIONAL) real(stnd), dimension(:,:)

On exit, the U statistics for the NGRP groups and all the variables in the data matrix.

The shape of U must verify:

  • size(U,1) = size(X,DIMVAR)
  • size(U,2) = NGRP.
PROB (OUTPUT, OPTIONAL) real(stnd), dimension(:,:)

On exit, the significance probabilities of the U statistics under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

The shape of PROB must verify:

  • size(PROB,1) = size(X,DIMVAR)
  • size(PROB,2) = NGRP.
UTEST (INPUT/OUTPUT, OPTIONAL) real(stnd)

On entry, a probability. UTEST is the sum of the areas (equal) in both tails of the normal-distribution. UTEST must verify: 0. < P < 1.

On exit, the two-tail quantile of the normal-distribution, that is a value X such that the probability of the absolute value of U being greater than X is UTEST under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present, the statistics are set to Nan code.

The optional parameters, except DIMVAR, need only to be specified when LAST=true.

For more details, on the statistics and tests computed by this subroutine, see:

  1. Terray, P., Delecluse, P., Labattu, S., Terray, L., 2003:
    Sea Surface Temperature associations with the Late Indian Summer Monsoon. Climate Dynamics, vol. 21, 593-618.

subroutine comp_composite ( x, first, last, ngrp, ind, xmean, xstd, xn, xmean_grp, xstd_grp, xn_grp, xcomp, u, prob, utest )

Purpose

COMP_COMPOSITE computes a composite analysis from a data tridimensional array.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which a composite analysis is desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray
    of the data array.
  • LAST = false the current subarray is not the last subarray
    of the data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups in the analysis.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3) .

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XMEAN contains the mean values from previous calls to COMP_COMPOSITE. XMEAN should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XMEAN contains the mean values of the data array.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2).
XSTD (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XSTD contains adjusted sums of squares from previous calls to COMP_COMPOSITE. XSTD should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XSTD contains the standard deviations of the data array.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2).
XN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XN contains counts of observations from previous calls to COMP_COMPOSITE. XN should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XN contains the number of observations in the data array.

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_COMPOSITE. XMEAN_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_COMPOSITE. XSTD_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE (e.g. when FIRST=true), XN_GRP contains counts of observations for the NGRP groups from previous calls to COMP_COMPOSITE. XN_GRP should not be changed between calls to COMP_COMPOSITE.

On exit, when LAST=true, XN_GRP contains the numbers of observations in the NGRP groups for all the variables in the data array.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

XCOMP (OUTPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On exit, the standardized profiles of the NGRP groups of observations in the data array.

The shape of XCOMP must verify:

  • size(XCOMP,1) = size(X,1)
  • size(XCOMP,2) = size(X,2)
  • size(XCOMP,3) = NGRP.
U (OUTPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On exit, the U statistics for the NGRP groups and all the variables in the data array.

The shape of U must verify:

  • size(U,1) = size(X,1)
  • size(U,2) = size(X,2)
  • size(U,3) = NGRP.
PROB (OUTPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On exit, the significance probabilities of the U statistics under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

The shape of PROB must verify:

  • size(PROB,1) = size(X,1)
  • size(PROB,2) = size(X,2)
  • size(PROB,3) = NGRP.
UTEST (INPUT/OUTPUT, OPTIONAL) real(stnd)

On entry, a probability. UTEST is the sum of the areas (equal) in both tails of the normal-distribution. UTEST must verify: 0. < P < 1.

On exit, the two-tail quantile of the normal-distribution, that is a value X such that the probability of the absolute value of U being greater than X is UTEST under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one observation is present, the statistics are set to Nan code.

The optional parameters need only to be specified when LAST=true.

For more details, on the statistics and tests computed by this subroutine, see:

  1. Terray, P., Delecluse, P., Labattu, S., Terray, L., 2003:
    Sea Surface Temperature associations with the Late Indian Summer Monsoon. Climate Dynamics, vol. 21, 593-618.

subroutine comp_composite ( x, first, last, ngrp, ind, xmean, xstd, xn, xmean_grp, xstd_grp, xn_grp, xmiss, xcomp, u, prob, utest )

Purpose

COMP_COMPOSITE_MISS computes a composite analysis from a data vector possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, input subvector containing size(X) observations from the vector of data for which a composite analysis is desired. If all the data are available at once, X can be the full data vector.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subvector is the first subvector of the data vector.
  • FIRST = false the current subvector is not the first subvector of the data vector.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subvector is the last subvector
    of the data vector.
  • LAST = false the current subvector is not the last subvector
    of the data vector.
NGRP (INPUT) integer(i4b)
On entry, the number of groups in the analysis.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X) .

XMEAN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XMEAN contains the mean value from previous calls to COMP_COMPOSITE_MISS. XMEAN should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XMEAN contains the mean value of the data vector.

XSTD (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XSTD contains adjusted sum of squares from previous calls to COMP_COMPOSITE_MISS. XSTD should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XSTD contains the standard deviation of the data vector.

XN (INPUT/OUTPUT) real(stnd)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XN contains count of non-missing observations from previous calls to COMP_COMPOSITE_MISS. XN should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XN contains the number of observations in the data vector.

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XMEAN_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations in the data vector.

The size of XMEAN_GRP must verify: size(XMEAN_GRP) = NGRP .

XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XSTD_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations in the data vector.

The size of XSTD_GRP must verify: size(XSTD_GRP) = NGRP .

XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XN_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, XN_GRP contains the number of non-missing observations in the NGRP groups of observations in the data vector.

The size of XN_GRP must verify: size(XN_GRP) = NGRP .

XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XCOMP (OUTPUT, OPTIONAL) real(stnd), dimension(:)

On exit, the standardized profiles of the NGRP groups.

The size of XCOMP must verify: size(XCOMP) = NGRP .

U (OUTPUT, OPTIONAL) real(stnd), dimension(:)

On exit, the U statistics for the NGRP groups of observations in the data vector.

The size of U must verify: size(U) = NGRP .

PROB (OUTPUT, OPTIONAL) real(stnd), dimension(:)

On exit, the significance probabilities of the U statistics under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

The size of PROB must verify: size(PROB) = NGRP .

UTEST (INPUT/OUTPUT, OPTIONAL) real(stnd)

On entry, a probability. UTEST is the sum of the areas (equal) in both tails of the normal-distribution. UTEST must verify: 0. < P < 1.

On exit, the two-tail quantile of the normal-distribution, that is a value X such that the probability of the absolute value of U being greater than X is UTEST under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present, the statistics are set to Nan code.

If fewer than one valid observation were present only for some groups of observations, the pertinent statistics are set to missing (XMISS value).

The optional parameters need only to be specified when LAST=true.

For more details, on the statistics and tests computed by this subroutine, see:

  1. Terray, P., Delecluse, P., Labattu, S., Terray, L., 2003:
    Sea Surface Temperature associations with the Late Indian Summer Monsoon. Climate Dynamics, vol. 21, 593-618.

subroutine comp_composite ( x, first, last, ngrp, ind, xmean, xstd, xn, xmean_grp, xstd_grp, xn_grp, xmiss, dimvar, xcomp, u, prob, utest )

Purpose

COMP_COMPOSITE_MISS computes a composite analysis from a data matrix possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, input submatrix containing size(X,3-DIMVAR) observations on size(X,DIMVAR) variables from the matrix of data for which a composite analysis is desired. By default, DIMVAR is equal to 1. See description of optional DIMVAR argument for details. If all the data are available at once, X can be the full data matrix.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current submatrix is the first submatrix of the data matrix.
  • FIRST = false the current submatrix is not the first submatrix of the data matrix.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current submatrix is the last submatrix of the data matrix.
  • LAST = false the current submatrix is not the last submatrix of the data matrix.
NGRP (INPUT) integer(i4b)
On entry, the number of groups in the analysis.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3-DIMVAR) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3-DIMVAR) .

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XMEAN contains the mean values from previous calls to COMP_COMPOSITE_MISS. XMEAN should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XMEAN contains the mean values of the data matrix.

The size of XMEAN must verify: size(XMEAN) = size(X,DIMVAR).

XSTD (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XSTD contains adjusted sums of squares from previous calls to COMP_COMPOSITE_MISS. XSTD should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XSTD contains the standard deviations of the data matrix.

The size of XSTD must verify: size(XSTD) = size(X,DIMVAR).

XN (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XN contains counts of non-missing observations from previous calls to COMP_COMPOSITE_MISS. XN should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, XN contains the numbers of non-missing observations for the variables in the data matrix.

The size of XN must verify: size(XN) = size(X,DIMVAR).

XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XMEAN_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data matrix.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,DIMVAR)
  • size(XMEAN_GRP,2) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XSTD_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data matrix.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,DIMVAR)
  • size(XSTD_GRP,2) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XN_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, XN_GRP contains the numbers of non-missing observations in the NGRP groups for all the variables in the data matrix.

The shape of XN_GRP must verify:

  • size(XN_GRP,1) = size(X,DIMVAR)
  • size(XN_GRP,2) = NGRP.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
DIMVAR (INPUT, OPTIONAL) integer(i4b)

On entry, if DIMVAR is present, DIMVAR is used as follows:

  • DIMVAR = 1, the input submatrix X contains size(X,2) observations on size(X,1) variables.
  • DIMVAR = 2, the input submatrix X contains size(X,1) observations on size(X,2) variables.

The default is DIMVAR = 1.

XCOMP (OUTPUT, OPTIONAL) real(stnd), dimension(:,:)

On exit, the standardized profiles of the NGRP groups of observations in the data matrix.

The shape of XCOMP must verify:

  • size(XCOMP,1) = size(X,DIMVAR)
  • size(XCOMP,2) = NGRP.
U (OUTPUT, OPTIONAL) real(stnd), dimension(:,:)

On exit, the U statistics for the NGRP groups and all the variables in the data matrix.

The shape of U must verify:

  • size(U,1) = size(X,DIMVAR)
  • size(U,2) = NGRP.
PROB (OUTPUT, OPTIONAL) real(stnd), dimension(:,:)

On exit, the significance probabilities of the U statistics under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

The shape of PROB must verify:

  • size(PROB,1) = size(X,DIMVAR)
  • size(PROB,2) = NGRP.
UTEST (INPUT/OUTPUT, OPTIONAL) real(stnd)

On entry, a probability. UTEST is the sum of the areas (equal) in both tails of the normal-distribution. UTEST must verify: 0. < P < 1.

On exit, the two-tail quantile of the normal-distribution, that is a value X such that the probability of the absolute value of U being greater than X is UTEST under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present for all variables, the statistics are set to Nan code.

If fewer than one valid observation were present only for some variables and/or groups of observations, the pertinent statistics are set to missing (XMISS value).

The optional parameters, except DIMVAR, need only to be specified when LAST=true.

For more details, on the statistics and tests computed by this subroutine, see:

  1. Terray, P., Delecluse, P., Labattu, S., Terray, L., 2003:
    Sea Surface Temperature associations with the Late Indian Summer Monsoon. Climate Dynamics, vol. 21, 593-618.

subroutine comp_composite ( x, first, last, ngrp, ind, xmean, xstd, xn, xmean_grp, xstd_grp, xn_grp, xmiss, xcomp, u, prob, utest )

Purpose

COMP_COMPOSITE_MISS computes a composite analysis from a data tridimensional array possibly containing missing values.

Arguments

X (INPUT) real(stnd), dimension(:,:,:)
On entry, input subarray containing size(X,3) observations on size(X,1) by size(X,2) variables from the array of data for which a composite analysis is desired. If all the data are available at once, X can be the full data array.
FIRST (INPUT) logical(lgl)

On entry, if:

  • FIRST = true the current subarray is the first subarray of the data array.
  • FIRST = false the current subarray is not the first subarray of the data array.
LAST (INPUT) logical(lgl)

On entry, if:

  • LAST = true the current subarray is the last subarray of the data array.
  • LAST = false the current subarray is not the last subarray of the data array.
NGRP (INPUT) integer(i4b)
On entry, the number of groups in the analysis.
IND (INPUT) integer(i4b), dimension(:)

On entry, input subvector containing size(X,3) observations which is used to classify the observations into the NGRP groups. A value outside the interval 1:NGRP means that the current observation does not belong to any group in the analysis.

The size of IND must verify: size(IND) = size(X,3) .

XMEAN (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XMEAN contains the mean values from previous calls to COMP_COMPOSITE_MISS. XMEAN should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XMEAN contains the mean values of the data array.

The shape of XMEAN must verify:

  • size(XMEAN,1) = size(X,1)
  • size(XMEAN,2) = size(X,2).
XSTD (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XSTD contains adjusted sums of squares from previous calls to COMP_COMPOSITE_MISS. XSTD should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XSTD contains the standard deviations of the data array.

The shape of XSTD must verify:

  • size(XSTD,1) = size(X,1)
  • size(XSTD,2) = size(X,2).
XN (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XN contains counts of non-missing observations from previous calls to COMP_COMPOSITE_MISS. XN should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XN contains the numbers of non-missing observations for the variables in the data array.

The shape of XN must verify:

  • size(XN,1) = size(X,1)
  • size(XN,2) = size(X,2).
XMEAN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XMEAN_GRP contains the mean values for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XMEAN_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XMEAN_GRP contains the mean values for the NGRP groups of observations on all the variables in the data array.

The shape of XMEAN_GRP must verify:

  • size(XMEAN_GRP,1) = size(X,1)
  • size(XMEAN_GRP,2) = size(X,2)
  • size(XMEAN_GRP,3) = NGRP.
XSTD_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XSTD_GRP contains adjusted sums of squares for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XSTD_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XSTD_GRP contains the standard deviations for the NGRP groups of observations on all the variables in the data array.

The shape of XSTD_GRP must verify:

  • size(XSTD_GRP,1) = size(X,1)
  • size(XSTD_GRP,2) = size(X,2)
  • size(XSTD_GRP,3) = NGRP.
XN_GRP (INPUT/OUTPUT) real(stnd), dimension(:,:,:)

On entry, after the first call to COMP_COMPOSITE_MISS (e.g. when FIRST=true), XN_GRP contains counts of non-missing observations for the NGRP groups from previous calls to COMP_COMPOSITE_MISS. XN_GRP should not be changed between calls to COMP_COMPOSITE_MISS.

On exit, when LAST=true, XN_GRP contains the numbers of non-missing observations in the NGRP groups for all the variables in the data array.

The shape of XN_GRP must verify:

  • size(XN_GRP,1) = size(X,1)
  • size(XN_GRP,2) = size(X,2)
  • size(XN_GRP,3) = NGRP.
XMISS (INPUT) real(stnd)
On entry, the missing value indicator. Any value in X which is equal to XMISS is assumed to be missing.
XCOMP (OUTPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On exit, the standardized profiles of the NGRP groups of observations in the data array.

The shape of XCOMP must verify:

  • size(XCOMP,1) = size(X,1)
  • size(XCOMP,2) = size(X,2)
  • size(XCOMP,3) = NGRP.
U (OUTPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On exit, the U statistics for the NGRP groups and all the variables in the data array.

The shape of U must verify:

  • size(U,1) = size(X,1)
  • size(U,2) = size(X,2)
  • size(U,3) = NGRP.
PROB (OUTPUT, OPTIONAL) real(stnd), dimension(:,:,:)

On exit, the significance probabilities of the U statistics under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

The shape of PROB must verify:

  • size(PROB,1) = size(X,1)
  • size(PROB,2) = size(X,2)
  • size(PROB,3) = NGRP.
UTEST (INPUT/OUTPUT, OPTIONAL) real(stnd)

On entry, a probability. UTEST is the sum of the areas (equal) in both tails of the normal-distribution. UTEST must verify: 0. < P < 1.

On exit, the two-tail quantile of the normal-distribution, that is a value X such that the probability of the absolute value of U being greater than X is UTEST under the null hypothesis that the groups have been formed by uniform random sampling without duplication in the set of all the observations.

Further Details

The subroutine computes all the statistics with only one pass through the data.

If fewer than one valid observation were present for all variables, the statistics are set to Nan code.

If fewer than one valid observation were present only for some variables and/or groups of observations, the pertinent statistics are set to missing (XMISS value).

The optional parameters need only to be specified when LAST=true.

For more details, on the statistics and tests computed by this subroutine, see:

  1. Terray, P., Delecluse, P., Labattu, S., Terray, L., 2003:
    Sea Surface Temperature associations with the Late Indian Summer Monsoon. Climate Dynamics, vol. 21, 593-618.

function valmed ( x )

Purpose

Find the median of the vector X(:).

Arguments

X (INPUT) real(stnd), dimension(:)
On entry, the vector of observations.

Further Details

This subroutine uses a modified quicksort algorithm.

function valmed ( x )

Purpose

Find the medians of the column vectors of the matrix X(:,:).

Arguments

X (INPUT) real(stnd), dimension(:,:)
On entry, the matrix of observations.

Further Details

This subroutine uses a modified quicksort algorithm.
Flag Counter