/// <summary>
        /// Calculates the x-value boundaries of the area that covers a certain amount
        /// of cumulative density function of the passed normal-distribution.
        /// </summary>
        /// <param name="mean">mean of the passed normal-distribution</param>
        /// <param name="stdDev">standard-deviation of the passed normal-distribution</param>
        /// <param name="areaCoverage">describes the percentage of area that should be covered below
        /// the normal-distribution function. This percentage has to be in the interval ]0,1[</param>
        /// <returns>a touple containing the lower and upper boundary x-value of the
        /// passed area</returns>
        public static (double lowerBoundary, double upperBoundary) CalculateBoundaries(
            double mean,
            double stdDev,
            double areaCoverage)
        {
            if (areaCoverage <= 0 || areaCoverage >= 1)
            {
                throw new InvalidOperationException($"{nameof(areaCoverage)} has to be in boundary ]0,1[ but is {areaCoverage}");
            }
            else if (double.IsNaN(mean) || double.IsNaN(stdDev))
            {
                return(double.NegativeInfinity, double.PositiveInfinity);
            }
            else if (stdDev == 0)
            {
                return(mean, mean);
            }

            var distribution = new Accord.Statistics.Distributions.Univariate.NormalDistribution(mean, stdDev);

            var lowerBoundaryPercentage = (1 - areaCoverage) / 2;
            var upperBoundaryPercentage = 1 - lowerBoundaryPercentage;

            return(
                distribution.InverseDistributionFunction(lowerBoundaryPercentage),
                distribution.InverseDistributionFunction(upperBoundaryPercentage));
        }
        public void TwoSampleZTestConstructorTest()
        {
            Accord.Math.Tools.SetupGenerator(0);

            double[] samples1 = new Accord.Statistics.Distributions.Univariate
                                .NormalDistribution(29.8, 4.0).Generate(200);

            double[] samples2 = new Accord.Statistics.Distributions.Univariate
                                .NormalDistribution(34.7, 5.0).Generate(250);

            TwoSampleZTest actual = new TwoSampleZTest(samples1, samples2);

            double mean1 = Accord.Statistics.Tools.Mean(samples1);
            double mean2 = Accord.Statistics.Tools.Mean(samples2);

            double var1 = Accord.Statistics.Tools.Variance(samples1);
            double var2 = Accord.Statistics.Tools.Variance(samples2);

            int n1 = samples1.Length;
            int n2 = samples2.Length;

            TwoSampleZTest expected = new TwoSampleZTest(mean1, var1, n1, mean2, var2, n2);


            Assert.AreEqual(expected.EstimatedValue1, actual.EstimatedValue1);
            Assert.AreEqual(expected.EstimatedValue2, actual.EstimatedValue2);


            Assert.AreEqual(expected.StandardError, actual.StandardError);
            Assert.AreEqual(expected.Statistic, actual.Statistic);

            Assert.IsTrue(actual.Significant);
        }
        public void TwoSampleZTestConstructorTest()
        {
            Accord.Math.Tools.SetupGenerator(0);

            double[] samples1 = new Accord.Statistics.Distributions.Univariate
                .NormalDistribution(29.8, 4.0).Generate(200);

            double[] samples2 = new Accord.Statistics.Distributions.Univariate
                .NormalDistribution(34.7, 5.0).Generate(250);

            TwoSampleZTest actual = new TwoSampleZTest(samples1, samples2);

            double mean1 = Accord.Statistics.Tools.Mean(samples1);
            double mean2 = Accord.Statistics.Tools.Mean(samples2);

            double var1 = Accord.Statistics.Tools.Variance(samples1);
            double var2 = Accord.Statistics.Tools.Variance(samples2);

            int n1 = samples1.Length;
            int n2 = samples2.Length;

            TwoSampleZTest expected = new TwoSampleZTest(mean1, var1, n1, mean2, var2, n2);


            Assert.AreEqual(expected.EstimatedValue1, actual.EstimatedValue1);
            Assert.AreEqual(expected.EstimatedValue2, actual.EstimatedValue2);


            Assert.AreEqual(expected.StandardError, actual.StandardError);
            Assert.AreEqual(expected.Statistic, actual.Statistic);

            Assert.IsTrue(actual.Significant);
        }
