Skip to main content

WaveStats

WaveStats [flags] waveName

The WaveStats operation computes several values associated with the named wave.

Flags

/ALPH=valSets the significance level for the confidence interval of the mean (default val =0.05).
/C=methodCalculates statistics for complex waves only. Has no effect on real waves.
You can use method in various combinations to process the real, imaginary, magnitude, and phase of the wave. The result is stored in the wave M_WaveStats (see Details for format).
method =0:Default; the imaginary part of waveName is ignored. Use /W to also store statistics in M_WaveStats.
method =1:Calculates statistics for real part of waveName and stores it in M_WaveStats.
method =2:Calculates statistics for imaginary part of waveName and stores the result in M_WaveStats.
method =4:Calculates statistics for magnitude of waveName, i.e., sqrt(real^2 +imag^2), and stores the result in M_WaveStats.
method =8:Calculate statistics for phase of waveName using atan2(imag,real).
If you use a single method the results are stored both in M_WaveStats and in the standard variables (e.g., V_avg, etc.). If you specify a method that is a combination of more than one binary field then the variables reflect the results for the lowest chosen field and all results are stored in the wave M_WaveStats.
For example, if you use /C=12, the variables will be set for the statistics of the magnitude and M_WaveStats will contain columns corresponding to the magnitude and to the phase.
In this mode V_numInfs will always be zero.
note

If you invoke this operation and M_WaveStats already exists in the current data folder, it will be either overwritten or initialized to NaN according to the /C flag.

/CCLWhen computing per-column statistics using /PCST, /CCL tells Igor to copy the column dimension labels of the input to the corresponding columns of M_WaveStats. /CCL was added in Igor Pro 9.00.
/DEST=wStatsSpecify a destination wave for WaveStats in place of the default M_WaveStats. Note that in order for the operation to create the destination wave, you must also specify the appropriate combination of /W and /C flags.
This flag was added in Igor Pro 10.00.
/FREECreates the user-specified destination wave as a free wave. Note that this flag does not affect the default M_WaveStats or W_ZScores.
/FREE is allowed only in functions and only if the destination waves are simple names or wave reference structure fields.
See Free Waves for more discussion.
The /FREE flag was added in Igor Pro 10.00.
/M=momentCalculates statistical moments.
moment =1:Calculates the lower moments: V_avg, V_npnts, V_numInfs, V_numNaNs. Use it if you do not need the higher moments.
moment =2:Default; calculates both the lower moments and the higher order quantities: V_sdev, V_rms, V_adev, V_skew, v_kurt.
/PCauses WaveStats to set the location output variables in terms of unscaled index values instead of the default scaled index values. The location output variables are:
V_minRowLoc, V_maxRowLoc, V_minColLoc, V_maxColLoc
V_minLayerLoc, V_maxLayerLoc, V_minChunkLoc, V_maxChunkLoc
For 1D waves, V_minRowLoc and V_maxRowLoc are always unscaled.
/P requires Igor Pro 8.03 or later.
/PCSTComputes the statistics on a per-column basis for a real valued wave of two or more dimensions. The results are saved in the wave M_WaveStats which has the same number of columns, layers and chunks as the input wave and where the rows, designated by dimension labels, contain the standard WaveStats statistics. All the V_ variables are set to NaN. Note that this flag is not compatible with the flags /C, /R, /RMD.
The /PCST flag was added in Igor Pro 7.00.
/QPrevents results from being printed in history.
/R=(startX,endX )Specifies an X range of the wave to evaluate.
/R=[startP,endP ]Specifies a point range of the wave to evaluate.
If you specify the range as /R=[startP ] then the end of the range is taken as the end of the wave. If /R is omitted, the entire wave is evaluated.
/RMD=[firstRow , lastRow ][firstColumn , lastColumn ][firstLayer , lastLayer ][firstChunk , lastChunk ]
Designates a contiguous range of data in the source wave to which the operation is to be applied. This flag was added in Igor Pro 7.00.
You can include all higher dimensions by leaving off the corresponding brackets. For example:
/RMD=[firstRow,lastRow]
includes all available columns, layers and chunks.
You can use empty brackets to include all of a given dimension. For example:
/RMD=[][firstColumn,lastColumn]
means "all rows from firstColumn to lastColumn".
You can use a * to specify the end of any dimension. For example:
/RMD=[firstRow,*]
means "from firstRow through the last row".
/W[=mode]If the optional mode is not used, the operation stores results in the various V_ variables. For complex waves when /C is not specified, the statistics are computed for the real part only.
mode=0:The operation stores the results in the V_ variables only and prints them to the history (subject to /Q). For complex waves, if /C is specified with a non-zero method, the operation creates the corresponding M_WaveStats wave.
mode=1:The operation saves the results in both the V_ variables and in the wave M_WaveStats.
mode=2:The operation stores the results only in M_WaveStats and does not print the V_ variables. When executed from a user function, the variables are created but are not updated by the operation.
/ZNo error reporting.
/ZSCRComputes z scores
zi=YiYˉσ,\displaystyle z_{i}=\frac{Y_{i}-\bar{Y}}{\sigma},
which are saved in W_ZScores.

Details

