This example demonstrates the GetBootSampleEstimates method.
Imports System.Diagnostics
Imports AmosEngineLib.AmosEngine.TMatrixID
Imports Microsoft.VisualBasic
Module MainModule
' GetBootSampleEstimates Method Example
Sub Main()
Const NBootSamples As Integer = 3
Dim i As Integer
Dim X(,) As Double
Dim RNames() As String
Dim CNames() As String
Dim Sem As New AmosEngineLib.AmosEngine
Sem.NeedBootSampleEstimates(FactorScoreWeights)
Sem.Bootstrap(NBootSamples)
Sem.TextOutput()
Sem.BeginGroup(AmosEngine.AmosDir & "Examples\English\UserGuide.xls", "Grnt_fem")
Sem.AStructure("visperc = (1) spatial + (1) err_v")
Sem.AStructure("cubes = spatial + (1) err_c")
Sem.AStructure("lozenges = spatial + (1) err_l")
Sem.AStructure("paragraph = (1) verbal + (1) err_p")
Sem.AStructure("sentence = verbal + (1) err_s")
Sem.AStructure("wordmean = verbal + (1) err_w")
Sem.RowNames(FactorScoreWeights, RNames)
Sem.ColumnNames(FactorScoreWeights, CNames)
For i = 1 To NBootSamples
Sem.GetBootSampleEstimates(FactorScoreWeights, X, i)
Debug.WriteLine("")
Debug.WriteLine("Factor score weights from bootstrap sample #" & i)
Debug.WriteLine("")
PrintMatrix(X, CNames, RNames)
Next
Sem.Dispose()
End Sub
'Print a matrix in the debug window
Sub PrintMatrix(ByVal TheMatrix(,) As Double, ByVal CNames$(), ByVal RNames$())
Dim NRows1 As Integer, NColumns1 As Integer
Dim i As Integer, j As Integer
NRows1 = UBound(RNames)
NColumns1 = UBound(CNames)
Debug.Write(" ")
For j = 0 To NColumns1
Debug.Write(CNames(j).PadLeft(10))
Next
Debug.WriteLine("")
For i = 0 To NRows1
Debug.Write(RNames(i).PadRight(8))
For j = 0 To NColumns1
Debug.Write(TheMatrix(i, j).ToString(".00000").PadLeft(10))
Next
Debug.WriteLine("")
Next
End Sub
End Module