Please enable JavaScript to view this site.

IBM® SPSS® Amos™ 28

Navigation: Programming with Amos > Additional Programming Examples > Examples using the Amos Graphics classes

Use the Amos Graphics classes to create user-defined properties

Scroll Prev Top Next More

When the path diagram of Example 4 (which includes a variable called Performance) is in the Amos Graphics window, the following plugin uses the PropertySave method to create two properties for Performance. The two properties are called Reliability and Variance. Reliability is assigned the value ".8230" and Variance is assigned the value ".0209". These numbers are in fact the reliability estimate and the sample variance for Performance reported by Warren, White and Fuller (1974). When the path diagram is subsequently saved, these two properties of Performance will be saved along with it.

Imports Amos
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
    Implements IPlugin
 
    Public Function Mainsub() As Integer Implements IPlugin.Mainsub
        Dim E As PDElement
        E = pd.PDE("Performance")
        E.PropertySave("Reliability", ".8230")
        E.PropertySave("Variance", ".0209")
    End Function
 
    Public Function Name() As String Implements IPlugin.Name
    End Function
 
    Public Function Description() As String Implements IPlugin.Description
    End Function
End Class

The following plugin uses the properties created by the previous plugin to compute an estimate of Performance's error variance. If Reliability or Variance is undefined, PropertyGet returns the non-numeric string, "x". Attempting to perform arithmetic with the non-numeric string generates the error message "Could not compute error variance."

Imports Microsoft.VisualBasic
Imports Amos
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
    Implements IPlugin
 
    Public Function Mainsub() As Integer Implements IPlugin.Mainsub
        Dim ErrorVariance As Double
        Try
            Dim E As PDElement = pd.PDE("Performance")
            ErrorVariance = (1 - E.PropertyGet("Reliability", "x")) _
                    * E.PropertyGet("Variance", "x")
            MsgBox("Error variance = " & ErrorVariance,, "Error variance")
        Catch ex As System.Exception
            MsgBox("Could not compute error variance.",, "Error variance")
        End Try
    End Function
 
    Public Function Name() As String Implements IPlugin.Name
    End Function
 
    Public Function Description() As String Implements IPlugin.Description
    End Function
End Class

© 2021 Amos Development Corporation