* Define locations of files used in examples -- CHANGE THIS.
FILE HANDLE example /NAME = "F:\Example Data\Penn State Data\SibOSibY".

* SPSS code to import data.
GET SAS DATA = "example/ICPSR_Example8.sas7bdat".
DATASET NAME example8 WINDOW=FRONT.

* Have to save gender as other variables to keep in stacked file.
COMPUTE oboy2 = oboy.
COMPUTE yboy2 = yboy.
* SPSS code to double-stack into multivariate.
VARSTOCASES
/MAKE risky "risky: Risky Behavior for All Siblings" FROM orisky yrisky
  /MAKE age "age: Time-Varying Age for All Siblings" FROM oage TO yage
  /MAKE boy "boy: Gender (0=Girl, 1=Boy) for All Siblings" FROM oboy2 yboy2
/INDEX =DV "DV: Categorical Sibling Indicator"
/NULL = KEEP
/KEEP = ALL.



Variables to Cases


Notes
Output Created 03-JUL-2013 07:21:30
Comments  
Input Active Dataset example8
Filter <none>
Weight <none>
Split File <none>
Syntax VARSTOCASES
/MAKE risky "risky: Risky Behavior for All Siblings" FROM orisky yrisky
/MAKE age "age: Time-Varying Age for All Siblings" FROM oage TO yage
/MAKE boy "boy: Gender (0=Girl, 1=Boy) for All Siblings" FROM oboy2 yboy2
/INDEX =DV "DV: Categorical Sibling Indicator"
/NULL = KEEP
/KEEP = ALL.
Resources Processor Time 00:00:00.00
Elapsed Time 00:00:00.02


[example8] 


Generated Variables
Name Label
DV DV: Categorical Sibling Indicator
risky risky: Risky Behavior for All Siblings
age age: Time-Varying Age for All Siblings
boy boy: Gender (0=Girl, 1=Boy) for All Siblings

Processing Statistics
Variables In 23
Variables Out 21

 EXECUTE.
* Make other predictors.
DO IF (DV=1).
 COMPUTE endtime=age-17.
 COMPUTE dvO=1.
 COMPUTE dvY=0.
END IF.
DO IF (DV=2).
 COMPUTE endtime=age-15.
 COMPUTE dvO=0.
 COMPUTE dvY=1.
END IF.
VARIABLE LABELS
  dvO    "dvO: Dummy Indicator for Older Sibling (ages 12-17)"
dvY    "dvY: Dummy Indicator for Younger Sibling (ages 13-15)"
age    "age: Time-Varying Age for All Siblings"
endtime "endtime: Age centered at 17=O, 15=Y)".
EXECUTE.
* Sort double-stacked data.
SORT CASES BY family wave DV.


******************************************************************************
******                   EXAMPLE 8 MODELS                    ******
******************************************************************************.
DATASET ACTIVATE example8 WINDOW=FRONT.

TITLE "SPSS Unconditional Multivariate Longitudinal Model for Risky Behavior".

>Warning # 2003.  Command name: TITLE
>The title given exceeds 60 characters in length.  The first 60 characters will
>be used.


SPSS Unconditional Multivariate Longitudinal Model for Risky


SUBTITLE "Using direct effects of linear and quadratic age per sibling".


SPSS Unconditional Multivariate Longitudinal Model for Risky
Using direct effects of linear and quadratic age per sibling


MIXED risky BY family wave DV WITH dvO dvY endtime
   /METHOD = ML
   /PRINT  = SOLUTION TESTCOV G R
   /FIXED  = dvO dvO*endtime dvO*endtime*endtime dvY dvY*endtime dvY*endtime*endtime | NOINT
   /RANDOM = dvO dvY dvO*endtime dvY*endtime | SUBJECT(family) COVTYPE(UN)
   /REPEATED = DV | SUBJECT(wave*family) COVTYPE(UN)
   /TEST = "Intercept Difference at Age 17/15?" dvO -1 dvY 1
   /TEST = "Linear Slope Difference at Age 17/15?" dvO*endtime -1 dvY*endtime 1
   /TEST = "Quadratic Slope Difference?" dvO*endtime*endtime -1 dvY*endtime*endtime 1.



Mixed Model Analysis


