PStDev
- Last UpdatedJan 11, 2023
- 3 minute read
- PI System
- PI Server 2018
- PI Server
Return the time-weighted or event-weighted population standard deviation for a population of one or more values.
Syntax
PStDev(x1 [, ... xn])
PStDev(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 population standard deviation for 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 population standard deviation of a population x1, ..., xn is
where
is the mean of the arguments; that is,
Exceptions
Arguments whose run-time values are digital states are ignored. If all values are digital states, an error value is returned. Returns an error if the array does not consist of same value type
Notes
-
PStDev uses every value in a population to calculate the population standard deviation. However, it is common, especially for a large population, to estimate standard deviation from a sample of the population. SStDev uses a set of sample values to calculate sample standard deviation, which approximates the population standard deviation
-
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
-
PStDev(14, 'att1', 14.5, TagVal('att2','14-Dec-16'))
[Return the "population 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]
-
PStDev('*', 'y', 'Saturday')
[Return the "population standard deviation" of these timestamps]
-
PStDev('*'-'*-1h', 't+8h'-'y+4h', 'y'-'20', '*'-'t')
[Return the "population 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]
-
PStDev(Variable1)
Name
Expression
Value at Evaluation
Variable1
RecordedValues('att1', '*-10m', '*')
[1, 3, 5, 7, 9]
Variable 2
PStDev(Variable1)
2.8284
[Find the "population standard deviation" of values in an array named Variable1]
-
PStDev(Data)
[Return the event-weighted "population standard deviation" of values in an array named Data]
-
PStDev(Data, "EventWeighted")
[Return the event-weighted "population standard deviation" of values in an array named Data]
-
PStDev(Data, "TimeWeighted")
[Return the time-weighted "population standard deviation" of values in an array named Data using the timestamps of the earliest and the latest values of the array as the start time and end time respectively]