SPSS Statistics

 View Only
Expand all | Collapse all

Fitting models with covariance matrices defined by Kronecker products with MIXED

  • 1.  Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Wed September 22, 2021 09:11 AM
    Hello,

    I'm trying to replicate the following analysis in SAS PROC MIXED using the SPSS MIXED command. Here is the model being fitted:

    proc mixed data = ratbrain;

    class animal region treatment;

    model activate = region treatment region*treatment / s;

    random int / subject = animal type=vc v vcorr solution;

    repeated region treatment / subject=animal type=un@un r rcorr;

    run;

    There are six measures per animal, defined by three regions and two treatments per region.

    Here is the output from fitting this model in SAS:

    Covariance Parameter Estimates

    --------------------------------------

    Cov Parm Subject Estimate

    --------------------------------------

    Intercept animal 7637.3000

    region UN(1,1) animal 2127.7400

    UN(2,1) animal 1987.2900

    UN(2,2) animal 2744.6600

    UN(3,1) animal 1374.5100

    UN(3,2) animal 2732.2200

    UN(3,3) animal 3419.7000

    treatment UN(1,1) animal 1.0000

    UN(2,1) animal -0.4284

    UN(2,2) animal 0.6740

    I would like to try and fit the same model using MIXED in SPSS. However, I'm having a very hard time figuring out how to do this. Here is what I've tried:

    MIXED
    activate BY region treatment
    /CRITERIA = CIN(95) MXITER(100) MXSTEP(5) SCORING(1)
    SINGULAR(0.000000000001) HCONVERGE(0, ABSOLUTE)
    LCONVERGE(0, ABSOLUTE) PCONVERGE(0.000001, ABSOLUTE)
    DFMETHOD(KENWARDROGER)
    /FIXED = region treatment region*treatment | SSTYPE(3)
    /METHOD = REML
    /PRINT = SOLUTION G
    /RANDOM INTERCEPT | SUBJECT(animal) COVTYPE(UN) SOLUTION
    /repeated region*treatment | subject(animal) kronecker(region treatment) covtype(un_un)
    /SAVE = PRED RESID .

    I get an error message saying that the region and treatment variables cannot be included in both the repeated statement and the kronecker option. I can't remove the repeated variables, and I need to use the kronecker() option if covtype is un_un. I'm at a bit of a loss as to how to fit the same model. When I create a new variable called "measure" with values 1, 2, 3, 4, 5, 6 for each animal, and use that as the repeated variable with the region and treatment variables specified as the kronecker measures, I simply get a convergence error and no output.

    I'd welcome any help on how to fit this model using SPSS MIXED. Thanks in advance!



    ------------------------------
    Brady West
    ------------------------------

    #SPSSStatistics


  • 2.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Wed September 22, 2021 10:39 AM
    Good morning. One of our statisticians have responded:


    The issue is caused by the fact that we cannot allow the exact same effect to be specified by both Repeated and Kronecker Measures. Please ask the customer to specify

    /repeated region | subject(animal) kronecker(treatment) covtype(un_un)


    and try again.






  • 3.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Thu September 23, 2021 01:20 AM
    Hi Rick,

    Thanks for the quick replies. This suggestion came close, and produces the same estimates of the fixed effects; however, the standard errors of the estimated fixed effects are pretty different. Compared to SAS, the -2 REML log-likelihood is different (and changing the SPSS MIXED estimation criteria did not change this), and the estimates of the covariance parameters are different. I'm including both sets of output below. I'd welcome any suggestions for trying to get these to match up more closely.

    -Brady

    SAS Output:

    Fit Statistics
    -2 Res Log Likelihood 240.0
    AIC (Smaller is Better) 258.0
    AICC (Smaller is Better) 270.9
    BIC (Smaller is Better) 254.5

    Solution for Fixed Effects
    Effect region treatment Estimate Standard
    Error
    DF t Value Pr > |t|
    Intercept     572.32 44.5919 4 12.83 0.0002
    region 1   -45.6100 19.4224 20 -2.35 0.0293
    region 2   -137.05 9.7134 20 -14.11 <.0001
    region 3   0 . . . .
    treatment   1 -360.03 41.6050 20 -8.65 <.0001
    treatment   2 0 . . . .
    region*treatment 1 1 261.82 37.6365 20 6.96 <.0001
    region*treatment 1 2 0 . . . .
    region*treatment 2 1 162.50 18.8225 20 8.63 <.0001
    region*treatment 2 2 0 . . . .
    region*treatment 3 1 0 . . . .
    region*treatment 3 2 0 . . . .

     
    Covariance Parameter Estimates
    Cov Parm Subject Estimate
    Intercept animal 7637.30
    region UN(1,1) animal 2127.74
    UN(2,1) animal 1987.29
    UN(2,2) animal 2744.66
    UN(3,1) animal 1374.51
    UN(3,2) animal 2732.22
    UN(3,3) animal 3419.70
    treatment UN(1,1) animal 1.0000
    UN(2,1) animal -0.4284
    UN(2,2) animal 0.6740

    SPSS Output:






    ------------------------------
    Brady West
    ------------------------------



  • 4.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Tue May 24, 2022 11:37 AM
    Hi Brady, I have a similar problem with the kronecker measure. Did you ever get a satisfactory answer to your query? Graeme

    ------------------------------
    Graeme Byrne
    ------------------------------



  • 5.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Tue May 24, 2022 11:47 AM
    Graeme;

    If you are not already, please try the latest available release (28.0.1.1). If you are having difficulty the correct answer for your model, please let me know and I will make sure our statisticians take a look at it. Thanks.


    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 6.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Tue May 24, 2022 01:25 PM

    Hi Rick and thanks for your quick reply. I'm using SPSS version 28.0.0.0 so I may need to get an update though my university.

     

    I've adapted the SPSS example on Doubly repeated measures to  at

    Can SPSS analyze doubly multivariate repeated measures data using a mixed models approach to handle missing data or unbalanced designs? (ibm.com)

     

    The data has 4 repeated measures on 6 related variable. "Response" holds the values of the dependent variable indexed by "variable". The code works as expected with COVTYPE(DIAG), COVTYPE(CS) or COVTYPE(CSH) but these structures do not reflect the reality of the data. I would expect the 6 variables to have an unstructured covariance matrix with autocorrelation over time hence my desire to use the UN_AR1 structure. I tried COVTYPE(UN) but after running the process for 8 hours without result, I decided to pull the pin and look for a less computing intensive approach. As I understand it the UN structure requires estimating 24*25/2=300 parameters so I'm not surprised by the computation time.  I think the UN_AR1 structure requires (6*7/2)*2 = 42 parameters so I'm hoping it will  take far less time to compute.

     

    The syntax below does not work due to KRONECKER(variable*Time) as I get an warning message below and execution stops. If I change this to KRONECKER(variable) it works (although it's still running after 2 hours) but am I right in assuming that the UN part applies to the variables and the AR1 part applies to the repeated measures even though it is not explicitly stated in KRONECKER().

     

    I'll let the amended code run overnight and let you know what happens.

     

    Graeme

     

    MIXED response BY variable Time Group Allocation Sex

       /FIXED=variable Time(variable) Group(variable) Allocation(variable) Sex(variable) Time*Allocation(variable) | NOINT SSTYPE(3)

      /METHOD=REML

      /SAVE PRED

      /REPEATED= variable*Time | SUBJECT(Study_ID) COVTYPE(UN_AR1) KRONECKER(variable*Time)

      /EMMEANS=TABLES(variable*Time) COMPARE(Time) REFCAT(FIRST) ADJ(SIDAK)

       /EMMEANS=TABLES(variable*Group) COMPARE(Group) ADJ(SIDAK)

      /EMMEANS=TABLES(variable*Allocation) COMPARE(Allocation) ADJ(SIDAK)

      /EMMEANS=TABLES(variable*Sex) COMPARE(Sex) ADJ(SIDAK)

      /EMMEANS=TABLES(variable*Time*Allocation) COMPARE(Time) ADJ(SIDAK).

     

     

     

    Warnings

    In the REPEATED subcommand, variable lists specified for repeated measure and KRONECKER, are the same.

    Execution of this command stops.

     

     

     






  • 7.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Tue May 24, 2022 03:46 PM
    Speaking to one of our statisticians, he suggested:

    /REPEATED=variable | SUBJECT(Study_ID) COVTYPE(UN_AR1) KRONECKER(Time)



    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 8.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Wed May 25, 2022 12:55 AM

    Hi Rick and thanks again for your prompt reply.

    Now,  /REPEATED=variable | SUBJECT(Study_ID) COVTYPE(UN_AR1) KRONECKER(Time) works but I get the following warning.

     

    Warnings

    The final Hessian matrix is not positive definite although all convergence criteria are satisfied. The MIXED procedure continues despite this warning. Validity of subsequent results cannot be ascertained.

     

    I then tweaked the criteria with (yellow numbers changed from default)

     

    /CRITERIA=DFMETHOD(SATTERTHWAITE) CIN(95) MXITER(100) MXSTEP(20) SCORING(1)  SINGULAR(0.00000000000001)

      HCONVERGE(0.000000001, RELATIVE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0,ABSOLUTE)

     

    Which removed the warning however I'm a little confused with univariate tests resulting from

     

    /EMMEANS=TABLES(variable*Time) COMPARE(Time) REFCAT(FIRST) ADJ(SIDAK)

     

    Which yields the pairwise comparisons OK (below) but the univariate tests (further below) are missing for the last three variables. Any thoughts?

     

     

    Pairwise Comparisonsa

    variable

    (I) Time

    (J) Time

    Mean Difference (I-J)

    Std. Error

    df

    Sig.c

    95% Confidence Interval for Differencec

    Lower Bound

    Upper Bound

    Grip_max_affected

    2

    1

    -.123

    .951

    67.106

    .999

    -2.451

    2.205

    3

    1

    2.593

    1.215

    74.860

    .104

    -.374

    5.559

    4

    1

    2.210

    1.351

    84.038

    .285

    -1.082

    5.502

    Pinch_max_affected

    2

    1

    .510

    .219

    69.295

    .067

    -.026

    1.047

    3

    1

    .662

    .280

    76.603

    .061

    -.022

    1.346

    4

    1

    .973*

    .312

    85.094

    .007

    .214

    1.733

    PRWHE

    2

    1

    -17.974*

    3.060

    85.365

    <.001

    -25.426

    -10.522

    3

    1

    -35.719*

    3.891

    88.230

    <.001

    -45.189

    -26.249

    4

    1

    -38.614*

    4.350

    91.408

    <.001

    -49.195

    -28.033

    qDASH_main_total

    2

    1

    -11.198*

    3.146

    87.922

    .002

    -18.856

    -3.540

    3

    1

    -27.158*

    4.001

    89.326

    <.001

    -36.893

    -17.423

    4

    1

    -32.261*

    4.473

    90.897

    <.001

    -43.142

    -21.381

    Range_th_palmabd_affected

    2

    1

    .594

    1.272

    77.169

    .954

    -2.510

    3.697

    3

    1

    3.129

    1.625

    82.692

    .163

    -.830

    7.088

    4

    1

    3.972

    1.808

    88.123

    .089

    -.428

    8.372

    Range_UD_affected

    2

    1

    2.052

    1.595

    79.629

    .492

    -1.839

    5.943

    3

    1

    4.160

    2.038

    85.025

    .127

    -.803

    9.124

    4

    1

    7.346*

    2.268

    90.149

    .005

    1.828

    12.864

    Based on estimated marginal means

    *. The mean difference is significant at the .05 level.

    a. Dependent Variable: response.

    c. Adjustment for multiple comparisons: Sidak.

     

    Univariate Testsa

    variable

    Numerator df

    Denominator df

    F

    Sig.

    Grip_max_affected

    3

    69.179

    2.710

    .052

    Pinch_max_affected

    3

    71.182

    3.573

    .018

    PRWHE

    3

    85.177

    32.133

    <.001

    qDASH_main_total

    0

    .

    .

    .

    Range_th_palmabd_affected

    0

    .

    .

    .

    Range_UD_affected

    0

    .

    .

    .

    Each F tests the simple effects of Time within each level combination of the other effects shown. These tests are based on the linearly independent pairwise comparisons among the estimated marginal means.

    a. Dependent Variable: response.

     

     

     

     






  • 9.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Wed May 25, 2022 12:11 PM
    Statistician's suggestion: "... Possible that the Satterthwaite denominator degrees of freedom can't be computed for those variables. Can try RESIDUAL or KENWARDROGER methods to see if they work."

     



    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 10.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Wed May 25, 2022 09:36 PM

    Hi Rick, I tried DFMETHOD(KENWARDROGER) and DFMETHOD(RESIDUAL) but DF still missing in univariate tests tables. I did find a research gate entry at Mixed Model Analysis in SPSS: missing denominator df, F and p value? (researchgate.net) which discusses the problem and one suggestion was to scale variables which may have solved their problem but I'm not sure. I tried standardizing the response for each variable but the problem persists.

     

    Note: SPSS does not issue a warning or error message when the DF go missing.

     

    Graeme

     






  • 11.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Thu May 26, 2022 06:06 PM
    Graeme;

    Try this:

    GENLINMIXED

      /DATA_STRUCTURE SUBJECTS=Study_ID REPEATED_MEASURES=variable KRONECKER_MEASURES=Time COVARIANCE_TYPE=UN_AR1

      /FIELDS TARGET=response

      /TARGET_OPTIONS DISTRIBUTION=NORMAL LINK=IDENTITY

      /FIXED  EFFECTS=variable Time*variable Allocation*variable Sex*variable Time*Allocation*variable

        USE_INTERCEPT=FALSE

      /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING

        HCONVERGE=0.00000001(RELATIVE) MAX_ITERATIONS=200 CONFIDENCE_LEVEL=95 DF_METHOD=KENWARD_ROGER COVB=MODEL

        SCORING=1 SINGULAR=0.000000000001

       /EMMEANS TABLES=variable*Time COMPARE=Time CONTRAST=PAIRWISE

       /EMMEANS TABLES=variable*Allocation COMPARE=Allocation CONTRAST=PAIRWISE

       /EMMEANS TABLES=variable*Sex COMPARE=Sex CONTRAST=PAIRWISE

       /EMMEANS TABLES=variable*Time*Allocation COMPARE=Time CONTRAST=PAIRWISE

       /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=SEQSIDAK.







  • 12.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Thu May 26, 2022 09:38 PM

    Hi Rick, this works and produces complete output ��. I'm curious, was it the way I nested effects within variable that caused the problem or is there a bug in the EMMEANS subcommand of the MIXED command?.

     

    Graeme

     






  • 13.  RE: Fitting models with covariance matrices defined by Kronecker products with MIXED

    Posted Wed September 22, 2021 10:57 AM
    Another statistician has replied independently:

    "In order to get the syntax to work, one of the two variables listed on KRONECKER needs to be removed. I believe to match what SAS is doing, it would be the second one (treatment). I think the specification on KRONECKER is to specify the factor(s) that define the general ("unstructured") structure in the first part of the Kronecker product."