Click or drag to resize
sqx

SQXMeansDevsMatrix Method

Procedure MeansDevsMatrix [nvarchar](max) @Query, [bit] @Population, [bit] @SnapShot, [Matrix] @MeansDevsMatrix OUTPUT

Namespace:  sqx
Assembly:  SQX (in SQX.dll) Version: 1.0.2.6 (1.0.2.6)
Syntax
C#
public static int MeansDevsMatrix(
	SqlChars Query,
	SqlBoolean Population,
	SqlBoolean SnapShot,
	out Matrix MeansDevsMatrix
)

Parameters

Query
Type: System.Data.SqlTypesSqlChars
[nvarchar](max)
Population
Type: System.Data.SqlTypesSqlBoolean
[bit]
SnapShot
Type: System.Data.SqlTypesSqlBoolean
[bit] 0 Read Commited | 1 SnapShot
MeansDevsMatrix
Type: sqxMatrix
[Matrix] Output

Return Value

Type: Int32
[int] 0 success | -1 failure
Remarks
Mean, Standard Deviation, Standard Error, Min and Max Matrix procedure.

NOTE: Query must return a dataset with only the matrix columns with numeric data type.
Examples
SQL
declare @Query nvarchar(max) = N'
select a.Value [1],b.Value [2],c.Value [3]
from sqx.VectorTable(sqx.RandomVector(10,1)) a
inner join sqx.VectorTable(sqx.RandomVector(10,2)) b ON a.ID = b.ID
inner join sqx.VectorTable(sqx.RandomVector(10,3)) c ON a.ID = c.ID
'
declare @A sqx.Matrix
exec sqx.MeansDevsMatrix @Query = @Query, @Population = 1, @SnapShot = 0, @MeansDevsMatrix = @A OUTPUT
exec sqx.MatrixToTable @A
select * from sqx.MeansDevsTable(@A)
/*
ID          1                      2                      3
----------- ---------------------- ---------------------- --------------------
1           0.472999690693337      0.422586420468328      0.472173150243318   Avg    
2           0.266302897902179      0.311228643259885      0.265228430997687   StDevp
3           0.0842123704874163     0.0984191385785249     0.0838725942185496  StError
4           0.101266453555444      0.0112066529743404     0.180578214666144   Min
5           0.943862276125635      0.985047052607428      0.947231081755474   Max

ID          Mean                   StDev                  StError                MinValue               MaxValue
----------- ---------------------- ---------------------- ---------------------- ---------------------- ----------------------
1           0.472999690693337      0.266302897902179      0.0842123704874163     0.101266453555444      0.943862276125635
2           0.422586420468328      0.311228643259885      0.0984191385785249     0.0112066529743404     0.985047052607428
3           0.472173150243318      0.265228430997687      0.0838725942185495     0.180578214666144      0.947231081755474*/
See Also