Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.0.0 - Português


stdev

standard deviation (row or column-wise) of vector/matrix entries

Syntax

y = stdev(x)
y = stdev(x, '*')
y = stdev(x, 'r'|1)
y = stdev(x, 'c'|2)
y = stdev(x, orien, m)

Arguments

x, y

real vector, matrix or hypermatrix

y

real scalar, vector or matrix

orien

"*" (default), "r" or 1, "c" or 2, or 0<integer<=ndims(x): direction along which calculations are performed.

m

real scalar, vector or hypermatrix, the a priori mean

Description

stdev computes the "sample" standard deviation, that is, it is normalized by N-1, where N is the sequence length. If m is present, then stdev computes the mean squared deviation (normalized by N) using the a priori mean defined by m.

For a vector or a matrix x, y=stdev(x) returns in the scalar y the standard deviation of all the entries of x.

y=stdev(x,'r') (or, equivalently, y=stdev(x,1)) is the rowwise standard deviation. It returns in each entry of the row vector y the standard deviation of each column of x.

y=stdev(x,'c') (or, equivalently, y=stdev(x,2)) is the columnwise stdev. It returns in each entry of the column vector y the standard deviation of each row of x.

By extension, y=stdev(x,n) with n a positive integer returns the deviation along the n-th dimension.

  • If m is a scalar, then it is expanded to match the size of mean(x) along the n-th dimension.
  • stdev() can be overloaded.

Examples

A = [1 2 10; 7 7.1 7.01];
stdev(A)
stdev(A, 'r')
stdev(A, 'c')
stdev(A,  2 )

// Deviation from a known (a-priori, built-in) mean:
A = grand(10, 10, "nor", 7.5, 3);
stdev(A) / 3             // unknown mean => assessed from A before computing stdev
stdev(A, '*', 7.5) / 3   // using the theoretical built-in mean

// With an hypermatrix:
A = grand(3, 5, 30, "nor", 4.1, 1.5);
stdev(A) / 1.5
sd = stdev(A, 3, 4.1) / 1.5
mean(sd)

See also

  • nanstdev — standard deviation (ignoring the NANs).
  • stdevf — standard deviation
  • sum — soma (soma linha, soma coluna) de entradas de um vetor ou matriz
  • median — median (row median, column median,...) of vector/matrix/array entries
  • mean — mean of all values, or means along a given dimension

History

VersãoDescrição
5.5.0 Can now compute the mean squared deviation using the a priori mean defined by m
6.0.0 stdev(x, orien>ndims(x)) no longer returns zeros(x) but yields an error.
6.0.1 stdev() is now overloadable.
Report an issue
<< mad Dispersion widths stdevf >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Oct 24 14:35:26 CEST 2023