You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Changelog
2
2
3
3
## 1.3.1 - WIP
4
+
- Adding `StudentT` class for the Student's t-distribution (pdf, cdf, invCdf) — building block for t-tests and confidence intervals with small samples
5
+
- Adding `tTest()` method for one-sample t-test — like z-test but appropriate for small samples where the population standard deviation is unknown
4
6
- Adding `zTest()` method for one-sample Z-test — tests whether the sample mean differs significantly from a hypothesized population mean (includes p-value calculation)
5
7
- Adding `Alternative` enum (`TwoSided`, `Greater`, `Less`) for hypothesis testing
6
8
- Adding `confidenceInterval()` method for computing confidence intervals for the mean using the normal (z) distribution
Perform a one-sample t-test for the mean. Tests whether the sample mean differs significantly from a hypothesized population mean using the Student's t-distribution. Unlike the z-test, the t-test is appropriate for small samples where the population standard deviation is unknown.
701
+
702
+
Returns an associative array with `tStatistic`, `pValue`, and `degreesOfFreedom`. The alternative hypothesis can be `TwoSided` (default), `Greater`, or `Less`.
This class is inspired by Python’s `statistics.NormalDist` and aims to provide similar functionality for PHP users. (Work in Progress)
1219
1241
1242
+
## `StudentT` class
1243
+
1244
+
The `StudentT` class represents the Student’s t-distribution, which is used for hypothesis testing and confidence intervals when the population standard deviation is unknown, especially with small sample sizes. As the degrees of freedom increase, the t-distribution approaches the standard normal distribution.
1245
+
1246
+
### Creating a StudentT instance
1220
1247
1248
+
```php
1249
+
use HiFolks\Statistics\StudentT;
1250
+
1251
+
$t = new StudentT(df: 10); // 10 degrees of freedom
1252
+
```
1253
+
1254
+
### Probability Density Function (PDF)
1255
+
1256
+
```php
1257
+
$t = new StudentT(5);
1258
+
$t->pdf(0); // ≈ 0.37961 (peak of the distribution)
1259
+
$t->pdf(2.0); // density at t=2
1260
+
$t->pdfRounded(0); // 0.38
1261
+
```
1262
+
1263
+
### Cumulative Distribution Function (CDF)
1264
+
1265
+
```php
1266
+
$t = new StudentT(5);
1267
+
$t->cdf(0); // 0.5 (symmetric around zero)
1268
+
$t->cdf(2.0); // ≈ 0.94874
1269
+
$t->cdfRounded(2.0); // 0.949
1270
+
```
1271
+
1272
+
### Inverse CDF (Quantile Function)
1273
+
1274
+
```php
1275
+
$t = new StudentT(10);
1276
+
$t->invCdf(0.975); // ≈ 2.228 (critical value for 95% two-sided test)
0 commit comments