Create a Statistical Model Template

Statistical Model Templates define how Stats Model data are processed. Users can create custom templates to run specific statistical calculations, based on the data anomalies that need to be surfaced. This article describes how to add a new Statistical Model Template to your Metric Insights instance. 

NOTE: Writing the code for a Statistical Model Template is a technically advanced process. Please contact support@metricinsights.com for assistance with writing the correct code for a new template.

1. Create a New Stats Model Template

Access Admin > System > Stats Model Templates

The list page containing all Stats Model Templates available in the system opens.

  1. Below the grid, click [+ New Stats Dataset Template]
  2. Enter a Name for the Stats Template
  3. [Save]

2. Enter Dataset Viewer Code

Access the Dataset Viewer Code tab

  1. Enter the HTML for the Stats Model Editor
    • Once the Statistical Model Template is saved and selected in the Stats Model Editor, the menu is displayed based on this code

3. Enter Javascript Code

Access the Javascript Code tab

Enter the JavaScript code that is used to provide functionality for the HTML code entered in the previous step. This script processes the Dataset data to find any anomalies, which will serve as a basis for the future Stats Model.

4. Enter Statement Generation Code

4.1. Enter Code for MySQL

Access the Statement Generation Code tab

Enter the code that will generate a MySQL query based on the data collected by the script.

4.2. Enter Code for MS SQL

Access the Statement Generation Code MS SQL tab

  1. Enter the code that will generate a MS SQL query based on the data collected by the script
  2. [Save]

5. Use the Stats Model Template

Access the Dataset Viewer of a Dataset, on which you want to build a Stats Model

  1. Select Actions > Build Stats Model
  2. Click on the Template field
  3. Select the created Stats Model Template

For more details on creating a Stats Model, see Create a Statistical Model (Datasets).