SStDev
- Last UpdatedJan 11, 2023
- 3 minute read
- PI System
- PI Server 2018
- PI Server
Return the time-weighted or event-weighted sample standard deviation for two or more arguments that are a sample of a larger population.
Syntax
SStDev(x1, x2 [, ... xn])
SStDev(array [, calculationBasis])
Arguments
x1, ... xn
-
Arguments and a single array of same value type (integers and real numbers, time expressions, or time intervals)
-
calculationBasis
Optional. The type of calculation to be performed enclosed in double quotes. Choose between "EventWeighted" or "TimeWeighted." If omitted, the default is event-weighted. If you select "TimeWeighted," the earliest timestamp of the value marks the start time and the latest timestamp the end of a time range
Returns
The sample standard deviation of the arguments. Returns a numeric value if the arguments are numbers. For arguments that are time expressions (time or time period), a number indicating a time period expressed in seconds is returned
The standard deviation of a sample x1, ... xn is equal to
Where
is the sample mean; that is,
Exceptions
Arguments whose run-time values are digital states are ignored. If there are not at least two numeric values, SStDev returns a zero. Returns an error if the array does not consist of same value type
Notes
-
In the rare case where you have the entire population, rather than a sample, you might use the function PstDev, rather than SStDev
-
Unit of Measure (UOM) of the arguments is carried over to the result when at least one argument has a defined UOM while others don't. The returned value lacks a UOM if arguments have different UOMs
Example
-
SStDev(14, 'att1', 14.5, TagVal('att2','14-Dec-16'))
[Return the "sample standard deviation" of these values: 14, the current value of 'att1', 14.5, and the value for 'att2' at start of day (12:00am) on Dec 14, 2016]
-
SStDev('*', 'y', 'Saturday')
[Return the "sample standard deviation" of these timestamps]
-
SStDev('*'-'*-1h', 't+8h'-'y+4h', 'y'-'20', '*'-'t')
[Return the "sample standard deviation" of these time periods: from 1 hour ago to now, from 4:00am yesterday to today at 8am, from 12:00am yesterday to 12:00am on 20th of this month, and from the beginning of day today (12:00am) till now]
-
SStDev(Variable1)
Name
Expression
Value at Evaluation
Variable1
RecordedValues('att1', '*-10m', '*')
[1, 3, 5, 7, 9]
Variable 2
SStDev(Variable1)
3.1623
[Find the "sample standard deviation" of values in an array named Variable1]
-
SStDev(Data)
[Return the event-weighted "sample standard deviation" of values in an array named Data]
-
SStDev(Data, "EventWeighted")
[Return the event-weighted "sample standard deviation" of values in an array named Data]
-
SStDev(Data, "TimeWeighted")
[Return the time-weighted "sample standard deviation" of values in an array named Data using the timestamps of the earliest and latest values of the array as the start time and end time respectively]