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 (biased) maximum likelihood estimate of the covariance matrix and mean vector.
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
arand.SecondMomentsType = AMOSRANDOMLib6.SECONDMOMENTS.ML
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