void OrderWindow::meanComparison(){ exptPoints pts = inputWindow->currentPoints(); zScore(pts.values); // better algorithm. // determine the normed value.. //bool normed = selector[1]->isChecked(); // radio buttons.. so it's ok.. //emit doMeanComparison(pts.values, pts.indices, normed, getDist->isChecked()); }
double Sensor::nomalization(double* tempOrHumid) { findTrimmed(tempOrHumid, TRIM_PERCENT); return zScore(tempOrHumid); }
/** * \brief Runs a one-sample Z test on a vector of numbers. * \param[in] values The vector of numbers. * \param[in] distributionMean The mean of the entire population. * \param[in] distributionStandardDeviation the standard deviation of the entire population. * \param[in] The confidence level (commonly used values: 0.95, 0.999) * \param[in] testCase The test case containing the hypothesis and null hypothesis chosen in germanStudentsTest() */ void StatisticalTesting::oneSampleZTest(const std::vector<double>& values, const double& distributionMean, const double& distributionStandardDeviation, const double& confidenceLevel, const TestCase& testCase) { /** * TODO: Execute the Z test for the given vector of numbers and either * reject the null hypothesis or state that you cannot reject the null hypothesis. */ /* * Available methods: * - lookupZTable(double Z): returns the cumulative density function * of the standard normal distribution at Z (see slide 23 for examples). * - testCase.getHypothesis(): returns the hypothesis (see germanStudentsTest() above) * - testCase.getNullHypothesis(): returns the null hypothesis (see germanStudentsTest() above) * * For both the hypothesis and the null hypothesis, the following methods are available: * - hypothesis.getDirection(): Returns one element from the following enumeration: * LESS, GREATER, AT_LEAST, AT_MOST, EQUAL, or DIFFERENT. * - hypothesis.reject(): Rejects the hypothesis. * - hypothesis.cannotReject(): States that we cannot reject the hypothesis based on the data. */ double zscore = zScore(values,distributionMean,distributionStandardDeviation); double zlookup = lookupZTable(zscore); const Hypothesis& h1 = testCase.getHypothesis(); const Hypothesis& h0 = testCase.getNullHypothesis(); double zconfidence = 0; normal s; /* If greater or lesser the area of significance is on one side of curve. so we use quantile with same * confidence level. Else we can divide alpha by 2 for two sided test * */ if (h0.getDirection()==AT_MOST) { zconfidence = confidenceLevel; if (zlookup>zconfidence) h0.reject(); else { h0.cannotReject(); } } else { if(h0.getDirection()==AT_LEAST) { zconfidence = (1-confidenceLevel); if (zlookup<zconfidence) h0.reject(); else { h0.cannotReject(); } } else { double left_boundry = (1-confidenceLevel); double right_boundry = confidenceLevel; if((zlookup<left_boundry)||(zlookup>right_boundry)) h0.reject(); else { h0.cannotReject(); } } } }
void Normaliser::zScore(float** v, unsigned int ps, unsigned int es){ for(int i=0; i < ps; i++){ zScore(v[i], es); } }
void OrderWindow::rawComparison(){ exptPoints pts = inputWindow->currentPoints(); zScore(pts.values); // better algorithm. //emit doRawComparison(pts.values, pts.indices, getDist->isChecked()); }