Notes
Output Created 03-JUL-2013 07:21:30
Comments  
Input Active Dataset example8
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 2400
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics are based on all cases with valid data for all variables in the model.
Syntax MIXED risky BY family wave DV WITH dvO dvY endtime
/METHOD = ML
/PRINT = SOLUTION TESTCOV G R
/FIXED = dvO dvO*endtime dvO*endtime*endtime dvY dvY*endtime dvY*endtime*endtime | NOINT
/RANDOM = dvO dvY dvO*endtime dvY*endtime | SUBJECT(family) COVTYPE(UN)
/REPEATED = DV | SUBJECT(wave*family) COVTYPE(UN)
/TEST = "Intercept Difference at Age 17/15?" dvO -1 dvY 1
/TEST = "Linear Slope Difference at Age 17/15?" dvO*endtime -1 dvY*endtime 1
/TEST = "Quadratic Slope Difference?" dvO*endtime*endtime -1 dvY*endtime*endtime 1.
Resources Processor Time 00:00:00.64
Elapsed Time 00:00:00.80


[example8] 


Warnings
Iteration was terminated but convergence has not been achieved. The MIXED procedure continues despite this warning. Subsequent results produced are based on the last iteration. Validity of the model fit is uncertain.

Model Dimensiona
  Number of Levels Covariance Structure Number of Parameters Subject Variables Number of Subjects
Fixed Effects dvO 1   1    
dvO * endtime 1   1    
dvO * endtime * endtime 1   1    
dvY 1   1    
dvY * endtime 1   1    
dvY * endtime * endtime 1   1    
Random Effects dvO + dvY + dvO * endtime + dvY * endtimeb 4 Unstructured 10 FAMILY  
Repeated Effects DV 2 Unstructured 3 wave * FAMILY 1103
Total 12   19    
a. Dependent Variable: risky: Risky Behavior for All Siblings.
b. As of version 11.5, the syntax rules for the RANDOM subcommand have changed. Your command syntax may yield results that differ from those produced by prior versions. If you are using version 11 syntax, please consult the current syntax reference guide for more information.

Information Criteriaa
-2 Log Likelihood 9811.885
Akaike's Information Criterion (AIC) 9849.885
Hurvich and Tsai's Criterion (AICC) 9850.358
Bozdogan's Criterion (CAIC) 9971.380
Schwarz's Bayesian Criterion (BIC) 9952.380
The information criteria are displayed in smaller-is-better forms.
a. Dependent Variable: risky: Risky Behavior for All Siblings.


Fixed Effects


Type III Tests of Fixed Effectsa
Source Numerator df Denominator df F Sig.
dvO 1 191.038 2233.299 .000
dvO * endtime 1 718.091 96.158 .000
dvO * endtime * endtime 1 910.654 7.155 .008
dvY 1 171.992 2046.474 .000
dvY * endtime 1 268.617 21.733 .000
dvY * endtime * endtime 1 117.369 .237 .627
a. Dependent Variable: risky: Risky Behavior for All Siblings.

Estimates of Fixed Effectsa
Parameter Estimate Std. Error df t Sig. 95% Confidence Interval
Lower Bound Upper Bound
dvO 28.852496 .610534 191.038 47.258 .000 27.648242 30.056749
dvO * endtime 1.949200 .198776 718.091 9.806 .000 1.558949 2.339452
dvO * endtime * endtime .088205 .032975 910.654 2.675 .008 .023489 .152921
dvY 26.389733 .583354 171.992 45.238 .000 25.238279 27.541188
dvY * endtime 1.493718 .320410 268.617 4.662 .000 .862884 2.124552
dvY * endtime * endtime .039834 .081837 117.369 .487 .627 -.122234 .201902
a. Dependent Variable: risky: Risky Behavior for All Siblings.


Covariance Parameters