WaveStats uses a two-pass algorithm to produce more accurate results than obtained by computing the binomial expansions of the third and fourth order moments.

WaveStats returns the statistics in the automatically created variables:

V_npntsNumber of points in range excluding points whose value is NaN or INF.
V_numNansNumber of NaNs.
V_numINFsNumber of INFs.
V_avgAverage of data values.
V_sumSum of data values.
V_sdevStandard deviation of data values,
σ=(YiV_avg)2V_npnts1\displaystyle \sigma=\sqrt{\frac{\sum\left(Y_{i}-V\_avg\right)^{2}}{V\_npnts-1}}
"Variance" is V_sdev2.
V_semStandard error of the mean sem=σV_npnts\displaystyle { sem }=\frac{\sigma}{\sqrt{V\_npnts}}
V_rmsRMS of Y values =1V_npntsYi2\displaystyle =\sqrt{\frac{1}{V\_npnts} \sum Y_{i}^{2}}
V_adevAverage deviation =1V_npntsi=0V_npts1YiYˉ\displaystyle =\frac{1}{V\_npnts } \sum_{i=0}^{{V\_npts }-1}\left\|Y_{i}-\bar{Y}\right\|
V_skewSkewness =1V_npntsi=0V_npnts1(YiYˉσ)3\displaystyle =\frac{1}{V\_npnts} \sum_{i=0}^{V\_npnts-1}\left(\frac{Y_{i}-\bar{Y}}{\sigma}\right)^{3}
V_kurtKurtosis =(1V_npntsi=0V_npnts1(YiYˉσ)4)3\displaystyle =\left(\frac{1}{V\_npnts} \sum_{i=0}^{V\_npnts-1}\left(\frac{Y_{i}-\bar{Y}}{\sigma}\right)^{4}\right)-3
V_minlocX location of minimum data value.
V_minMinimum data value.
V_maxlocX location of maximum data value.
V_maxMaximum data value.
V_minRowLocRow containing minimum data value. See /P above for further information.
V_maxRowLocRow containing maximum data value. See /P above for further information.
V_minColLocColumn containing minimum data value (2D or higher waves). See /P above for further information.
V_maxColLocColumn containing maximum data value (2D or higher waves). See /P above for further information.
V_minLayerLocLayer containing minimum data value (3D or higher waves). See /P above for further information.
V_maxLayerLocLayer containing maximum data value (3D or higher waves). See /P above for further information.
V_minChunkLocChunk containing minimum data value (4D waves only). See /P above for further information.
V_maxChunkLocChunk containing maximum data value (4D waves only). See /P above for further information.
V_startRowThe unscaled index of the first row included in calculating statistics.
V_endRowThe unscaled index of the last row included in calculating statistics.
V_startColThe unscaled index of the first column included in calculating statistics. Set only when /RMD is used.
V_endColThe unscaled index of the last column included in calculating statistics. Set only when /RMD is used.
V_startLayerThe unscaled index of the first layer included in calculating statistics. Set only when /RMD is used.
V_endLayerThe unscaled index of the last layer included in calculating statistics. Set only when /RMD is used.
V_startChunkThe unscaled index of the first chunk included in calculating statistics. Set only when /RMD is used.
V_endChunkThe unscaled index of the last chunk included in calculating statistics. Set only when /RMD is used.

WaveStats prints the statistics in the history area unless /Q is specified. The various multidimensional min and max location variables will only print to the history area for waves having the appropriate dimensionality.

The format of the M_WaveStats wave is:

RowStatistic
0numPoints
1numNaNs
2numInfs
3avg
4sdev
5rms
6adev
7skew
8kurt
9minLoc
10min
11maxLoc
12max
13minRowLoc
14minColLoc
15minLayerLoc
16minChunkLoc
17maxRowLoc
18maxColLoc
19maxLayerLoc
20maxChunkLoc
21startRow
22endRow
23sum
24meanL1
25meanL2
26sem
27startCol
28endCol
29startLayer
30endLayer
31startChunk
32endChunk

meanL1 and meanL2 are the confidence intervals for the mean

MeanL1=V_avgtα,vV_sdevV_npnts,\displaystyle { MeanL } 1={V\_avg}-t_{\alpha, v} \frac{V\_sdev}{\sqrt{V\_npnts}},

and

MeanL2=V_avg+tα,vV_sdevV_npnts\displaystyle { MeanL2 }={V\_avg}+t_{\alpha, v} \frac{{V\_sdev}}{\sqrt{{V\_npnts}}}

where ta,v is the critical value of the Student T distribution for alpha significance and degree of freedom v =V_npnts -1.

Use Edit M_WaveStats.ld to display the results in a table with dimension labels identifying each of the row statistics.

WaveStats is not entirely multidimensional aware. Even so, much of the information computed by WaveStats is useful. See Multidimensional Waves, particularly Analysis on Multidimensional Waves for details.

See the ImageStats operation for calculating wave statistics for regions in 2D matrix waves.

See Also

See Statistical Analysis for details on other statistics.

See the ImageStats operation for calculating wave statistics for regions in 2D matrix waves.

See the APMath operation if you require higher precision than provided by double-precision floating point.

WaveMax, WaveMin, WaveMinAndMax, mean, median, Variance