Previous Up Next

14.5.2  Matrices

The functions described in Section 14.5.1 can also find finds statistics for the columns of a matrix.

Let A be a matrix.

Examples

With

A:=[[3,4,2],[1,2,6]]

input:

mean(A)
     
⎡
⎣
2,3,4⎤
⎦
          
stddev(A)
     
⎡
⎣
1,1,2⎤
⎦
          
stddevp(A)
     
⎡
⎢
⎣
√
2
,√
2
,2 √
2
⎤
⎥
⎦
          
variance(A)
     
⎡
⎣
1,1,4⎤
⎦
          

With

B:=[[6,0,1,3,4,2,5],[0,1,3,4,2,5,6],[1,3,4,2,5,6,0], [3,4,2,5,6,0,1],[4,2,5,6,0,1,3],[2,5,6,0,1,3,4]]

input:

median(B)
     
⎡
⎣
2.0,2.0,3.0,3.0,2.0,2.0,3.0⎤
⎦
          

To obtain the first quartiles of the columns:

quantile(B,0.25)
     
⎡
⎣
1.0,1.0,2.0,2.0,1.0,1.0,1.0⎤
⎦
          

To obtain the third quartiles of the columns:

quantile(B,0.75)
     
⎡
⎣
4.0,4.0,5.0,5.0,5.0,5.0,5.0⎤
⎦
          
quartiles(B)
     
⎡
⎢
⎢
⎢
⎢
⎢
⎣
    0.00.01.00.00.00.00.0
    1.01.02.02.01.01.01.0
    2.02.03.03.02.02.03.0
    4.04.05.05.05.05.05.0
    6.05.06.06.06.06.06.0
⎤
⎥
⎥
⎥
⎥
⎥
⎦
          
boxwhisker(B)

Previous Up Next