Please enable JavaScript to view this site.

IBM® SPSS® Amos™ 28

This example demonstrates the NeedPCLowerBounds and NeedPCUpperBounds methods.

Imports System.Diagnostics
Imports AmosEngineLib.AmosEngine.TMatrixID
Imports Microsoft.VisualBasic
Module MainModule
    ' NeedPCLowerBounds, NeedPCUpperBounds Methods Example
    Sub Main()
        Dim Sem As New AmosEngineLib.AmosEngine
        Sem.Bootstrap(2000)
        Sem.ConfidencePC(90) '90% confidence intervals
 
        Sem.NeedPCLowerBounds(FactorScoreWeights)
        Sem.NeedPCUpperBounds(FactorScoreWeights)
 
        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")
 
        Dim X(,) As Double
        Dim RNames() As String
        Dim CNames() As String
 
        'Get the row and column variable names
        Sem.RowNames(FactorScoreWeights, RNames)
        Sem.ColumnNames(FactorScoreWeights, CNames)
 
        'Print the lower bounds
        Sem.GetPCLowerBounds(FactorScoreWeights, X)
        Debug.WriteLine(vbCrLf & "Confidence intervals on factor score weights -- lower bound")
        PrintMatrix(X, CNames, RNames)
 
        'Print the upper bounds
        Sem.GetPCUpperBounds(FactorScoreWeights, X)
        Debug.WriteLine(vbCrLf & "Confidence intervals on factor score weights -- upper bound")
        PrintMatrix(X, CNames, RNames)
 
        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

© 2021 Amos Development Corporation