You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the variance of all the elements of `array`, or of the elements of `array` along dimension `dim` if provided, and if the corresponding element in `mask` is `true`.
57
+
58
+
The variance is defined as the best unbiased estimator and is computed as:
59
+
60
+
```
61
+
var(x) = 1/(n-1) sum_i (array(i) - mean(array))^2
62
+
```
63
+
64
+
### Syntax
65
+
66
+
`result = var(array [, mask])`
67
+
68
+
`result = var(array, dim [, mask])`
69
+
70
+
### Arguments
71
+
72
+
`array`: Shall be an array of type `integer`, `real`, or `complex`.
73
+
74
+
`dim`: Shall be a scalar of type `integer` with a value in the range from 1 to n, where n is the rank of `array`.
75
+
76
+
`mask` (optional): Shall be of type `logical` and either by a scalar or an array of the same shape as `array`.
77
+
78
+
### Return value
79
+
80
+
If `array` is of type `real` or `complex`, the result is of the same type as `array`.
81
+
If `array` is of type `integer`, the result is of type `double precision`.
82
+
83
+
If `dim` is absent, a scalar with the variance of all elements in `array` is returned. Otherwise, an array of rank n-1, where n equals the rank of `array`, and a shape similar to that of `ar
84
+
ray` with dimension `dim` dropped is returned.
85
+
86
+
If `mask` is specified, the result is the variance of all elements of `array` corresponding to `true` elements of `mask`. If every element of `mask` is `false`, the result is IEEE `NaN`.
0 commit comments