The following program performs an all-possible-subsets regression analysis with the model of Example 4.
Imports System.Diagnostics
Module MainModule
' ReviseModel Method Example
Sub Main()
Dim Sem As New AmosEngineLib.AmosEngine
Sem.BeginGroup(AmosEngine.AmosDir & "Examples\English\UserGuide.xls", "Warren5v")
Sem.AStructure("performance = (b1) knowledge + (b2) value + (b3) satisfaction + (1) error")
'Define a model with three constraints.
'Subsequently, no revised model can have more than three constraints.
Sem.Model("Model 1", "b1 = b2 = b3 = 0")
Subset(Sem, "b1 = b2 = b3 = 0", "no predictors")
Debug.WriteLine("-------------------------------")
Subset(Sem, "b1 = b2 = 0", "satisfaction")
Subset(Sem, "b2 = b3 = 0", "knowledge")
Subset(Sem, "b1 = b3 = 0", "value")
Debug.WriteLine("-------------------------------")
Subset(Sem, "b1 = 0", "value, satisfaction")
Subset(Sem, "b2 = 0", "knowledge, satisfaction")
Subset(Sem, "b3 = 0", "knowledge, value")
Debug.WriteLine("-------------------------------")
Subset(Sem, "", "knowledge, value, satisfaction")
Sem.Dispose()
End Sub
Sub Subset(ByVal Sem As AmosEngineLib.AmosEngine, ByVal Constraints As String, ByVal Predictors As String)
Sem.ReviseModel("Model 1", Constraints)
If Sem.FitModel = 0 Then
Debug.Write(Sem.Cmin)
Else
Debug.Write("Failed")
End If
Debug.WriteLine(" " & Predictors)
End Sub
End Module