Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_SIMPLESTAT

### IMSL_SIMPLESTAT

IMSL_SIMPLESTAT

The IMSL_SIMPLESTAT function computes basic univariate statistics.

The IMSL_SIMPLESTAT function computes the sample mean, variance, minimum, maximum, and other basic statistics for the data in x. It also computes confidence intervals for the mean and variance (under the hypothesis that the sample is from a normal population).

Frequencies, fi’s, are interpreted as multiple occurrences of the other values in the observations. In other words, a row of x with a frequency variable having a value of 2 has the same effect as two rows with frequencies of 1. The total of the frequencies is used in computing all the statistics based on moments (mean, variance, skewness, and kurtosis). Weights, wi’s, are not viewed as replication factors. The sum of the weights central moments). Both weights and frequencies can be zero, but neither can be negative. In general, a zero frequency means that the row is to be eliminated from the analysis; no further processing or error checking is done on the row. A weight of zero results in the row being counted, and updates are made of the statistics.

The definitions of some of the statistics are given below in terms of a single variable x of which the i-th datum is xi.

xmin = min(xi)

xmax = max(xi)

xmax – xmin

#### Simple Robust Estimate of Scale

where

is the inverse of the standard normal distribution function evaluated at 3/4. This standardizes MAD in order to make the scale estimate consistent at the normal distribution for estimating the standard deviation (Huber 1981, pp. 107–108).

## Example

This example uses data from Draper and Smith (1981). There are five variables and 13 observations.

`x = IMSL_STATDATA(5)`
`stats = IMSL_SIMPLESTAT(x)`
` `
`; Call IMSL_SIMPLESTAT.`
`labels = ['means', 'variances', 'std. dev', \$`
`  'skewness', 'kurtosis', 'minima', \$`
`  'maxima', 'ranges', 'C.V.', 'counts', \$`
`  'lower mean', 'upper mean', 'lower var', 'upper var']`
` `
`; Define the character strings that will be used as labels for the`
`; rows of the output.`
`FOR i = 0, 13 DO PM, labels(i), stats(i, *), \$`
`  FORMAT = '(a10, 5f9.3)'`
` `
`; Output the results.`
`means         7.462     48.154     11.769     30.000     95.423`
`variances    34.603    242.141     41.026    280.167    226.314`
`std. dev      5.882     15.561      6.405     16.738     15.044`
`skewness      0.688     -0.047      0.611      0.330     -0.195`
`kurtosis      0.075     -1.323     -1.079     -1.014     -1.342`
`maxima       21.000     71.000     23.000     60.000    115.900`
`ranges       20.000     45.000     19.000     54.000     43.400`
`C.V.          0.788      0.323      0.544      0.558      0.158`
`counts       13.000     13.000     13.000      3.000     13.000`
`lower mean    3.907     38.750      7.899     19.885     86.332`
`upper mean   11.016     57.557     15.640     40.115    104.514`
`lower var    17.793    124.512     21.096    144.065    116.373`
`upper var    94.289    659.817    111.792    763.434    616.688`

## Syntax

Result = IMSL_SIMPLESTAT(X)

## Return Value

A two-dimensional matrix containing some simple statistics for each variable X. If Median and Median_And_Scale are not used as keywords, then element (i, j) of the returned matrix contains the i-th statistic of the j-th variable. Refer to the table below for a list of results.

 i Statistic Returned in Element (i, *) 0 Mean 1 Variance 2 Standard deviation 3 Coefficient of skewness 4 Coefficient of excess (kurtosis) 5 Minimum value 6 Maximum value 7 Range 8 Coefficient of variation (when defined). If the coefficient of variation is not defined, zero is returned. 9 Number of observations (the counts) 10 Lower confidence limit for the mean (assuming normality). The default is a 95-percent confidence interval. 11 Upper confidence limit for the mean (assuming normality) 12 Lower confidence limit for the variance (assuming normality). The default is a 95-percent confidence interval. 13 Upper confidence limit for the variance (assuming normality)

## Arguments

### X

Data matrix. The data value for the i-th observation of the j-th variable should be in the matrix element (i, j).

## Keywords

### CONF_MEANS (optional)

Scalar specifying the confidence level for a two-sided interval estimate of the means (assuming normality) in percent. The CONF_MEANS keyword must be between 0.0 and 100.0 and is often 90.0, 95.0, or 99.0. For a one-sided confidence interval with confidence level c, set CONF_MEANS = 100.0 – 2.0(100.0 – c) (at least 50 percent). Default: 95-percent confidence interval is computed

### CONF_VARIANCES (optional)

Confidence level for a two-sided interval estimate of the variances (assuming normality) in percent. The confidence intervals are symmetric in probability (rather than in length). For one-sided confidence interval with confidence level c, set CONF_MEANS = 100.0 – 2.0(100.0 – c) (at least 50 percent). Default: 95-percent confidence interval is computed.

### DOUBLE (optional)

If present and nonzero, double precision is used.

### ELEMENTWISE (optional)

If present and nonzero, all nonmissing data for any variable is used in computing the statistics for that variable. Default action: if an observation (row of x) contains a missing value, the observation is excluded from computations for all variables. In either case, if weights and/or frequencies are specified and the value of the weight and/or frequency is missing, the observation is excluded from computations for all variables.

### FREQUENCIES (optional)

One-dimensional array containing the frequency for each observation. Default: each observation has a frequency of 1.

### MEDIAN_ONLY (optional)

If present and nonzero, medians are computed and stored in elements (14, *) of the returned matrix of simple statistics. The MEDIAN_ONLY and MEDIAN_AND_SCALE keywords cannot be used together.

### MEDIAN_AND_SCALE (optional)

If present and nonzero, specified, the medians, the medians of the absolute deviations from the medians, and a simple robust estimate of scale are computed and stored in elements (14, *), (15, *), and (16, *) of the returned matrix of simple statistics. The MEDIAN_ONLY and MEDIAN_AND_SCALE keywords cannot be used together.

### WEIGHTS (optional)

One-dimensional array containing the weight for each observation. Default: each observation has a weight of 1.

## Version History

 6.4 Introduced

© 2020 Harris Geospatial Solutions, Inc. |  Legal