norm_generic {tidynorm} | R Documentation |
Generic Normalization Procedure
Description
This is a generic normalization procedure with which you can create your own normalization method.
Usage
norm_generic(
.data,
...,
.by = NULL,
.by_formant = FALSE,
.by_token = FALSE,
.L = 0,
.S = 1,
.pre_trans = function(x) x,
.post_trans = function(x) x,
.drop_orig = FALSE,
.keep_params = FALSE,
.names = "{.formant}_n",
.silent = FALSE,
.call = caller_env()
)
Arguments
.data |
A data frame containing vowel formant data |
... |
|
.by |
|
.by_formant |
Whether or not the normalization method is formant intrinsic. |
.by_token |
Whether or not the normalization method is vowel intrinsic |
.L |
An expression defining the location parameter. See Details for more information. |
.S |
An expression defining the scale parameter. See Details for more information. |
.pre_trans |
A function to apply to formant values before normalization. |
.post_trans |
A function to apply to formant values after normalization. |
.drop_orig |
Whether or not to drop the original formant data columns. |
.keep_params |
Whether or not to keep the Location ( |
.names |
A |
.silent |
Whether or not the informational message should be printed. |
.call |
Used for internal purposes. |
Details
The following norm_*
procedures are built on top of norm_generic()
.
Location and Scale expressions
All normalization procedures built on norm_generic produce normalized
formant values (\hat{F}
) by subtracting a location parameter
(L
) and dividing by a scale parameter (S
).
\hat{F} = \frac{F-L}{S}
The expressions for calculating L
and S
can be
passed to .L
and .S
, respectively. Available values for
these expressions are
.formant
The original formant value
.formant_num
The number of the formant. (e.g. 1 for F1, 2 for F2 etc)
Along with any data columns from your original data.
Pre and Post normalization transforms
To apply any transformations before or after normalization,
you can pass a function to .pre_trans
and .post_trans
.
Formant In/Extrinsic Normalization
If .by_formant
is TRUE
, normalization will be formant intrinsic.
If .by_formant
is FALSE
, normalization will be formant extrinsic.
Token In/Extrinsic Normalization
If .by_token
is TRUE
, normalization will be token intrinsic.
If .by_token
is FALSE
, normalization will be token extrinsic.
Value
A data frame of normalized formant values
Examples
library(tidynorm)
library(dplyr)
speaker_data |>
norm_generic(
F1:F3,
.by = speaker,
.by_formant = TRUE,
.L = median(.formant, na.rm = TRUE),
.S = mad(.formant, na.rm = TRUE),
.drop_orig = TRUE,
.names = "{.formant}_mad"
)