The following program specifies a multivariate normal population with covariance matrix and mean given by
.
Then it draws a sample of 500 and displays the sample covariance matrix and mean vector. The unbiased estimate of the covariance matrix is displayed because the default value of SecondMomentsType is UNBIASED.
Module MainModule
Sub Main()
Dim arand As New AMOSRANDOMLib6.AmosRanGen
Dim PopCovariances(2) As Double
Dim PopMeans(1) As Double
PopCovariances(0) = 3
PopCovariances(1) = 1
PopCovariances(2) = 2
PopMeans(0) = 4
PopMeans(1) = 5
Call arand.SpecifyPopulation(PopCovariances, PopMeans)
Dim SampleCovariances(2) As Double
Dim SampleMeans(1) As Double
Call arand.RandomMoments(SampleCovariances(0), SampleMeans(0), 2, 500)
Dim ad As New AmosDebug.AmosDebug
Call ad.PrintTriangle(SampleCovariances, "Sample Covariances")
Call ad.PrintX(SampleMeans, "Sample Means")
End Sub
End Module