Flickr logo
More of Luca Mauri's photos
blank

Section's icon A snippet
Statistic .net
Codename: basicstats

I created this class to help me made the Tag Cloud system for this site. It is a simple class to calculate the arithmetic Mean and the Standard Deviation.
Separatore

Following the full code of the snippet
You can copy and paste it from here, otherwise you can download it in .snippet file format by clicking here.

                Public Class clsStatistics
        Dim mValueArray As Double()
        Dim mMeanValue As Double

        Public Property valueArray() As Double()
            Get
                Return mValueArray
            End Get
            Set(ByVal value As Double())
                mValueArray = value
            End Set
        End Property
        Public ReadOnly Property meanValue() As Double
            Get
                Return mMeanvalue
            End Get
        End Property
        Public Function Mean(ByVal values As Double()) As Double
            Dim sum As Double = 0
            Dim count As Integer = 0

            For Each d As Double In values
                sum += d
                count += 1
            Next

            mMeanValue = sum / count
            Return sum / count
		End Function
		Public Function StdDevFromStored() As Double
			Dim meanValue As Double
			Dim sumOfDiffSquares As Double = 0
			Dim count As Integer = 0
			Dim diff As Double

			If mValueArray Is Nothing Then
				Return 0
			Else
				meanValue = Mean(mValueArray)

				For Each d As Double In mValueArray
					diff = (d - meanValue)
					sumOfDiffSquares += diff ^ 2
					count += 1
				Next

				Return Math.Sqrt(sumOfDiffSquares / count)
			End If

		End Function
    End Class                
            

Go back to snippet page.

Gear B/N Risultato del processo OK
blank

Ajax-enabled news - Beta

Ajax News temporaneamente sospese in attesa della nuova versione.

Tag Cloud - Beta

AddThis Bookmark

Il pulsante di AddThis permette di aggiungere un segnalibro per questa pagina nei più diffusi siti internet.

Licenza

Creative Commons License
Il contenuto di questo sito internet, se non diversamente specificato, è pubblicato sotto una Licenza Creative Commons.

The content of this website is published under a Creative Commons License, unless otherwise stated.

Site Meter

ClustrMaps

Locations of visitors to this page

Elenco Feed

Questo file OPML contiene l'elenco aggiornato di tutti i feed RSS disponibili sul sito.

OPML rect

amung.us

hit counter

Random Quote

«And he piled upon the whale's white hump, the sum of all the rage and hate felt by his whole race. If his chest had been a cannon, he would have shot his heart upon it. »

Captain Jean-Luc Picard
"First Contact" - [Quoting 'Moby Dick']

Leggi tutte le citazioni

Random Fact

Contrariamente a quanto comunemente si pensa, un veicolo spaziale che rientra nell'atmosfera terrestre viene riscaldato dall'attrito solo per circa il 1% del totale.
La gran parte del calore viene dalla compressione adiabatica del gas che sta davanti al veicolo: si calcola che la temperatura all'interno dell'onda d'urto possa raggiungere i 10.000 K.
Secondo i calcoli degli ingegneri della NASA, lo scudo termico della futura capsula Orion, di ritorno da un viaggio nell'orbita lunare, raggiungerà una temperatura superiore ai 2.900 K.

NASA (2005)

Leggi tutte le curiosità

aNobii Books

Sorting Hat

i'm in ravenclaw!
be sorted @ nimbo.net

LM CubeCopyright © 2000 - 2010 Luca Mauri. All rights reserved
Note sui contenuti del sito.


Generated by Luca Mauri's xCMS xCMS | ASP.net 2.0 powered Powered by ASP.net 2.0

Technology Blogs - BlogCatalog Blog Directory


Standard compliant: Valid Sitemaps | W3C CSS Valid | W3C XHTML Valid | RSS 2.0 Valid | OPML checked by validator.opml.org. | AJAX Powered


This page is generated by Luca Mauri Luca Mauri's xCMS
eXperimental Content Management System version 1.5.0.11260
Current date and time on server Fri, 10 Sep 2010 14:54:55 GMT
Took 0,528376 seconds to be created