Step 5: Format Timed Values At the top, click the Services section of scts_thing. In the Ihnerited Services section, you will see the built-in services of the Statistical Calculation Thing Shape. These services can perform a variety of analytical calculations. Timed Values Service The Statistical Calculation Thing Shape can only perform analytics operations on time-series datasets. However, accessing a time-series Value Stream can have a performance hit on the system. Instead, a Property with an Info Table using a timestamp/value Data Shape is used as the universal input to each built-in service of the Statistical Calculation Thing Shape. For efficiency, we only reference the Value Stream once to create a formatted timedValues that is used as an input to all other service calls. At the top, click Services. Click + Add. In the Name field, enter timed_values_service. In the Javascript field, copy and past the following code: me.timed_values = me.QueryTimedValuesForProperty({
propertyName: "numbers",
maxItems: 10,
startTime: me.start_time,
endTime: me.end_time
}); At the bottom, click Save and Execute. Click Done, and return to Properties and Alerts. On the timed_values property row, click the pencil icon for Set value of property. In the pop-up, note that there are now seven entries - each with the 1, 5, 9, 5, 9, 1, and 9 values and the timestamps when you entered them. In the pop-up, click Cancel. If needed, in the top-right, click the icon to close the slide-out. Step 6: Calculation Services Now that the numbers, start_time, end_time, and timed_values service inputs have been set, you can use the built-in Services of the Statistical Calculation Thing Shape to perform a variety of analytics calculations. Mean Service First, you will utilize the built-in CalculateMeanValue service. The dataset is the following: 1, 5, 9, 5, 9, 1, 9. As such, the mean should be (1+5+9+5+9+1+9)/7 = 39/7 = 5.571... Return to the Services section. At the top, click + Add. In the Name field, enter mean_service. In the Javascript code section, copy and paste the following: me.mean_result = me.CalculateMeanValue({
timedValues: me.timed_values
}); At the top, click Save and Continue. At the bottom, click Execute. Click Done, then return to the Properties and Alerts section. Note that the mean_result property now has the value 5.571.... Median Service Next, you will utilize the built-in CalculateMedianValue service. With our dataset having 5 as the middle value, that should be the result. Return to the Services section. At the top, click + Add. In the Name field, enter median_service. In the Javascript code section, copy and paste the following: me.median_result = me.CalculateMedianValue({
timedValues: me.timed_values
}); At the top, click Save and Continue. At the bottom, click Execute. Click Done, and return to the Properties and Alerts section. Note that the median_result Property now has the value 5. Mode Service You will now utilize the built-in CalculateModeValue service. With the dataset having 9 as the most common value, that should be the result. Return to the Services section. At the top, click + Add. In the Name field, enter mode_service. In the Javascript code section, copy and paste the following: me.mode_result = me.CalculateModeValue({
timedValues: me.timed_values
}); At the top, click Save and Continue. At the bottom, click Execute. Click Done, and return to the Properties and Alerts section. On the mode_result row and under the Value column, click the "pencil" icon for Set value of property. In the popup, note that the mode_result Property now has the value 9. Click Cancel to close the popup. If necessary, at the top-right, click the button to close the slide-out. Standard Deviation Service Lastly, you will utilize the built-in CalculateStandardDeviationValue service. There are multiple free Standard Deviation calculators to check the answer. Accordingly, the Standard Deviation should be 3.59894... Return to the Service section. At the top, click + Add. In the Name field, enter standarddev_service. In the Javascript code section, copy and paste the following: me.standarddev_result = me.CalculateStandardDeviationValue({
timedValues: me.timed_values
}); At the top, click Save and Continue. At the bottom, click Execute. Click Done, and return to the Properties and Alerts section. Note that the standarddev_result property now has the value 3.59894... Step 7: Other Options The Mean, Median, Mode, and Standard Deviation services you have completed are just a sampling of what the Statistical Calculation Thing Shape offers. Below is a table of additional built-in services: Calculation Service Name Description Binned Data Distribution for Bin Size CalculateBinnedDataDistributionForBinSize Calculate the binned distribution of data points based on the desired bin size. Binned Data Distribution for Number of Bins CalculateBinnedDataDistributionForNumberOfBins Calculate the binned distribution of data points based on the desired number of bins. Confidence Interval Values CalculateConfidenceIntervalValues Confidence Interval Values Based on a specified confidence interval percentage, calculate the minimum, median, and maximum interval values. Five Number Property Values CalculateFiveNumberPropertyValues Calculate the five number values: minimum, lower quartile, median, upper quartile, and maximum. Fourier Transform CalculateFourierTransform Calculate the results of running the fast Fourier transform on the specified values. Maximum Value CalculateMaximumValue Calculate the maximum property value in the provided infotable. Minimum Value CalculateMinimumValue Calculate the minimum property value in the provided infotable. Sampling Frequency Values CalculateSamplingFrequencyValues Calculate the sampling frequency values: minimum, median, and maximum. Step 8: Next Steps Congratulations! In this guide, you have learned how to: Create a Value Stream and Data Shape Create a Thing with the Statistical Calculation Thing Shape Modify a property to record values to the Value Stream Utilize various built-in services for analytical calculations Learn More We recommend the following resources to continue your learning experience: Capability Guide Build Build a Predictive Analytics Model Build Operationalize an Analytics Model Additional Resources If you have questions, issues, or need additional information, refer to: Resource Link Community Developer Community Forum Support Descriptive Analytics Help Center
View full tip