예제 #1
0
 /**
  * Returns the moments of the distribution
  * 
  * @param string $moments Which moments to compute. m for mean, v for variance, s for skew, k for kurtosis.  Default 'mv'
  * @return type array A dictionary containing the first four moments of the distribution
  */
 public function stats($moments = 'mv')
 {
     return $this->calculator->getStats($moments, $this->df);
 }
예제 #2
0
 /**
  * Two Sample T Test
  * 
  * The two-sample T test tests whether two samples are significantly
  * different from each other.
  * 
  * @param array $datax The first sample to test
  * @param array $datay The second sample to test
  * @return float The probability of having the first sample's population mean be greater than or equal to the second sample's population mean
  */
 public function twoSampleTTest(array $datax, array $datay)
 {
     $df = pow(pow($this->basic->sampleStddev($datax), 2) / count($datax) + pow($this->basic->sampleStddev($datay), 2) / count($datay), 2) / (pow(pow($this->basic->sampleStddev($datax), 2) / count($datax), 2) / (count($datax) - 1) + pow(pow($this->basic->sampleStddev($datay), 2) / count($datay), 2) / (count($datay) - 1));
     $sampleT = ($this->basic->average($datax) - $this->basic->average($datay)) / sqrt(pow($this->basic->sampleStddev($datax), 2) / count($datax) + pow($this->basic->sampleStddev($datay), 2) / count($datay));
     return $this->stu->getCdf($sampleT, $df);
 }