38
Example 1
To open the VB.NET file for the present example:
E From the Program Editor menus, choose File > Open.
E Select the file Ex01.vb in the \Amos\21\Examples\<language> directory.
The following table gives a line-by-line explanation of the program.
E To perform the analysis, from the menus, choose File > Run.
Program Statement Explanation
Dim Sem As New AmosEngine
Declares Sem as an object of type
AmosEngine. The methods and properties of
the Sem object are used to specify and fit the
model.
Sem.TextOutput
Creates an output file containing the results of
the analysis. At the end of the analysis, the
contents of the output file are displayed in a
separate window.
Sem.BeginGroup …
Begins the model specification for a single
group (that is, a single population). This line
also specifies that the Attg_yng worksheet in the
Excel workbook UserGuide.xls contains the
input data.
Sem.AmosDir() is the location of the
Amos program directory.
Sem.AStructure("recall1")
Sem.AStructure("recall2")
Sem.AStructure("place1")
Sem.AStructure("place2")
Specifies the model. The four AStructure
statements declare the variances of recall1,
recall2, place1, and place2 to be free
parameters. The other eight variables in the
Attg_yng data file are left out of this analysis. In
an Amos program (but not in Amos Graphics),
observed exogenous variables are assumed by
default to be correlated, so that Amos will
estimate the six covariances among the four
variables.
Sem.FitModel()
Fits the model.
Sem.Dispose()
Releases resources used by the Sem object. It is
particularly important for your program to use
an AmosEngine object’s
Dispose method before
creating another AmosEngine object. A process
is allowed only one instance of an AmosEngine
object at a time.
Try/Finally/End Try
The Try block guarantees that the Dispose
method will be called even if an error occurs
during program execution.