Skip to content

Commit

Permalink
Refactor standard deviation terms in schemas and rename related metho…
Browse files Browse the repository at this point in the history
…ds (#81)

This commit modifies all standard deviation related terms in JSON, PHP,
YML files from `sd_sample` and `sd_population` to `stddev` and
`stddev_pop` respectively. The related methods are also renamed to align
with these changes. This replaces the abbreviated form `sd` with the
more commonly used term `stddev`, improving clarity and understanding
for users. Corresponding comments and tests are updated to reflect these
changes.
  • Loading branch information
SmetDenis committed Mar 24, 2024
1 parent b11dbfe commit 3f0225c
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 65 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,21 +317,21 @@ columns:
sample_variance_min: 1.123
sample_variance_max: 10.123

# Standard deviation (For a sample; uses sample variance).
# Standard deviation is a measure that is used to quantify the amount of variation or dispersion of a set of data values.
# A low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set.
# A high standard deviation indicates that the data points are spread out over a wider range of values.
# Standard deviation (For a sample; uses sample variance). It also known as SD or StdDev.
# StdDev is a measure that is used to quantify the amount of variation or dispersion of a set of data values.
# - Low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set.
# - High standard deviation indicates that the data points are spread out over a wider range of values.
# See: https://en.wikipedia.org/wiki/Standard_deviation.
sd_sample: 5.123
sd_sample_not: 4.123
sd_sample_min: 1.123
sd_sample_max: 10.123
stddev: 5.123
stddev_not: 4.123
stddev_min: 1.123
stddev_max: 10.123

# SD+ (Standard deviation for a population; uses population variance).
sd_population: 5.123
sd_population_not: 4.123
sd_population_min: 1.123
sd_population_max: 10.123
stddev_pop: 5.123
stddev_pop_not: 4.123
stddev_pop_min: 1.123
stddev_pop_max: 10.123

# Coefficient of variation (cᵥ) Also known as relative standard deviation (RSD).
# A standardized measure of dispersion of a probability distribution or frequency distribution.
Expand Down
18 changes: 9 additions & 9 deletions schema-examples/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@
"sample_variance_min" : 1.123,
"sample_variance_max" : 10.123,

"sd_sample" : 5.123,
"sd_sample_not" : 4.123,
"sd_sample_min" : 1.123,
"sd_sample_max" : 10.123,

"sd_population" : 5.123,
"sd_population_not" : 4.123,
"sd_population_min" : 1.123,
"sd_population_max" : 10.123,
"stddev" : 5.123,
"stddev_not" : 4.123,
"stddev_min" : 1.123,
"stddev_max" : 10.123,

"stddev_pop" : 5.123,
"stddev_pop_not" : 4.123,
"stddev_pop_min" : 1.123,
"stddev_pop_max" : 10.123,

"coef_of_var" : 5.123,
"coef_of_var_not" : 4.123,
Expand Down
18 changes: 9 additions & 9 deletions schema-examples/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@
'sample_variance_min' => 1.123,
'sample_variance_max' => 10.123,

'sd_sample' => 5.123,
'sd_sample_not' => 4.123,
'sd_sample_min' => 1.123,
'sd_sample_max' => 10.123,

'sd_population' => 5.123,
'sd_population_not' => 4.123,
'sd_population_min' => 1.123,
'sd_population_max' => 10.123,
'stddev' => 5.123,
'stddev_not' => 4.123,
'stddev_min' => 1.123,
'stddev_max' => 10.123,

'stddev_pop' => 5.123,
'stddev_pop_not' => 4.123,
'stddev_pop_min' => 1.123,
'stddev_pop_max' => 10.123,

'coef_of_var' => 5.123,
'coef_of_var_not' => 4.123,
Expand Down
24 changes: 12 additions & 12 deletions schema-examples/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,21 @@ columns:
sample_variance_min: 1.123
sample_variance_max: 10.123

# Standard deviation (For a sample; uses sample variance).
# Standard deviation is a measure that is used to quantify the amount of variation or dispersion of a set of data values.
# A low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set.
# A high standard deviation indicates that the data points are spread out over a wider range of values.
# Standard deviation (For a sample; uses sample variance). It also known as SD or StdDev.
# StdDev is a measure that is used to quantify the amount of variation or dispersion of a set of data values.
# - Low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set.
# - High standard deviation indicates that the data points are spread out over a wider range of values.
# See: https://en.wikipedia.org/wiki/Standard_deviation.
sd_sample: 5.123
sd_sample_not: 4.123
sd_sample_min: 1.123
sd_sample_max: 10.123
stddev: 5.123
stddev_not: 4.123
stddev_min: 1.123
stddev_max: 10.123

# SD+ (Standard deviation for a population; uses population variance).
sd_population: 5.123
sd_population_not: 4.123
sd_population_min: 1.123
sd_population_max: 10.123
stddev_pop: 5.123
stddev_pop_not: 4.123
stddev_pop_min: 1.123
stddev_pop_max: 10.123

# Coefficient of variation (cᵥ) Also known as relative standard deviation (RSD).
# A standardized measure of dispersion of a probability distribution or frequency distribution.
Expand Down
16 changes: 8 additions & 8 deletions schema-examples/full_clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ columns:
sample_variance_not: 4.123
sample_variance_min: 1.123
sample_variance_max: 10.123
sd_sample: 5.123
sd_sample_not: 4.123
sd_sample_min: 1.123
sd_sample_max: 10.123
sd_population: 5.123
sd_population_not: 4.123
sd_population_min: 1.123
sd_population_max: 10.123
stddev: 5.123
stddev_not: 4.123
stddev_min: 1.123
stddev_max: 10.123
stddev_pop: 5.123
stddev_pop_not: 4.123
stddev_pop_min: 1.123
stddev_pop_max: 10.123
coef_of_var: 5.123
coef_of_var_not: 4.123
coef_of_var_min: 1.123
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@
use JBZoo\CsvBlueprint\Rules\AbstarctRule;
use MathPHP\Statistics\Descriptive;

final class ComboSdSample extends AbstarctAggregateRuleCombo
final class ComboStddev extends AbstarctAggregateRuleCombo
{
public const INPUT_TYPE = AbstarctRule::INPUT_TYPE_FLOATS;

protected const NAME = 'standard deviation (SD)';
protected const NAME = 'StdDev';

protected const HELP_TOP = [
'Standard deviation (For a sample; uses sample variance)',
'Standard deviation is a measure that is used to quantify the amount of variation or ' .
'dispersion of a set of data values.',
'A low standard deviation indicates that the data points tend to be close to the mean ' .
'Standard deviation (For a sample; uses sample variance). It also known as SD or StdDev.',
'StdDev is a measure that is used to quantify the amount of variation or dispersion of a set of data values.',
' - Low standard deviation indicates that the data points tend to be close to the mean ' .
'(also called the expected value) of the set.',
'A high standard deviation indicates that the data points are spread out over a wider range of values.',
' - High standard deviation indicates that the data points are spread out over a wider range of values.',
'See: https://en.wikipedia.org/wiki/Standard_deviation',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use JBZoo\CsvBlueprint\Rules\AbstarctRule;
use MathPHP\Statistics\Descriptive;

final class ComboSdPopulation extends AbstarctAggregateRuleCombo
final class ComboStddevPop extends AbstarctAggregateRuleCombo
{
public const INPUT_TYPE = AbstarctRule::INPUT_TYPE_FLOATS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
namespace JBZoo\PHPUnit\Rules\Aggregate;

use JBZoo\CsvBlueprint\Rules\AbstarctRule as Combo;
use JBZoo\CsvBlueprint\Rules\Aggregate\ComboSdSample;
use JBZoo\CsvBlueprint\Rules\Aggregate\ComboStddev;
use JBZoo\PHPUnit\Rules\TestAbstractAggregateRuleCombo;

use function JBZoo\PHPUnit\isSame;

class ComboSdSampleTest extends TestAbstractAggregateRuleCombo
class ComboStdDevTest extends TestAbstractAggregateRuleCombo
{
protected string $ruleClass = ComboSdSample::class;
protected string $ruleClass = ComboStddev::class;

public function testEqual(): void
{
Expand All @@ -33,7 +33,7 @@ public function testEqual(): void

$rule = $this->create(3, Combo::EQ);
isSame(
'The standard deviation (SD) in the column is "2.5", which is not equal than the expected "3"',
'The StdDev in the column is "2.5", which is not equal than the expected "3"',
$rule->test([1, 5, 1, 1, 1, 2, 8, 1, 1]),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
namespace JBZoo\PHPUnit\Rules\Aggregate;

use JBZoo\CsvBlueprint\Rules\AbstarctRule as Combo;
use JBZoo\CsvBlueprint\Rules\Aggregate\ComboSdPopulation;
use JBZoo\CsvBlueprint\Rules\Aggregate\ComboStddevPop;
use JBZoo\PHPUnit\Rules\TestAbstractAggregateRuleCombo;

use function JBZoo\PHPUnit\isSame;

class ComboSdPopulationTest extends TestAbstractAggregateRuleCombo
class ComboStddevPopTest extends TestAbstractAggregateRuleCombo
{
protected string $ruleClass = ComboSdPopulation::class;
protected string $ruleClass = ComboStddevPop::class;

public function testEqual(): void
{
Expand Down
1 change: 1 addition & 0 deletions tests/schemas/todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ columns:
# Multi prop
multiple: true
multiple_separator: "|" # Separator for multiple values
faker: [faker_method arg1 arg2] # Faker method with arguments

rules:
# https://github.com/Respect/Validation/blob/main/docs/08-list-of-rules-by-category.md
Expand Down

0 comments on commit 3f0225c

Please sign in to comment.