Exemple #4
0
        private void variableanalysisbutton_Click(object sender, EventArgs e)
        {
            clear();
            if (comboBox1.Text.Equals("Зависимая переменная"))
            {
                number_cols = 0;
            }
            else
            {
                string resultString = string.Join(string.Empty, Regex.Matches(comboBox1.Text, @"\d+").OfType <Match>().Select(m => m.Value));
                int.TryParse(resultString, out number_cols);
            }
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                double val1 = Convert.ToDouble(dataGridView1.Rows[i].Cells[number_cols].Value);

                if (!valuesUQ.Contains(val1))
                {
                    valuesUQ.Add(val1);
                }
                values.Add(val1);
            }
            Numberofvalues.Text     = values.Count.ToString();
            numberuniquevalues.Text = valuesUQ.Count.ToString();
            scaletype.Text          = AnalysisClass.getScale(valuesUQ.Count);



            Accord.Statistics.Distributions.Univariate.NormalDistribution normDist =
                Accord.Statistics.Distributions.Univariate.NormalDistribution.Standard;


            if (!scaletype.Text.Equals("дихотомическая"))
            {
                Accord.Statistics.Testing.KolmogorovSmirnovTest kstX =
                    new Accord.Statistics.Testing.KolmogorovSmirnovTest(values.ToArray(), normDist);
                TypeDistr.Text         = AnalysisClass.getDistributionScale(kstX.Significant);
                avg.Text               = Math.Round(MathNet.Numerics.Statistics.Statistics.Mean(values), 3).ToString();
                standarddeviation.Text = Math.Round(MathNet.Numerics.Statistics.Statistics.PopulationStandardDeviation(values), 3).ToString();
                skewness.Text          = Math.Round(MathNet.Numerics.Statistics.Statistics.PopulationSkewness(values), 3).ToString();
                piko.Text              = Math.Round(MathNet.Numerics.Statistics.Statistics.PopulationKurtosis(values), 3).ToString();
                plotting.CreateGraphNormDistr(zg1, values, valuesUQ);
            }
            else
            {
                TypeDistr.Text         = "Невозможно определить определить";
                avg.Text               = "Невозможно определить определить";
                standarddeviation.Text = "Невозможно определить определить";
                skewness.Text          = "Невозможно определить определить";
                piko.Text              = "Невозможно определить определить";
                zg1.GraphPane.CurveList.Clear();
                zg1.GraphPane.GraphObjList.Clear();
                zg1.Refresh();
            }
        }
 private void Recalculate(double mean, double stdDev)
 {
     Accord.DoubleRange range = new Accord.DoubleRange(-100, 100);
     Task.Run(() =>
     {
         Accord.Statistics.Distributions.Univariate.NormalDistribution normalDistribution = new Accord.Statistics.Distributions.Univariate.NormalDistribution(mean, stdDev);
         double[] x = Accord.Math.Vector.Range(-100, 100, 0.1);
         double[] y = x.Apply(normalDistribution.ProbabilityDensityFunction);
         return(pmservice.Create(range, "", x, y, false));
     }).ContinueWith(a => this.Dispatcher.InvokeAsync(async() => PlotModel = await a, System.Windows.Threading.DispatcherPriority.Background));
 }
        /// <summary>
        /// Generates a random observation from the passed normal-distribution
        /// </summary>
        /// <param name="mean">mean of the passed normal-distribution</param>
        /// <param name="stdDev">standard-deviation of the passed normal-distribution</param>
        /// <returns>the generated random observation</returns>
        public static double GenerateObservation(double mean, double stdDev)
        {
            if (stdDev == 0)
            {
                return(mean);
            }

            var distribution = new Accord.Statistics.Distributions.Univariate.NormalDistribution(mean, stdDev);

            return(distribution.Generate());
        }
       //static private decimal GetBlsCallPrice(double S, double K, double T, double sigma, double r)
       // {
       //     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
       //     return decimal.Ceiling((decimal)(S * normDist.DistributionFunction(D1(S, K, T, sigma, r)) - K * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r)))*100m)/100m;
       //     //return S * normDist.DistributionFunction(D1(S, K, T, sigma, r)) - K * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r));
       // }

       // static private decimal GetBlsPutPrice(double S, double K, double T, double sigma, double r)
       // {
       //     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
       //     return decimal.Ceiling((decimal)(-S * normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r)))*100m)/100m;
       //     //return -S * normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r));
       // }

       // static public decimal GetBlsPrice(double S, double K, double T, double sigma, double r, char type)
       // {
       //     return type == 'c' ? GetBlsCallPrice(S, K, T, sigma, r) : GetBlsPutPrice(S, K, T, sigma, r);
       // }

        static public double GetBlsDelta(double S, double K, double T, double sigma, double r, char type)
        {
            Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
            return type == 'c'? (normDist.DistributionFunction(D1(S, K, T, sigma, r))) : (normDist.DistributionFunction(D1(S, K, T, sigma, r))-1);

        }
