# Defining Trend Charts

Trend Charts allow Veeva LIMS users to view embedded statistical process control charts on a given *Spec Execution* to:

* Compare a batch's results against previous batch results and determine whether it's in control or out of trend.
* Analyze stability trending in order to identify regression results that are trending towards an earlier than expected expiration, thus proactively preventing product or process failures and recalls before they become specification failures.

If <a href="/en/gr/1007720/">configured</a> by a Vault Admin, a Design Data Admin can define up to 50 Trend Charts per *Batch Release Spec Data*.

## Supported Chart Types

The following types of control charts are available for definition in Veeva LIMS: X-bar, R Chart, S Chart, I-MR Chart, and Regression.

## Creating a Batch Release Trend Chart Definition

To create a *Trend Chart Definition*:

1. Open the *Batch Release Spec Data* Detail page.
2. Create a *Trend Chart Definition* related record.
3. Select a **Chart Type**. For *Batch Release Spec Data*, only Control Charts (X-bar, R Chart, S Chart and I-MR Chart) are valid. If you select an invalid chart type, you will receive an error when attempting to make its *Spec Data* effective.
4. Enter a **Name**.
5. Enter a **Description**.
6. Select a *Test Definition* and *Result Definition*. Only *Result Definitions* that have an Out of Spec criteria are supported.
7. Fill in the [applicable fields][0] for the chart type.
8. Click **Save**.

When you create a *Trend Chart Definition* record, Veeva LIMS automatically creates a *Trace ID* for the record. The system uses this ID to track *Trend Chart Definition* <a href="/en/gr/51412707/">versioning</a> across multiple *Spec Data*.

### Trend Chart Attribute Fields {#fields}

The following table lists possible fields on a *Trend Chart Definition* along with a brief description and which chart types the field is applicable to:

|Attribute|Description|Applicable Chart Types|
|--- |--- |--- |
|Attribute|Description|Context / Applicability|
|Minimum Spec Ex Count|The minimum number of historical data points required before the system calculates and displays control limits (UCL/LCL).|X-bar/R Chart, X-bar/S Chart, R Chart, S Chart, I-MR Chart|
|A2 Constant|Used to calculate Control Limits for X-bar charts when using the Mean Range.|X-bar/R Chart|
|A3 Constant|Used to calculate Control Limits for X-bar charts when using Standard Deviation.|X-bar/S Chart|
|D3 & D4 Constants|Factors used to calculate the Lower and Upper Control Limits for R-charts.|R Chart|
|B3 & B4 Constants|Factors used to calculate the Lower and Upper Control Limits for S-charts.|S Chart|
|Default Confidence Level|The statistical confidence (for example, 95%) used to calculate the prediction intervals and predicted shelf life.|Regression|
|Default Regression Type|The default regression type (linear or exponential) used to calculate the regression line.|Regression|
|*Spec Data Criteria*|The *Spec Data Criteria* that the system uses to predict when it will reach the spec criteria.|Regression|

## Defining Regression Charts for Stability Studies

Most trend chart types are only available for Batch Releases, but Design Data Admins can define linear and exponential regression charts for *Stability Studies*. These charts allow users to compare *Stability Study Results* with the same *Storage Condition* and *Orientation* in order to predict when the *Result* will be Out of Spec (OOS). 

### How to Define Regression Charts for Stability Studies 

To create a Regression *Trend Chart Definition* for a *Stability Study*:

1. Open the *Stability Study Spec Data* Detail page for which you want to define a chart.
2. Create a *Trend Chart Definition* related record.
3. Select a **Chart Type**. For *Stability Spec Data*, only Regression is valid. If you select an invalid chart type, you will receive an error when attempting to make its *Spec Data* effective.
4. Enter a **Name**.
5. Enter a **Description**.
6. Select a **Regression Line Type**.
7. Enter a **Prediction Interval**.
8. Select a **Criteria**. Only *Criteria* defined using simple mode is supported.
9. Click **Save**.

## Trend Chart Definition Limitations {#limits}

Keep the following limitations and requirements in mind when creating *Trend Chart Definitions* for *Batch Releases*:

* You can only create *Trend Chart Definitions* for *Spec Data* of type *Batch Release*. Regression chart definitions, which can also be created for Spec Data of type Stability, are the only exception.
* For *Batch Release* *Spec Data*, you can create a maximum of 50 *Chart Definitions*.
* For *Stability Spec Data*, you can create a maximum of 15 *Chart Definitions*.
* For a given *Test Definition*, you can create a maximum of five *Test Definition Results* across *Variations* that include *Chart Definitions*.
* For a given *Test Definition Result*, you can create a maximum of three *Trend Chart Definitions* across *Variations* within the same *Spec Data*.
* *Trend Chart Definitions* may not be of custom <a href="/en/gr/32857/">object types</a>, and once created, their object types cannot be changed.
* A *Trend Chart Definition*'s *Result* must be numeric.
* A given *Spec Data* cannot include duplicate *Trend Chart Definitions*. *Trend Chart Definitions* are considered duplicates if they have the same *Result* and *Chart Type*.
* *Test Result Definitions* that include *Trend Chart Definitions* must include a *During Test Execution OOS Criteria.*
* All *Trend Chart Definitions* within the same *Test Definition Result* or *Variation* must have the same *Minimum Spec Execution Count*.
* You can only create *Trend Chart Definitions* for *Test Definitions* that are tested on *Samples* of type *Release* for *Batch Releases* or type *Stability* for *Stability Studies*. For *Initial Timepoints* that use results from the *Batch Release*, this is ignored and charts display results from an *Initial Timepoint* result that was tested on a *Batch Release Sample* of type *Release*.
* When creating a Regression *Trend Chart Definition* for a *Stability Study*, the following also apply:
    * The *Spec Data Criteria* must be Simple Mode.
    * Each Stability Sample related to the Regression Chart Definition's Test Definition can have a maximum of 10 distinct Storage Conditions and Orientations.
    * The Result Definition cannot generate more than 10 Results for a single Storage Condition and Orientation.

[0]: #fields