Articles in this section
Category / Section

How to perform Utility functions using chart?

1 min read

 

Using UtilityFunctions class we can perform Gamma, factorial, Beta and other functions used in statistical distributions formulas.

We can perform the following utility analysis in chart,

  • Normal Distribution - The Normal Distribution method returns the Normal distribution for a given value.
  • T Cumulative Distribution - The T Cumulative Distribution method returns the T Cumulative distribution for a given value.
  • F Cumulative Distribution - The F Cumulative Distribution method returns the FCumulative distribution for a given value.

C#

//Perform T Cumulative Distribution : Initializes the T distribution series.

series = this.chartControl1.Model.NewSeries("T Distribution",ChartSeriesType.SplineArea);

series.Text = series.Name;

//Set the degree of freedom.

n = 2;

//Calculates the Beta function.

beta = UtilityFunctions.Beta(0.5, n / 2.0);

// Calculate coefficient of T Distribution.

coef = Math.Pow(n, -0.5) / beta;

// Calculate Data Points

for (int x = -120; x <= 120; x++)

{

doubleX = x / 10.0;

y = coef / Math.Pow(1.0 + doubleX * doubleX / n, (n + 1.0) / 2.0);

//Add data points to the series.

series.Points.Add(doubleX, y);

}

//Add the series to the chart series collection.

this.chartControl1.Series.Add(series);

VB

'Perform T Cumulative Distribution : Initializes the T distribution series.

series = Me.chartControl1.Model.NewSeries("T Distribution",ChartSeriesType.SplineArea)

series.Text = series.Name

'Set the degree of freedom.

n = 2

'Calculates the Beta function.

beta = UtilityFunctions.Beta(0.5, n / 2.0)

' Calculate coefficient of T Distribution.

coef = Math.Pow(n, -0.5) / beta

' Calculate Data Points

Do

doubleX = x / 10.0

y = coef / Math.Pow(1.0 + doubleX * doubleX / n, (n + 1.0) / 2.0)

'Add data points to the series.

series.Points.Add(doubleX, y)

Loop

'Add the series to the chart series collection.

Me.chartControl1.Series.Add(series)

This is illustrated in the Chart UG in this topic:

Utility Formulas

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied