PHPackages                             mnshankar/two-factorial-anova - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mnshankar/two-factorial-anova

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mnshankar/two-factorial-anova
=============================

Analysis of Variance with 2 independent variables (balanced, with interaction)

1.0(11y ago)018MITPHPPHP &gt;=5.3.0

Since May 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mnshankar/two-factorial-anova)[ Packagist](https://packagist.org/packages/mnshankar/two-factorial-anova)[ RSS](/packages/mnshankar-two-factorial-anova/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/54722b2358c4b5d2a25f137d5e2a2e270ee62c99d16507a43d246a19d358a5b4/68747470733a2f2f7472617669732d63692e6f72672f6d6e7368616e6b61722f74776f2d666163746f7269616c2d616e6f76612e737667)](https://travis-ci.org/mnshankar/two-factorial-anova)

Classic two-factorial ANOVA (With Replication)
==============================================

[](#classic-two-factorial-anova-with-replication)

This package is used to output simple 2 factor ANOVA (Analysis of Variables) parameters using PHP. (AKA: Two-Way ANOVA, Two-Way Crossed ANOVA)

Installation
------------

[](#installation)

Add the ANOVA package as a dependency to your composer.json file:

```
{
    "require": {
        "mnshankar/two-factorial-anova": "1.0"
    }
}
```

Usage
-----

[](#usage)

Initialize the factorial array for processing as follows: NOTE: Order in which data is passed in is important

```
*+-------------+------------------+-----------------------+
*|             |             1st Factor                   |
*|             |       1          |          2            |
*|             |                  |                       |
*+--------------------------------------------------------+
*|             |                  |                       |
*|             |       1          |          4            |
*|  2  A       |       2          |          5            |
*|  n          |       3          |          6            |
*|  d          |                  |                       |
*|             |                  |                       |
*|--F----------+------------------------------------------+
*|  a          |                  |                       |
*|  c          |                  |                       |
*|  t          |       7          |          10           |
*|  o  B       |       8          |          11           |
*|  r          |       9          |          12           |
*|             |                  |                       |
*+-------------+------------------+-----------------------+

```

```
 $obj = new ANOVA(
            array(1,2,3,4,5,6,7,8,9,10,11,12),3
        );
```

The above example is converting a 12 element array into a 2\*2 factorial array containing 3 elements in each cell. The first parameter to the constructor is the input array and the second parameter is the number of replications (defaults to 3)

The various ANOVA parameters can then be calculated as follows:

```
$obj->computeR();   //array of row sums
$obj->computeC();   //array of column sums
$obj->MSC();        //Mean square of columns
$obj->MSR();        //Mean square of rows
$obj->MSRC();       //Mean square interaction rc
$obj->MSE();        //Mean square residuals
$obj->Fc();         //F stat Column
$obj->Fr();         //F stat row
$obj->Frc();        //F stat interaction rc
$obj->Pc();         //P value Column
$obj->Pr();         //P value row
$obj->Prc();        //P value interaction rc
```

Reference
---------

[](#reference)

NIST/SEMATECH e-Handbook of Statistical Methods, , 5/4/2015.

I acknowledge with thanks, input from Dr. Ying Zhang, Ph.D Professor &amp; Director of Education Department of Biostatistics IU Fairbanks School of Public Health and IU School of Medicine

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4030d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec7d6db9c6a284d9ca1fb934910bb11c1eb3aaab1d9fc9daa5e92f98a43a37d6?d=identicon)[mnshankar](/maintainers/mnshankar)

---

Top Contributors

[![mnshankar](https://avatars.githubusercontent.com/u/2873887?v=4)](https://github.com/mnshankar "mnshankar (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mnshankar-two-factorial-anova/health.svg)

```
[![Health](https://phpackages.com/badges/mnshankar-two-factorial-anova/health.svg)](https://phpackages.com/packages/mnshankar-two-factorial-anova)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
