##### Page tree

Contents:

NOTE:  Designer Cloud Powered by Trifacta Educational is a free product with limitations on its features. Some features in the documentation do not apply to this product edition. See Product Limitations.

Contents:

Generates the standard deviation of values by group in a column that meet a specific condition using the sample statistical method.

NOTE: When added to a transform, this function is applied to the sample in the data grid. If you change your sample or run the job, the computed values for this function are updated. Transforms that change the number of rows in subsequent recipe steps do not affect the values computed for this step.

NOTE: This function applies to a sample of the entire population. More information is below.

Relevant terms:

Term Description
Population Population statistical functions are computed from all possible values. See https://en.wikipedia.org/wiki/Statistical_population.
Sample

Sample-based statistical functions are computed from a subset or sample of all values. See https://en.wikipedia.org/wiki/Sampling_(statistics).

These function names include `SAMP` in their name.

NOTE: Statistical sampling has no relationship to the samples taken within the product. When statistical functions are computed during job execution, they are applied across the entire dataset. Sample method calculations are computed at that time.

• This function is calculated across a sample of all values.

• For more information on a population version of this function, see STDEVIF Function.

Wrangle vs. SQL: This function is part of Wrangle , a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

## Basic Usage

<span>stdevsampif</span>(testScores, testScores &gt; 0)

Output: Returns the standard deviation of the `testScores` column when the `testScores` value is greater than 0.

## Syntax and Arguments

stdevsampif(col_ref, test_expression) [group:group_col_ref] [limit:limit_count]

ArgumentRequired?Data TypeDescription
col_refYstringReference to the column you wish to evaluate.
test_expressionYstringExpression that is evaluated. Must resolve to `true` or `false`

For more information on the `group` and `limit` parameters, see Pivot Transform.

### col_ref

Name of the column whose values you wish to use in the calculation. Column must be a numeric (Integer or Decimal) type.

Usage Notes:

Required?Data TypeExample Value
YesString that corresponds to the name of the column`myValues`

### test_expression

This parameter contains the expression to evaluate. This expression must resolve to a Boolean (`true` or `false`) value.

Usage Notes:

Required?Data TypeExample Value
YesString expression that evaluates to `true` or `false````(LastName == 'Mouse' && FirstName == 'Mickey') ```

## Examples

### Example - Conditional Calculation Functions

This example shows some of the statistical functions that use the sample method of computation.

Functions:

ItemDescription
STDEVSAMP Function Computes the standard deviation across column values of Integer or Decimal type using the sample statistical method.
VARSAMP Function Computes the variance among all values in a column using the sample statistical method. Input column can be of Integer or Decimal. If no numeric values are detected in the input column, the function returns `0`
STDEVSAMPIF Function Generates the standard deviation of values by group in a column that meet a specific condition using the sample statistical method.
VARSAMPIF Function Generates the variance of values by group in a column that meet a specific condition using the sample statistical method.
ROUND Function Rounds input value to the nearest integer. Input can be an Integer, a Decimal, a column reference, or an expression. Optional second argument can be used to specify the number of digits to which to round.

Source:

Students took tests on three consecutive Saturdays:

StudentDateScore
Andrew11/9/1981
Bella11/9/1984
Christina11/9/1979
David11/9/1964
Ellen11/9/1961
Fred11/9/1963
Andrew11/16/1973
Bella11/16/1988
Christina11/16/1978
David11/16/1967
Ellen11/16/1987
Fred11/16/1990
Andrew11/23/1976
Bella11/23/1993
Christina11/23/1981
David11/23/1997
Ellen11/23/1997
Fred11/23/1991

Transformation:

You can use the following transformations to calculate standard deviation and variance across all dates using the sample method. Each computation has been rounded to three digits.

Transformation Name `New formula` `Single row formula` `round(stdevsamp(Score), 3)` `'stdevSamp'`

Transformation Name `New formula` `Single row formula` `round(varsamp(Score), 3)` `'varSamp'`

You can use the following to limit the previous statistical computations to the last two Saturdays of testing:

Transformation Name `New formula` `Single row formula` `round(stdevsampif(Score, Date != '11\/9\/2019'), 3)` `'stdevSampIf'`

Transformation Name `New formula` `Single row formula` `round(varsampif(Score, Date != '11\/9\/2019'), 3)` `'varSampIf'`

Results:

StudentDateScorevarSampIfstdevSampIfvarSampstdevSamp
Andrew11/9/198194.5159.722131.67311.475
Bella11/9/198494.5159.722131.67311.475
Christina11/9/197994.5159.722131.67311.475
David11/9/196494.5159.722131.67311.475
Ellen11/9/196194.5159.722131.67311.475
Fred11/9/196394.5159.722131.67311.475
Andrew11/16/197394.5159.722131.67311.475
Bella11/16/198894.5159.722131.67311.475
Christina11/16/197894.5159.722131.67311.475
David11/16/196794.5159.722131.67311.475
Ellen11/16/198794.5159.722131.67311.475
Fred11/16/199094.5159.722131.67311.475
Andrew11/23/197694.5159.722131.67311.475
Bella11/23/199394.5159.722131.67311.475
Christina11/23/198194.5159.722131.67311.475
David11/23/199794.5159.722131.67311.475
Ellen11/23/199794.5159.722131.67311.475
Fred11/23/199194.5159.722131.67311.475

• Page:
• Page:
• Page:
• Page:
• Page:

• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page: