Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-butti committed Dec 13, 2024
1 parent 3448a85 commit 5655648
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,19 @@ $normalDist = new NormalDist(float $mu = 0.0, float $sigma = 1.0);

### Methods

#### 1. `pdf($x)`
#### Creating a normal distribution instance from sample data
The `fromSamples()` static method creates a normal distribution instance with mu and sigma parameters estimated from the sample data.

Example:

```php
$samples = [2.5, 3.1, 2.1, 2.4, 2.7, 3.5];
$normalDist = NormalDist::fromSamples($samples);
$normalDist->getMeanRounded(5); // 2.71667
$normalDist->getSigmaRounded(5); // 0.50761
```

#### Probability Density Function `pdf($x)`

Calculates the **Probability Density Function** at a given value xxx:

Expand All @@ -508,7 +520,7 @@ echo $normalDist->pdf(12.0); // Output: 0.12098536225957168

------

#### 2. `cdf($x)`
#### Cumulative Distribution Function `cdf($x)`

Calculates the **Cumulative Distribution Function** at a given value `$x`:

Expand Down

0 comments on commit 5655648

Please sign in to comment.