Statsar Statistics Library

v1.0.1 for .NET

Product Guide



More Information...

Valid XHTML


Percentiles Ranks Example (VB.NET)

[VB.NET]
' COPYRIGHT(C), SIMPLEXAR SOFTWARE LIMITED, 2006-2008.
' All rights reserved.
'
' Use of this copyright notice is precautionary only, and does not imply
' publication or disclosure. The content of this work contains confidential
' and proprietary information of Simplexar Software Limited. Any duplication,
' modification, distribution, or disclosure in any form, in whole, or in part,
' is strictly prohibited without express prior written permission.

' Get namespaces.
Imports System
Imports Simplexar.Statsar

' Start namespace.
Namespace Simplexar.Examples.Statsar

    ' This example uses the statistics calculator to perform percentiles
    ' and rank statistics on a data sheet (e.g. interquartile range
    ' and percentiles).
    Module Example

        ' The application entry point.
        Public Sub Main()
            Try
                RunExample()
            Catch exception As Exception
                Console.WriteLine(exception)
            End Try
            Console.WriteLine("Press ENTER to terminate.")
            Console.ReadLine()
        End Sub

        Private Sub RunExample()

            ' Create a calculator.
            Dim calculator As New StatsCalculator()

            ' Use the calculator to load the sheet.
            Dim sheet As DataSheet = calculator.Load( _
                "..\..\..\..\..\Data\ExamResults.csv")
            Console.WriteLine(sheet)

            ' Calculate percentile and rank statistics
            ' for the english result column.
            Console.WriteLine("3rd quartile: {0}", _
                calculator.Quartile("EnglishResult", 3))

            Console.WriteLine("7th decile: {0}", _
                calculator.Decile("EnglishResult", 7))

            Console.WriteLine("45th percentile: {0}", _
                calculator.Percentile("EnglishResult", 0.45))

            Console.WriteLine("Interquartile range: {0}", _
                calculator.InterquartileRange("EnglishResult"))

            Console.WriteLine("Percent rank of 65: {0}", _
                calculator.PercentRank("EnglishResult", 65))

            Console.WriteLine("Rank of 60: {0}", _
                calculator.Rank("EnglishResult", 60))

            Console.Write("Ranks:")
            Dim ranks As Integer() = calculator.Ranks("EnglishResult")
            For Each rank As Integer In ranks
                Console.Write(" {0}", rank)
            Next
            Console.WriteLine()
            Console.WriteLine()

        End Sub

    End Module

End Namespace