Estimates of Covariance Parametersa
Parameter Estimate Std. Error Wald Z Sig. 95% Confidence Interval
Lower Bound Upper Bound
Repeated Measures UN (1,1) 13.926432 .757645 18.381 .000 12.517904 15.493450
UN (2,1) -.645193 .731121 -.882 .378 -2.078163 .787777
UN (2,2) 13.389838 1.148127 11.662 .000 11.318479 15.840269
dvO + dvY + dvO * endtime + dvY * endtime [subject = FAMILY] UN (1,1) 64.792662 7.456490 8.689 .000 51.709170 81.186547
UN (2,1) 24.452345 5.292520 4.620 .000 14.079196 34.825494
UN (2,2) 49.299819 6.585219 7.486 .000 37.944265 64.053742
UN (3,1) 10.347793 1.318430 7.849 .000 7.763717 12.931869
UN (3,2) 3.793189 .956401 3.966 .000 1.918678 5.667700
UN (3,3) 1.788390 .255337 7.004 .000 1.351862 2.365879
UN (4,1) 4.739298 1.776498 2.668 .008 1.257426 8.221169
UN (4,2) 10.547685 2.048718 5.148 .000 6.532271 14.563099
UN (4,3) .776985 .316861 2.452 .014 .155950 1.398020
UN (4,4) 2.276036 .725425 3.138 .002 1.218657 4.250858
a. Dependent Variable: risky: Risky Behavior for All Siblings.

Random Effect Covariance Structure (G)a
  dvO | FAMILY dvY | FAMILY dvO * endtime | FAMILY dvY * endtime | FAMILY
dvO | FAMILY 64.792662 24.452345 10.347793 4.739298
dvY | FAMILY 24.452345 49.299819 3.793189 10.547685
dvO * endtime | FAMILY 10.347793 3.793189 1.788390 .776985
dvY * endtime | FAMILY 4.739298 10.547685 .776985 2.276036
Unstructured
a. Dependent Variable: risky: Risky Behavior for All Siblings.

Residual Covariance (R) Matrixa
  [DV = 1] [DV = 2]
