Esempio n. 1
0
void 
airport::BasicCrawler::add_user_dict(const char *key, const char *value)
{
    std::string tkey(key);
    std::string tValue(value);
    add_user_dict(tkey, tValue);
}
// ---------------------------------------------------------------------------
// Rotates image clockwise
// ---------------------------------------------------------------------------
// 
void CAlfExAnalogDialerControl::RotatePlate(
                                    CAlfImageVisual&    aImage,
                                    TInt                aInitialAngle,
                                    TInt                aTargetAngle,
                                    TBool               aIsClockWiseOverZeroReached)
    {
    // When rotates clockwise, rotation angle is negative
    TInt rotateDelta = aTargetAngle-aInitialAngle;
    if (aIsClockWiseOverZeroReached)
        {
        // Angle is big value (near to 360), which cannot be used as such
        // Convert it to negative value
        rotateDelta = (aTargetAngle-360)-aInitialAngle;
        }
    //RDebug::Printf("***AnalogDialer rotateDelta : %d",rotateDelta);
    TAlfTimedValue tValue(rotateDelta);
    aImage.SetTurnAngle(tValue);
    }
/**
 * \brief Runs a one-sample t test on a vector of numbers.
 * \param[in] values The vector of numbers.
 * \param[in] distributionMean The mean 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::oneSampleTTest(const std::vector<double>& values, const double& distributionMean,
		const double& confidenceLevel, const TestCase& testCase) {
	/**
	 * TODO: Execute the one sample T test for the given vector of numbers and either
	 * reject the null hypothesis or state that you cannot reject the null hypothesis.
	 */

	/*
	 * Available methods:
	 * - lookupTTable(size_t degreeOfFreedom, double confidenceLevel, TestType testType):
	 *       returns the quantile function of the student's t distribution (see slide
	 *       of the standard normal distribution at Z (see slide 29 for examples).
	 *       testType can be either ONE_SIDED or TWO_SIDED.
	 * - 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.
	 */
	size_t dof = values.size() -1;
	double tscore = tValue(values,distributionMean);
	double tlookup ;
	const Hypothesis& h1 = testCase.getHypothesis();
	const Hypothesis& h0 = testCase.getNullHypothesis();
		/* 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) 	{
			tlookup = lookupTTable(dof,confidenceLevel,StatisticalTesting::ONE_SIDED);
			if (tscore >tlookup )
				h0.reject();
				else 		{
					h0.cannotReject();
				}
		}
		else {
			if(h0.getDirection()==AT_LEAST)
			{
				tlookup = lookupTTable(dof,(1-confidenceLevel),StatisticalTesting::ONE_SIDED);
				if (tscore < tlookup )
					h0.reject();
					else {
						h0.cannotReject();
					}
			}
			else {
				double right_boundry = lookupTTable(dof,confidenceLevel,StatisticalTesting::ONE_SIDED);
				double left_boundry = lookupTTable(dof,(1-confidenceLevel),StatisticalTesting::ONE_SIDED);
							if((tscore<left_boundry)||(tscore>right_boundry))
								h0.reject();
								else 	{
									h0.cannotReject();
								}
			}
		}


}