Exemple #8
0
        private void doAnalysisBtn_Click(object sender, EventArgs e)
        {
            List <Double> xUniqVals = new List <Double>();
            List <Double> yUniqVals = new List <Double>();

            for (int i = 0; i < dataGV_data.RowCount - 1; i++)
            {
                Double val1 = Convert.ToDouble(dataGV_data.Rows[i].Cells[0].Value);
                Double val2 = Convert.ToDouble(dataGV_data.Rows[i].Cells[1].Value);
                if (!xUniqVals.Contains(val1))
                {
                    xUniqVals.Add(val1);
                }
                if (!yUniqVals.Contains(val2))
                {
                    yUniqVals.Add(val2);
                }
                xVals.Add(val1);
                yVals.Add(val2);
            }
            volumeTxtBx.Text     = (dataGV_data.RowCount - 1).ToString();
            xUniqCountTxtBx.Text = xUniqVals.Count.ToString();
            yUniqCountTxtBx.Text = yUniqVals.Count.ToString();
            xSchaleTxtBx.Text    = AnalysisClass.getScale(xUniqVals.Count);
            ySchaleTxtBx.Text    = AnalysisClass.getScale(yUniqVals.Count);

            Accord.Statistics.Distributions.Univariate.NormalDistribution normDist =
                Accord.Statistics.Distributions.Univariate.NormalDistribution.Standard;

            cl.CreateGraph(zg1, dataGV_data);

            if (!xSchaleTxtBx.Text.Equals("дихотомическая"))
            {
                Accord.Statistics.Testing.KolmogorovSmirnovTest kstX =
                    new Accord.Statistics.Testing.KolmogorovSmirnovTest(xVals.ToArray(), normDist);
                distrXTxtBx.Text = AnalysisClass.getDistributionScale(kstX.Significant);

                meanXTxtBx.Text   = MathNet.Numerics.Statistics.Statistics.Mean(xVals).ToString();
                stddevXTxtBx.Text = MathNet.Numerics.Statistics.Statistics.PopulationStandardDeviation(xVals).ToString();

                skewXTxtBx.Text = MathNet.Numerics.Statistics.Statistics.PopulationSkewness(xVals).ToString();
                kurtXTxtBx.Text = MathNet.Numerics.Statistics.Statistics.PopulationKurtosis(xVals).ToString();

                cl.CreateGraph3(zg3, dataGV_data);
            }

            if (!ySchaleTxtBx.Text.Equals("дихотомическая"))
            {
                Accord.Statistics.Testing.KolmogorovSmirnovTest kstY =
                    new Accord.Statistics.Testing.KolmogorovSmirnovTest(yVals.ToArray(), normDist);
                distrYTxtBx.Text = AnalysisClass.getDistributionScale(kstY.Significant);

                meanYTxtBx.Text   = MathNet.Numerics.Statistics.Statistics.Mean(yVals).ToString();
                stddevYTxtBx.Text = MathNet.Numerics.Statistics.Statistics.PopulationStandardDeviation(yVals).ToString();

                skewYTxtBx.Text = MathNet.Numerics.Statistics.Statistics.PopulationSkewness(yVals).ToString();
                kurtYTxtBx.Text = MathNet.Numerics.Statistics.Statistics.PopulationKurtosis(yVals).ToString();

                cl.CreateGraph2(zg2, dataGV_data);
            }

            coefficientsTxtBx.Text = AnalysisClass.getCorrelationCoefficients(
                xSchaleTxtBx.Text, distrXTxtBx.Text, ySchaleTxtBx.Text, distrYTxtBx.Text, dataGV_data.RowCount - 1);


            xVals.Clear();
            yVals.Clear();
            xUniqVals.Clear();
            yUniqVals.Clear();
        }
 static public decimal GetBlsPutPrice(double S, double K, double T, double sigma, double r)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return decimal.Round((decimal)(-S * normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r)))+0.01m, 2, MidpointRounding.AwayFromZero);
 }
 public static double zScore(double alpha=0.05)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution nd = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return nd.InverseDistributionFunction(1 - (alpha / 2));
 }
Exemple #11
0
 public static double zScore(double alpha = 0.05)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution nd = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return(nd.InverseDistributionFunction(1 - (alpha / 2)));
 }
