# Linear Growth Curve Model: SPSS MIXED and AMOS

3 messages
Open this post in threaded view
|

## Linear Growth Curve Model: SPSS MIXED and AMOS

 Hi all, I recently posted a message demonstrating how to fit a linear growth curve model via a linear mixed model (SPSS MIXED procedure). In this post, I demonstrate how to fit the same model using AMOS. If you run the SPSS code below (which includes the SPSS data generation and MIXED code using ML estimation and an UNstructured random effects covariance matrix), and then the AMOS visual basic code, you'll observe the same number of parameters are being estimated, along with virtually identical parameter estimates and standard errors.  NOTE: This linear growth curve model assumes that the time-specific error variances are identical. One could easily allow the error variances to vary across all time points using the MIXED procedure as well as AMOS. One could also incorporate a 2nd-level predictor in MIXED and AMOS.  Hope this is of interest to others. Ryan-- /*Generate Data*/./*seed for random  generator*/.set seed 987879546.new file.input program. compute subject_ID = -99. compute Gamma00 = -99.compute Gamma10 = -99.compute V11 = -.99.compute V22 = -99.compute rho = -99.compute V21 = -99.compute a11 = -99.compute a21 = -99.compute a22 = -99.compute x0j = -99. compute x1j = -99.compute u0j = -99.compute u1j = -99.compute B0J = -99.compute B1J = -99.compute eij = -99.compute time = -99.leave subject_ID to time.    /*10000 subjects*/.    loop subject_ID = 1 to 10000.     /*fixed intercept*/.    compute Gamma00 = 0.50.    /*fixed slope*/.    compute Gamma10 = 0.30.    /*random intercept var*/.    compute V11 = 0.80.    /*random slope var*/.    compute V22 = 0.50.     /*random intercept and slope corr*/.    compute rho = 0.35.    /*random intercept and slope cov*/.    compute V21 = rho*sqrt(V11*V22).    compute a11 = sqrt(V11).    compute a21 = V21/a11.     compute a22 = sqrt(V22 - a21*a21).    /*norm. dist r.v.*/.    compute x0j = rv.normal(0,1).    /*norm. dist r.v.*/.    compute x1j = rv.normal(0,1).    /*random intercept error term*/.    compute u0j = a11*x0j.     /*random slope error term*/.    compute u1j = a21*x0j + a22*x1j.    /*random intercept term*/.    compute B0J = Gamma00 + u0j.    /*random slope term*/.    compute B1J = Gamma10 + u1j.    /*5 time points*/.     loop time = 0 to 4.    /*error term*/.    compute eij = rv.normal(0,1).    /*full equation*/.    compute y = B0J + B1J*time + eij.    end case.   end loop.  end loop. end file.end input program. execute. MIXED y WITH time  /FIXED=time | SSTYPE(3)  /METHOD=ML  /PRINT=SOLUTION G  /RANDOM=INTERCEPT time | SUBJECT(subject_ID) COVTYPE(UN). delete variables Gamma00 Gamma10 V11 V22 rho V21 a11 a21 a22 x0j x1j u0j u1j B0J B1J eij.   SORT CASES BY subject_ID time.CASESTOVARS  /ID=subject_ID  /INDEX=time  /GROUPBY=VARIABLE. rename variables (y..00 y.1.00 y.2.00 y.3.00 y.4.00 = time0 time1 time2 time3 time4).  **********AMOS VB CODE NEXT**********.  #Region "Header"Imports SystemImports System.DiagnosticsImports Microsoft.VisualBasicImports AmosEngineLibImports AmosGraphicsImports AmosEngineLib.AmosEngine.TMatrixIDImports PBayes #End RegionModule MainModule Public Sub Main()  Dim Sem As AmosEngine  Sem = New AmosEngine  Sem.TextOutput  AnalysisProperties(Sem)  ModelSpecification(Sem)  Sem.FitAllModels()  Sem.Dispose()  End Sub  Sub ModelSpecification(Sem As AmosEngine)  Sem.ModelMeansAndIntercepts  Sem.GenerateDefaultCovariances(False)   Sem.BeginGroup("C:\\lineargrowthcurvemodel.sav" , "lineargrowthcurvemodel" )    Sem.GroupName("Group number 1")   Sem.AStructure("time0 = (0) + (1) INTERCEPT + (0) SLOPE + (1) E1")   Sem.AStructure("time1 = (0) + (1) INTERCEPT + (1) SLOPE + (1) E2")   Sem.AStructure("time2 = (0) + (1) INTERCEPT + (2) SLOPE + (1) E3")    Sem.AStructure("time3 = (0) + (1) INTERCEPT + (3) SLOPE + (1) E4")   Sem.AStructure("time4 = (0) + (1) INTERCEPT + (4) SLOPE + (1) E5")    Sem.AStructure("INTERCEPT <--> SLOPE")     Sem.AStructure("E1 (Var)")   Sem.AStructure("E2 (Var)")   Sem.AStructure("E3 (Var)")   Sem.AStructure("E4 (Var)")   Sem.AStructure("E5 (Var)")      Sem.Mstructure("INTERCEPT")   Sem.Mstructure("SLOPE")  Sem.Model("Default model", "") End Sub  Sub AnalysisProperties(Sem As AmosEngine)  Sem.Iterations(50)   Sem.InputUnbiasedMoments  Sem.FitMLMoments  Sem.Seed(1) End SubEnd Module