Please enable JavaScript to view this site.

IBM® SPSS® Amos™ 28

The following program displays 5 observations from a multivariate normal population with covariance matrix and mean given by

7157.

The program also displays the squared Mahalanobis distance of each observation from the mean.

Imports System.Diagnostics
Module MainModule
    Sub Main()
        Dim arand As New AMOSRANDOMLib6.AmosRanGen
        Dim Cov(2) As Double
        Dim Mean(1) As Double
        Cov(0) = 3
        Cov(1) = 1
        Cov(2) = 2
        Mean(0) = 4
        Mean(1) = 5
        Dim Rank As Integer
        Dim sqrdet As Double
        Call arand.InstantSqrt(2, Cov(0), Rank, sqrdet)
 
        Dim D2 As Double
        Dim rx(1) As Double
        Dim i As Long
 
        For i = 1 To 5
            Call arand.InstantRandomVectorEx(2, rx(0), Mean(0), Cov(0), D2)
            Debug.WriteLine(rx(0) & rx(1) & "D2 = " & D2)
        Next
    End Sub
End Module

© 2021 Amos Development Corporation