Exemple #12
0
 static public double GetBlsRho(double S, double K, double T, double sigma, double r, char type)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return(type == 'c'?K * T * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r)):-K *T *Math.Exp(-r *T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r)));
 }
 static public double GetBlsVega(double S, double K, double T, double sigma, double r)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return S * Math.Sqrt(T) * normDist.ProbabilityDensityFunction(D1(S, K, T, sigma, r));
 }
Exemple #14
0
 static public double GetBlsTheta(double S, double K, double T, double sigma, double r, char type)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return(-normDist.ProbabilityDensityFunction(D1(S, K, T, sigma, r)) * S * sigma / (2 * Math.Sqrt(T)) - r * K * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r)) * (type == 'c'?1:-1));
 }
Exemple #15
0
        public static string getReggressionMethod(List <string> typeScale, string typeMethod, List <double> vs)
        {
            Accord.Statistics.Distributions.Univariate.NormalDistribution normDist =
                Accord.Statistics.Distributions.Univariate.NormalDistribution.Standard;

            Accord.Statistics.Testing.KolmogorovSmirnovTest kstX =
                new Accord.Statistics.Testing.KolmogorovSmirnovTest(vs.ToArray(), normDist);
            AnalysisClass.getDistributionScale(kstX.Significant);
            switch (typeMethod)
            {
            case "Простая линейная регрессия":
                if ((typeScale[0].Equals("ранговая") || typeScale[0].Equals("количественная")) && typeScale.Count == 2)
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            case "Множественная линейная регрессия":
                if ((typeScale[0].Equals("ранговая") || typeScale[0].Equals("количественная")) && typeScale.Count > 2)
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            case "Нелинейная регрессия":
                if ((typeScale[0].Equals("ранговая") || typeScale[0].Equals("количественная")) && typeScale.Count >= 2 && AnalysisClass.getDistributionScale(kstX.Significant) == "нормальное")
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            case "Бинарная логистическая регрессия":
                if ((typeScale[0].Equals("дихотомическая")) && typeScale.Count > 2)
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            case "Мультиномиальная логистическая регрессия":
                if (typeScale[0].Equals("ранговая") && typeScale.Count > 2 && AnalysisClass.getDistributionScale(kstX.Significant) == "нормальное")
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            case "Порядковая регрессия":
                if (typeScale[0].Equals("ранговая") && typeScale.Count > 2 && AnalysisClass.getDistributionScale(kstX.Significant) == "нормальное")
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            case "Пробит-анализ":
                if ((typeScale[0].Equals("дихотомическая")) && typeScale.Count > 2)
                {
                    return("Метод применим к данным");
                }
                else
                {
                    return("Метод не применим к данным");
                }

            default:
                return("Нет");
            }
        }
Exemple #16
0
        //static private decimal GetBlsCallPrice(double S, double K, double T, double sigma, double r)
        // {
        //     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
        //     return decimal.Ceiling((decimal)(S * normDist.DistributionFunction(D1(S, K, T, sigma, r)) - K * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r)))*100m)/100m;
        //     //return S * normDist.DistributionFunction(D1(S, K, T, sigma, r)) - K * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r));
        // }

        // static private decimal GetBlsPutPrice(double S, double K, double T, double sigma, double r)
        // {
        //     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
        //     return decimal.Ceiling((decimal)(-S * normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r)))*100m)/100m;
        //     //return -S * normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r));
        // }

        // static public decimal GetBlsPrice(double S, double K, double T, double sigma, double r, char type)
        // {
        //     return type == 'c' ? GetBlsCallPrice(S, K, T, sigma, r) : GetBlsPutPrice(S, K, T, sigma, r);
        // }

        static public double GetBlsDelta(double S, double K, double T, double sigma, double r, char type)
        {
            Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
            return(type == 'c'? (normDist.DistributionFunction(D1(S, K, T, sigma, r))) : (normDist.DistributionFunction(D1(S, K, T, sigma, r)) - 1));
        }
 static public double GetBlsPutPrice(double S, double K, double T, double sigma, double r)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return -S * normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r));
 }
 static public double GetBlsRho(double S, double K, double T, double sigma, double r, char type)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return type=='c'?K * T * Math.Exp(-r * T) * normDist.DistributionFunction(D2(S, K, T, sigma, r)):-K*T*Math.Exp(-r* T)* normDist.DistributionFunction(-D2(S, K, T, sigma, r));
 }
