Simulation & Probabilistic Analysis SDK
Add Distribution Fitting & Simulation Features to Your Applications

SPA SDK Help HomeLearn More About the SPA SDK

Descriptive Statistics

Sample Data Statistics

Once you specify your input data, you can use the SPADataSet.Statistics property to obtain the sample statistics for your data:

Sub Test()
  Dim data(5) As Double
  Dim empty() As Double
  Dim dataSet As New SPADataSet

  SPAApplication.Initialize

  ' specify the data
  data(0) = 1.5
  data(1) = 3.2
  data(2) = 9.6
  data(3) = 4.1
  data(4) = 7.8

  ' assign the data
  dataSet.Assign(SPADomainContinuous, SPADataSample, data, empty) 

  ' display the sample mean 
  MsgBox dataSet.Statistics.Value(SPAStatMean)

  ' display the sample median 
  MsgBox dataSet.Statistics.Percentile(50)
End Sub
  

Distribution Statistics

You can obtain the distribution statistics for most distributions through the SPADistribution.Statistics property:

Sub Test()
  Dim dist As New SPADistribution

  SPAApplication.Initialize  

  ' specify the distribution type and parameters
  dist.Type = SPADistWeibull  ' Weibull distribution 
  dist.Param(0) = 1.5         ' alpha
  dist.Param(1) = 2           ' beta

  ' check whether the distribution mean is defined for this set of distribution parameters
  If dist.Statistics.Defined(SPAStatMean) Then
    MsgBox dist.Statistics.Value(SPAStatMean)
  Else
    MsgBox "The mean is not defined"
  End If

  ' display the 0.5 quantile
  MsgBox dist.Statistics.Percentile(50)
End Sub
  
Copyright © MathWave Technologies
www.mathwave.com