Example #1
0
        // In this case the exponent is zero
        public void ProbabilityOfCorrectReponse_DeltaEqualsTheta_ReturnsOneHalf()
        {
            double alpha = .2;
            double delta = .3;
            TwoParamModelParameters     parameters          = new TwoParamModelParameters(alpha, delta);
            TwoParamProbabilityFunction probabilityFunction = new TwoParamProbabilityFunction(parameters);

            double theta = delta;
            double p     = probabilityFunction.ProbabilityOfCorrectResponse(theta);

            Assert.AreEqual(.5, p);
        }
Example #2
0
        public void ProbabilityOfCorrectReponse_DeltaNotEqualToTheta_ReturnsCorrectValue()
        {
            double alpha = .2;
            double delta = .3;
            TwoParamModelParameters     parameters          = new TwoParamModelParameters(alpha, delta);
            TwoParamProbabilityFunction probabilityFunction = new TwoParamProbabilityFunction(parameters);

            double theta = .1;
            double p     = probabilityFunction.ProbabilityOfCorrectResponse(theta);

            double expectedValue = Math.Exp(alpha * (theta - delta)) / (1 + Math.Exp(alpha * (theta - delta)));

            Assert.IsTrue(Math.Abs(expectedValue - p) < Tolerance);
        }
Example #3
0
        public void FirstThetaDerivative_NonTrivialInput_CloseToFiniteDifferenceValue()
        {
            double alpha = .2;
            double delta = .3;
            TwoParamModelParameters     parameters          = new TwoParamModelParameters(alpha, delta);
            TwoParamProbabilityFunction probabilityFunction = new TwoParamProbabilityFunction(parameters);
            FiniteDifferencer           finiteDifferencer   = new FiniteDifferencer(x => probabilityFunction.ProbabilityOfCorrectResponse(x));

            double theta            = .1;
            double derivative       = probabilityFunction.FirstThetaDerivative(theta);
            double approxDerivative = finiteDifferencer.ApproximateDerivative(theta);

            Assert.IsTrue(Math.Abs(derivative - approxDerivative) < Tolerance);
        }