[DV = 1] 13.926432 -.645193
[DV = 2] -.645193 13.389838
Unstructured
a. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 1 (Intercept Difference at Age 17/15?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 -2.462762 .681500 174.104 0 -3.614 .000 -3.807827 -1.117697
a. Intercept Difference at Age 17/15?
b. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 2 (Linear Slope Difference at Age 17/15?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 -.455482 .366106 361.868 0 -1.244 .214 -1.175444 .264480
a. Linear Slope Difference at Age 17/15?
b. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 3 (Quadratic Slope Difference?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 -.048371 .088117 155.067 0 -.549 .584 -.222437 .125694
a. Quadratic Slope Difference?
b. Dependent Variable: risky: Risky Behavior for All Siblings.

TITLE.



SUBTITLE.




TITLE "SPSS Adding Effects of Gender: Self and O-->Y".


SPSS Adding Effects of Gender: Self and O-->Y


MIXED risky BY family wave DV WITH dvO dvY endtime Oboy Yboy
   /METHOD = ML
   /PRINT  = SOLUTION TESTCOV G R
   /FIXED  = dvO dvY dvO*endtime dvY*endtime dvO*endtime*endtime
           dvO*Oboy dvY*Yboy dvO*Oboy*endtime dvY*Yboy*endtime dvO*Oboy*endtime*endtime
           dvY*Oboy dvY*Oboy*endtime  | NOINT
   /RANDOM = dvO dvY dvO*endtime dvY*endtime | SUBJECT(family) COVTYPE(UN)
   /REPEATED = DV | SUBJECT(wave*family) COVTYPE(UN)
   /TEST = "Diff Effect of Own Gender on Intercept?" dvO*Oboy -1 dvY*Yboy 1
   /TEST = "Diff Effect of Own Gender on Linear Slope?" dvO*Oboy*endtime -1 dvY*Yboy*endtime 1
   /TEST = "Diff Effect of SibO Gender on Intercept?" dvO*Oboy -1 dvY*Oboy 1
   /TEST = "Diff Effect of SibO Gender on Intercept?" dvO*Oboy*endtime -1 dvY*Oboy*endtime 1.



Mixed Model Analysis


Notes
Output Created 03-JUL-2013 07:21:32
Comments  
Input Active Dataset example8
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 2400
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics are based on all cases with valid data for all variables in the model.
Syntax MIXED risky BY family wave DV WITH dvO dvY endtime Oboy Yboy
/METHOD = ML
/PRINT = SOLUTION TESTCOV G R
/FIXED = dvO dvY dvO*endtime dvY*endtime dvO*endtime*endtime
dvO*Oboy dvY*Yboy dvO*Oboy*endtime dvY*Yboy*endtime dvO*Oboy*endtime*endtime
dvY*Oboy dvY*Oboy*endtime | NOINT
/RANDOM = dvO dvY dvO*endtime dvY*endtime | SUBJECT(family) COVTYPE(UN)
/REPEATED = DV | SUBJECT(wave*family) COVTYPE(UN)
/TEST = "Diff Effect of Own Gender on Intercept?" dvO*Oboy -1 dvY*Yboy 1
/TEST = "Diff Effect of Own Gender on Linear Slope?" dvO*Oboy*endtime -1 dvY*Yboy*endtime 1
/TEST = "Diff Effect of SibO Gender on Intercept?" dvO*Oboy -1 dvY*Oboy 1
/TEST = "Diff Effect of SibO Gender on Intercept?" dvO*Oboy*endtime -1 dvY*Oboy*endtime 1.
Resources Processor Time 00:00:01.23
Elapsed Time 00:00:01.36


[example8] 


Warnings
Iteration was terminated but convergence has not been achieved. The MIXED procedure continues despite this warning. Subsequent results produced are based on the last iteration. Validity of the model fit is uncertain.

Model Dimensiona
  Number of Levels Covariance Structure Number of Parameters Subject Variables Number of Subjects
Fixed Effects dvO 1   1    
dvY 1   1    
dvO * endtime 1   1    
dvY * endtime 1   1    
dvO * endtime * endtime 1   1    
dvO * oboy 1   1    
dvY * yboy 1   1    
dvO * endtime * oboy 1   1    
dvY * endtime * yboy 1   1    
dvO * endtime * endtime * oboy 1   1    
dvY * oboy 1   1    
dvY * endtime * oboy 1   1    
Random Effects dvO + dvY + dvO * endtime + dvY * endtimeb 4 Unstructured 10 FAMILY  
Repeated Effects DV 2 Unstructured 3 wave * FAMILY 1103
Total 18   25    
a. Dependent Variable: risky: Risky Behavior for All Siblings.
b. As of version 11.5, the syntax rules for the RANDOM subcommand have changed. Your command syntax may yield results that differ from those produced by prior versions. If you are using version 11 syntax, please consult the current syntax reference guide for more information.

Information Criteriaa
-2 Log Likelihood 9768.207
Akaike's Information Criterion (AIC) 9818.207
Hurvich and Tsai's Criterion (AICC) 9819.019
Bozdogan's Criterion (CAIC) 9978.069
Schwarz's Bayesian Criterion (BIC) 9953.069
The information criteria are displayed in smaller-is-better forms.
a. Dependent Variable: risky: Risky Behavior for All Siblings.


Fixed Effects


Type III Tests of Fixed Effectsa
Source Numerator df Denominator df F Sig.
dvO 1 194.067 1092.290 .000
dvY 1 182.722 653.511 .000
dvO * endtime 1 747.319 70.196 .000
dvY * endtime 1 46.558 24.305 .000
dvO * endtime * endtime 1 901.096 11.961 .001
dvO * oboy 1 189.626 1.505 .221
dvY * yboy 1 165.131 .733 .393
dvO * endtime * oboy 1 717.948 3.737 .054
dvY * endtime * yboy 1 69.389 8.237 .005
dvO * endtime * endtime * oboy 1 906.053 3.819 .051
dvY * oboy 1 170.102 4.868 .029
dvY * endtime * oboy 1 85.942 2.369 .127
a. Dependent Variable: risky: Risky Behavior for All Siblings.

Estimates of Fixed Effectsa
Parameter Estimate Std. Error df t Sig. 95% Confidence Interval
Lower Bound Upper Bound
dvO 28.205482 .853424 194.067 33.050 .000 26.522306 29.888658
dvY 25.563919 1.000002 182.722 25.564 .000 23.590884 27.536955
dvO * endtime 2.367081 .282524 747.319 8.378 .000 1.812445 2.921717
dvY * endtime 1.575641 .319599 46.558 4.930 .000 .932529 2.218753
dvO * endtime * endtime .157105 .045426 901.096 3.458 .001 .067952 .246259
dvO * oboy 1.494304 1.218153 189.626 1.227 .221 -.908568 3.897176
dvY * yboy -.944992 1.103419 165.131 -.856 .393 -3.123619 1.233635
dvO * endtime * oboy -.764353 .395401 717.948 -1.933 .054 -1.540634 .011928
dvY * endtime * yboy -1.079661 .376192 69.389 -2.870 .005 -1.830069 -.329253
dvO * endtime * endtime * oboy -.127728 .065358 906.053 -1.954 .051 -.255998 .000541
dvY * oboy 2.567981 1.163890 170.102 2.206 .029 .270453 4.865508
dvY * endtime * oboy .594860 .386446 85.942 1.539 .127 -.173377 1.363098
a. Dependent Variable: risky: Risky Behavior for All Siblings.


Covariance Parameters


Estimates of Covariance Parametersa
Parameter Estimate Std. Error Wald Z Sig. 95% Confidence Interval
Lower Bound Upper Bound
Repeated Measures UN (1,1) 13.864073 .756563 18.325 .000 12.457782 15.429112
UN (2,1) -.827763 .773617 -1.070 .285 -2.344025 .688499
UN (2,2) 13.310495 1.329642 10.011 .000 10.943698 16.189161
dvO + dvY + dvO * endtime + dvY * endtime [subject = FAMILY] UN (1,1) 64.381925 7.441650 8.652 .000 51.330674 80.751565
UN (2,1) 22.083254 5.335919 4.139 .000 11.625046 32.541463
UN (2,2) 49.366582 6.723255 7.343 .000 37.801373 64.470129
UN (3,1) 10.485124 1.327785 7.897 .000 7.882712 13.087535
UN (3,2) 3.612810 .971752 3.718 .000 1.708211 5.517410
UN (3,3) 1.798228 .256955 6.998 .000 1.358981 2.379447
UN (4,1) 4.212675 1.795046 2.347 .019 .694448 7.730901
UN (4,2) 10.227206 2.062815 4.958 .000 6.184163 14.270249
UN (4,3) .700841 .328318 2.135 .033 .057350 1.344332
UN (4,4) 2.122585 .820718 2.586 .010 .994810 4.528874
a. Dependent Variable: risky: Risky Behavior for All Siblings.

Random Effect Covariance Structure (G)a
  dvO | FAMILY dvY | FAMILY dvO * endtime | FAMILY dvY * endtime | FAMILY
dvO | FAMILY 64.381925 22.083254 10.485124 4.212675
dvY | FAMILY 22.083254 49.366582 3.612810 10.227206
dvO * endtime | FAMILY 10.485124 3.612810 1.798228 .700841
dvY * endtime | FAMILY 4.212675 10.227206 .700841 2.122585
Unstructured
a. Dependent Variable: risky: Risky Behavior for All Siblings.

Residual Covariance (R) Matrixa
  [DV = 1] [DV = 2]
[DV = 1] 13.864073 -.827763
[DV = 2] -.827763 13.310495
Unstructured
a. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 1 (Diff Effect of Own Gender on Intercept?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 -2.439296 1.643680 354.647 0 -1.484 .139 -5.671881 .793289
a. Diff Effect of Own Gender on Intercept?
b. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 2 (Diff Effect of Own Gender on Linear Slope?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 -.315308 .545821 266.727 0 -.578 .564 -1.389974 .759358
a. Diff Effect of Own Gender on Linear Slope?
b. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 3 (Diff Effect of SibO Gender on Intercept?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 1.073677 1.394618 172.213 0 .770 .442 -1.679068 3.826422
a. Diff Effect of SibO Gender on Intercept?
b. Dependent Variable: risky: Risky Behavior for All Siblings.


Custom Hypothesis Test 4 (Diff Effect of SibO Gender on Intercept?)


Contrast Estimatesa,b
Contrast Estimate Std. Error df Test Value t Sig. 95% Confidence Interval
Lower Bound Upper Bound
L1 1.359213 .528290 218.455 0 2.573 .011 .318015 2.400411
a. Diff Effect of SibO Gender on Intercept?
b. Dependent Variable: risky: Risky Behavior for All Siblings.

TITLE.