2016-06-12 7 views
0

Math.Net Numerics과 몇 가지 평행 통계 테스트를 수행하는 동안 Exception error (놀랍게도)이 발생했습니다. 그 이유를 알고 싶습니다.MATH.NET Numerics Stable Distributions. 'System.NotSupportedException'유형의 예외

using MathNet.Numerics.Distributions; 
.... 
var stable = new Stable(1.7, -0.7, 0.0087, 0.9103); 
     double b = stable.Density(3.2); 
     double a = stable.Density(5.1); 
     Console.WriteLine(b); 
     Console.WriteLine(a); 

오류 : 유형 System.NotSupportedException의 처리되지 않은 예외가 나는 b = 2.2484e-06, a = 4.3977e-07를 얻기 위해 기다리고 있었다 MathNet.Numerics.dll

에서 발생했습니다.

시는 : 다른 고전적인 분포 등 (예를 들어 Probability Distributions) 문제없이 Gamma 작업으로 은 배제 사실상 패키지

보다도,

EDIT 어떤 설치 문제 :에서 Github repository 나는 모든 속성과 메소드를 포함하는 내 프로젝트에 Stable.cs을 추가했습니다.

사실, 속성은 정상적으로 작동합니다. Program.cs에서 아래 그림을 참조하십시오 :

Stable st = new Stable(1.7, -0.7, 0.0087, 0.9103); // correct instantiation 

    Console.WriteLine(string.Format(" Characteristic exponent: {0}\n 
    Skewness: {1}\n Scale: {2}\n Location: {3}" ,st.Alpha, st.Beta, 
    st.Scale,st.Location)); 

을 그러나 비논리적 아무것도 없다, 지금까지의 내가 우려하고 같이 object에 따라 Density 방법 호출에 : 반환하도록되어 st.Density(3.2) :

PDF(_alpha, _beta, _scale, _location, x); 

따라서 사람들이 올바른 견해와 함께이 의견을 반대하지 않는 한 method definition 문제를 결론 짓고 싶습니다.

는 또한 stable parameters의 특수 값 (예 _alpha = 2.0 등)에 정의 PDF0 (이상)

답변

0

반환되는 해답은 Math.NET GitHub repository에 앉는다.

예는 Density 수식 조건을 충족하지 못합니다.

public double Density(double x) 
{ 
    return PDF(_alpha, _beta, _scale, _location, x); 
} 

/// <summary> 
/// Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x. 
/// </summary> 
/// <param name="alpha">The stability (α) of the distribution. Range: 2 ≥ α > 0.</param> 
/// <param name="beta">The skewness (β) of the distribution. Range: 1 ≥ β ≥ -1.</param> 
/// <param name="scale">The scale (c) of the distribution. Range: c > 0.</param> 
/// <param name="location">The location (μ) of the distribution.</param> 
/// <param name="x">The location at which to compute the density.</param> 
/// <returns>the density at <paramref name="x"/>.</returns> 
/// <seealso cref="Density"/> 
public static double PDF(double alpha, double beta, double scale, double location, double x) 
{ 
    if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0) 
    { 
     throw new ArgumentException(Resources.InvalidDistributionParameters); 
    } 

    if (alpha == 2d) 
    { 
     return Normal.PDF(location, Constants.Sqrt2*scale, x); 
    } 

    if (alpha == 1d && beta == 0d) 
    { 
     return Cauchy.PDF(location, scale, x); 
    } 

    if (alpha == 0.5d && beta == 1d && x >= location) 
    { 
     return (Math.Sqrt(scale/Constants.Pi2)*Math.Exp(-scale/(2*(x - location))))/Math.Pow(x - location, 1.5); 
    } 

    throw new NotSupportedException(); 
} 
+0

편집 된 스레드'@ rexilion'을 참조하십시오. –