Intro to MxGeneral CommentsJob StructureGroup StructureRead Observed DataMatrix DeclarationMatrix Types (Mx manual p.56)MatricesMatrices IIMatrices IIIConstrained Matrices *Matrix Algebra / ModelUnary Matrix OperationsBinary Matrix OperationsMatrix Operations (Mx p.59)Matrix Functions (Mx p. 64)Matrix Functions IISpecify Numbers/ ParametersOptionsSlide 20Fitting SubmodelsMxIntro to MxHGEN619 class 2006General Commentscase insensitive, except for filenames under Unixcomments: anything following a !blank linescommands: identified by first 2 letters, BUT recommended to use full wordsJob Structurethree types of groups:Data, Calculation, Constraintnumber of groups indicated by#NGroups 3at the beginning of jobjobs can be stacked in one runGroup StructureTitleGroup type: data, calculation, constraint[Read observed data, Select, Labels]Matrices declaration[Specify numbers, parameters, etc.]Algebra section and/or Model statement[Options]EndRead Observed DataData NInputvars=2 [NObservations=123]CMatrix/ Means/ CTable/ summary statisticsread from script / file (File=filename)Rectangular/ Ordinal / VLengthraw dataread from script / file (File=filename)Select variables ; [by number/label]Labels variablesMatrix DeclarationGroup 1Begin Matrices;C Full 2 3 Free ! [name type rows columns free]! more matrices ! default element is fixed at 0End Matrices;Group 2Begin Matrices = Group 1; ! copies all matrices from group 1D Full 2 3 = C1 ! equates D to C of group 1Matrix Types (Mx manual p.56)Type Structure Shape FreeZero Null (zeros) Any 0Unit Unit (ones) Any 0Iden Identity Square 0Diag Diagonal Square rSDiag Subdiagonal Square r(r-1)/2Stand Standardized Square r(r-1)/2Symm Symmetric Square r(r+1)/2Lower Lower triangular Square r(r+1)/2Full Full Any r x cComputed Equated to Any 0MatricesExample CommandSpecification MatrixValuesA Zero 2 3 Free0 0 00 0 00 0 00 0 0B Unit 2 3 Free0 0 00 0 01 1 11 1 1C Iden 3 3 Free0 0 00 0 00 0 01 0 00 1 00 0 1D Izero 2 5 Free0 0 0 0 00 0 0 0 01 0 0 0 00 1 0 0 0E Ziden 2 5 Free0 0 0 0 00 0 0 0 00 0 0 1 00 0 0 0 1Matrices IIExample CommandSpecification MatrixValuesF Diag 3 3 Free1 0 00 2 00 0 3? 0 00 ? 00 0 ?G SDiag 3 3 Free0 0 01 0 02 3 00 0 0? 0 0? ? 0H Stand 3 3 Free0 1 21 0 32 3 01 ? ?? 1 ?? ? 1Matrices IIIExample CommandSpecification MatrixValuesI Symm 3 3 Free1 2 42 3 54 5 6? ? ?? ? ?? ? ?J Lower 3 3 Free1 0 02 3 04 5 6? 0 0? ? 0? ? ?K Full 2 4 Free1 2 3 45 6 7 8? ? ? ?? ? ? ?Constrained Matrices *Syntax Matrix Quantity Dimensions%On Observed covariance matrix NI x NI%En Expected covariance matrix NI x NI%Mn Expected mean vector 1 x NI%Pn Expected proportions NR x NC%Fn Function value 1 x 1* to special quantities in previous groupsMatrix Algebra / ModelBegin Algebra;B = A*A';C = B+B;...End Algebra;Means [continuous] / Thresholds [categorical] X;Covariances X;Weight / Frequency X;X: matrix or matrix formulaUnary Matrix OperationsSymbol Name Function Example Priority~ Inverse Inversion A~ 1` Transpose Transposition A` 1Binary Matrix OperationsSymbol Name Function Example Priority^ Power Element powering A^B 2* Star Multiplication A*B 3. Dot Dot multiplication A.B 3@ Kronecker Kronecker product A@B 3& Quadratic Quadratic product A&B 3% Eldiv Element division A%B 3+ Plus Addition A+B 4- Minus Subtraction A-B 4| Bar Horizontal adhesion A|B 4_ Underscore Vertical adhesion A_B 4Matrix Operations (Mx p.59)Symbol Name Function Example Priority~ Inverse Inversion A~ 1` Transpose Transposition A` 1^ Power Element powering A^B 2* Star Multiplication A*B 3. Dot Dot multiplication A.B 3@ Kronecker Kronecker product A@B 3& Quadratic Quadratic product A&B 3% Eldiv Element division A%B 3+ Plus Addition A+B 4- Minus Subtraction A-B 4| Bar Horizontal adhesion A|B 4_ Underscore Vertical adhesion A_B 4Matrix Functions (Mx p. 64)Keyword Function Restrictions Dimensions\tr() Trace r=c 1 x 1\det() Determinant r=c 1 x 1\sum() Sum None 1 x 1\prod() Product None 1 x 1\max() Maximum None 1 x 1\min() Minimum None 1 x 1\abs() Absolute value None r x c\exp() Exponent None r x c\ln() Natural logaritm None r x c\sqrt() Square root None r x cMatrix Functions IIKeyword Function Restrictions Dimensions\stand() Standardize r=c r x c\mean() Mean of columns None 1 x c\cov() Covariance of cols None c x c\pdfnor() Mv normal density r=c+2 1 x 1\mnor() Mv normal integral r=c+3 1 x 1\pchi() Probability of Chi^2 r=1 c=2 1 x 2\d2v() Diagonal to vector None Min(r,c) x 1\m2v() Matrix to vector None rc x 1\part() Extract part of vectorNone variableSpecify Numbers/ ParametersNumbersMatrix <name> <number list>Start/Value <name> <value> <element list>ParametersFix/Free <value> <element list>Equate <name GRC> <name GRC>Specify <name> <integer list>Bound low high <parameter list/element list>Label MatricesLabel Row/Column <name> <label list>OptionsStatistical OutputSuppressing output: No_OutputAppearance: NDecimals=nResiduals: RSidualsAdjusting Degrees of Freedom: DFreedom=nPower CalculationsPower = alpha,dfConfidence IntervalsInterval {@value} <matrix element list>OptionsOptimization optionsBootstrap EstimatesRandomizing Starting Values: THard=nAutomatic Cold Restart: THard=-nJiggling Parameter Starting Values: JiggleConfidence Intervals on Fit StatisticsComparative Fit Indices: NullLikelihood-Ratio Statistics of Submodels: Issat/ SatCheck Identification of Model: CheckFitting SubmodelsMultiple FitOption Multiple: Matrix/ Value/ Start/ Equate/ Fix/ Free/ OptionsDrop {@value} <parlist> <element list>Binary Save/Get <filename>Writing Matrices to FilesMXn = <filename>Writing Individual Likelihood Stats to Files: MX%P = <filename>MxGraphical
View Full Document