How to compute the stddev of a Timeseries


#1

Below is the definition of a SimpleMetric

var invoiceEnergyIntegral = SimpleMetric.make({

  "id" : "InvoiceEnergy_PsSipsAnualIntegral",

  "name" : "InvoiceEnergyIntegral",

  "srcType" : "PsSipsAnual",

  "path" : "contratos",

  "tsDecl" : {"data":"facturas",

    "dataVersion" : "1",

    "treatment" : "INTEGRAL",

    "start" : "fh_ini_fact",

    "end" : "fh_fin_fact",

    "value" : "nm_ener_factda"

  }

}); 

How do you compute the stddev? Not like this:

var stdConsumptionFacts =CompoundMetric.make({

"name": "StdConsumptionFacts",

"id": "StdConsumptionFacts",

"description": "consumption Invoices Standart Desviation",

"expression": "stddev(InvoiceEnergyIntegral)"

})

But like this

var stdConsumptionFacts =CompoundMetric.make({

"name": "StdConsumptionFacts",

"id": "StdConsumptionFacts",

"description": "consumption Invoices Standart Desviation",

"expression": "rolling('STDDEV',InvoiceEnergyIntegral)"

})

You can find more like this by doing c3ShowType(ExpressionEngineFunction)