Esempio n. 1
0
 /**
  * Returns the cumulative distribution function, the probability of getting the test value or something below it
  * 
  * @param float $x The test value
  * @return float The probability
  */
 public function cdf($x)
 {
     return $this->calculator->getCdf($x, $this->df);
 }
Esempio n. 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);
 }