Exemple #19
0
        private void button2_Click(object sender, EventArgs e)
        {
            SaveRegression saveRegression = new SaveRegression();

            if (!string.IsNullOrEmpty(richTextBox1.Text))
            {
                string        NumberOfVariable = "", NumberOfUqVariable = "", TypeOfScale = "", DistType = "", AGV = "", Slope = "", Mechanics = "", StandardDeviation = "";
                List <double> listtemp = new List <double>();
                int           temp     = 0;
                Accord.Statistics.Distributions.Univariate.NormalDistribution normDist =
                    Accord.Statistics.Distributions.Univariate.NormalDistribution.Standard;
                double[,] matr = new double[dataGridView1.RowCount, dataGridView1.ColumnCount];
                for (int j = 0; j < dataGridView1.ColumnCount; j++)
                {
                    for (int i = 0; i < dataGridView1.RowCount; i++)
                    {
                        matr[i, j] = Convert.ToDouble(dataGridView1.Rows[i].Cells[j].Value);
                        if (!listtemp.Contains(matr[i, j]))
                        {
                            temp++;
                        }
                        if (dataGridView1.Rows[i].Cells[j].Value != null)
                        {
                            listtemp.Add(matr[i, j]);
                        }
                    }

                    TypeOfScale        += AnalysisClass.getScale(temp) + "!";
                    NumberOfUqVariable += temp.ToString() + "!";
                    NumberOfVariable   += listtemp.Count().ToString() + "!";

                    if (AnalysisClass.getScale(temp) != "дихотомическая")
                    {
                        Accord.Statistics.Testing.KolmogorovSmirnovTest kstX =
                            new Accord.Statistics.Testing.KolmogorovSmirnovTest(listtemp.ToArray(), normDist);
                        DistType          += AnalysisClass.getDistributionScale(kstX.Significant) + "!";
                        AGV               += Math.Round(MathNet.Numerics.Statistics.Statistics.Mean(listtemp), 3).ToString() + "!";
                        StandardDeviation += Math.Round(MathNet.Numerics.Statistics.Statistics.PopulationStandardDeviation(listtemp), 3).ToString() + "!";
                        Mechanics         += Math.Round(MathNet.Numerics.Statistics.Statistics.PopulationSkewness(listtemp), 3).ToString() + "!";
                        Slope             += Math.Round(MathNet.Numerics.Statistics.Statistics.PopulationKurtosis(listtemp), 3).ToString() + "!";
                    }
                    else
                    {
                        DistType          += "Нет!";
                        AGV               += "Нет!";
                        StandardDeviation += "Нет!";
                        Mechanics         += "Нет!";
                        Slope             += "Нет!";
                    }
                    temp = 0;
                    listtemp.Clear();
                }

                DateRegression.TypeMethod         = richTextBox1.Text;
                DateRegression.NumberOfScale      = dataGridView1.ColumnCount;
                DateRegression.NumberOfVariable   = NumberOfVariable;
                DateRegression.NumberOfUqVariable = NumberOfUqVariable;
                DateRegression.TypeOfScale        = TypeOfScale;
                DateRegression.DistType           = DistType;
                DateRegression.StandardDeviation  = StandardDeviation;
                DateRegression.Mechanics          = Mechanics;
                DateRegression.AGV   = AGV;
                DateRegression.Slope = Slope;

                saveRegression.Show();
            }
            else
            {
                MessageBox.Show("Сначало нужно нажать кнопку 'Предложить метод исследования'");
            }
        }
Exemple #20
0
 static public double GetBlsPutPrice(double S, double K, double T, double sigma, double r)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return(-S *normDist.DistributionFunction(-D1(S, K, T, sigma, r)) + K * Math.Exp(-r * T) * normDist.DistributionFunction(-D2(S, K, T, sigma, r)));
 }
Exemple #21
0
 static public double GetBlsVega(double S, double K, double T, double sigma, double r)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return(S * Math.Sqrt(T) * normDist.ProbabilityDensityFunction(D1(S, K, T, sigma, r)));
 }
 static public double GetBlsTheta(double S, double K, double T, double sigma, double r, char type)
 {
     Accord.Statistics.Distributions.Univariate.NormalDistribution normDist = new Accord.Statistics.Distributions.Univariate.NormalDistribution();
     return -normDist.ProbabilityDensityFunction(D1(S, K, T, sigma, r))*S*sigma / (2 * Math.Sqrt(T))-r*K*Math.Exp(-r*T)*normDist.DistributionFunction(D2(S, K, T, sigma, r))*(type=='c'?1:-1);
 }