Please enable JavaScript to view this site.

IBM® SPSS® Amos™ 28

The following program, based on Example 8, displays the error variances and their standard errors. Then it displays the correlation between two of the error variances.

Imports System
Imports System.Diagnostics
Module MainModule
    ' ParameterCovariance Method Example
    Sub Main()
        Dim Sem As New AmosEngineLib.AmosEngine
        Sem.Standardized()
        Sem.Smc()
 
        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")
        'Give parameter names to the error variances.
        Sem.Var("err_v", "verr_v")
        Sem.Var("err_c", "verr_c")
        Sem.Var("err_l", "verr_l")
        Sem.Var("err_p", "verr_p")
        Sem.Var("err_s", "verr_s")
        Sem.Var("err_w", "verr_w")
 
        Debug.WriteLine("Error variances, and their standard deviations:")
        Debug.Write("verr_v: " & Sem.ParameterValue("verr_v"))
        Debug.WriteLine(Math.Sqrt(Sem.ParameterCovariance("verr_v")))
        Debug.Write("verr_c: " & Sem.ParameterValue("verr_c"))
        Debug.WriteLine(Math.Sqrt(Sem.ParameterCovariance("verr_c")))
        Debug.Write("verr_l: " & Sem.ParameterValue("verr_l"))
        Debug.WriteLine(Math.Sqrt(Sem.ParameterCovariance("verr_l")))
        Debug.Write("verr_p: " & Sem.ParameterValue("verr_p"))
        Debug.WriteLine(Math.Sqrt(Sem.ParameterCovariance("verr_p")))
        Debug.Write("verr_s: " & Sem.ParameterValue("verr_s"))
        Debug.WriteLine(Math.Sqrt(Sem.ParameterCovariance("verr_s")))
        Debug.Write("verr_w: " & Sem.ParameterValue("verr_w"))
        Debug.WriteLine(Math.Sqrt(Sem.ParameterCovariance("verr_w")))
        Debug.WriteLine("")
 
        Debug.Write("The correlation between ""verr_v"" and ""verr_c"" is ")
        Dim Numerator As Double, Denominator As Double
        Numerator = sem.ParameterCovariance("verr_v", "verr_c")
        Denominator = Math.Sqrt(Sem.ParameterCovariance("verr_v") * _
                    Sem.ParameterCovariance("verr_c"))
        Debug.WriteLine(Numerator / Denominator)
 
        Sem.Dispose()
    End Sub
End Module

© 2021 Amos Development Corporation