BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fishhead
Calcite | Level 5

Hi,

i have a rather complex mulitvariate mixed model that has Y variables (traits) that do and do not have repeated measures.  the aim is to look for across-individual correlations between traits.

I have repeated measures of metabolism in relation to temperature, so that trait i wish to model as random intercepts and slopes.  but, the other traits have only a single estimate (mass of internal organs, like liver, heart etc).  i am interested mainly in whether intercepts and/or slopes of metabolism (smr) are correlated across individuals to growth (grow), and organ masses.  i have standardised all variables to mean 0, variance 1.

i understand i must fix residual variance to zero for those traits without repeated measures (see final line of parms parameters).  i am able to do this for a bivariate situation, but the residual variances i request be held to zero are not all held at that ... SAS seems to fit something anyways!  and for any model, even the bivariate models that converge and make sense, i get non positive definate errors.

The Model:

proc mixed maxiter=100 method=reml covtest;

class id trait sex;

where trait in ('smr' 'grow' 'stomach''liver''heart' ) ;

model score = trait  trait*mass  trait*temp  trait*sex / noint solution   ;

  random trait trait*temp  / subject=id type=un g gcorr  ;

     repeated / subject=id group=trait type=vc  ;

parms

0.4                                  

0.1    0.3                              

0.1    0.1    0.2                          

0.1    0.1    0.1    0.1                      

0.1    0.1    0.1    0.1    0.1                  

0        0        0       0      0    0              

0        0        0       0      0     0    0          

0        0        0       0      0     0    0    0      

0.1    0.1    0.1    0.1    0.1    0    0    0    0.2  

0        0        0       0      0     0    0    0    0    0

0    0    0    0.2   0          

  

/ hold=16-36,42-44,46-55,56-58,60;

run;

any help would be MUCH appreciated.

Here is the output:

Model Information

                      Data Set                     WORK.SNAKE

                      Dependent Variable           score

                      Covariance Structures        Unstructured, Variance

                                                   Components

                      Subject Effects              id, id

                      Group Effect                 trait

                      Estimation Method            REML

                      Residual Variance Method     None

                      Fixed Effects SE Method      Model-Based

                      Degrees of Freedom Method    Containment

                                     Class Level Information

                        Class    Levels    Values

                        id           78    1 2 3 4 5 6 7 8 9 10 11 12 13

                                           14 15 16 17 18 19 20 21 22 23

                                           24 25 26 27 28 29 30 31 32 33

                                           34 35 36 37 38 39 40 41 42 43

                                           44 45 46 47 48 49 50 51 52 53

                                           54 55 56 57 58 59 60 61 62 63

                                           64 65 66 67 68 69 70 71 72 73

                                           74 75 76 77 78

                        trait         5    grow heart liver smr stomach

                        sex           2    f m

                                           Dimensions

                               Covariance Parameters            60

                               Columns in X                     25

                               Columns in Z Per Subject         10

                               Subjects                         78

                               Max Obs Per Subject               7

                                     Number of Observations

                           Number of Observations Read             546

                           Number of Observations Used             543

                           Number of Observations Not Used           3

                                    SNAKE gifford multivariate                                 993

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                         Parameter Search

   CovP1     CovP2     CovP3     CovP4     CovP5     CovP6     CovP7     CovP8     CovP9    CovP10

  0.4000    0.1000    0.3000    0.1000    0.1000    0.2000    0.1000    0.1000    0.1000    0.1000

                                         Parameter Search

  CovP11    CovP12    CovP13    CovP14    CovP15    CovP16    CovP17    CovP18    CovP19    CovP20

  0.1000    0.1000    0.1000    0.1000    0.1000         0         0         0         0         0

                                         Parameter Search

  CovP21    CovP22    CovP23    CovP24    CovP25    CovP26    CovP27    CovP28    CovP29    CovP30

       0         0         0         0         0         0         0         0         0         0

                                         Parameter Search

  CovP31    CovP32    CovP33    CovP34    CovP35    CovP36    CovP37    CovP38    CovP39    CovP40

       0         0         0         0         0         0    0.1000    0.1000    0.1000    0.1000

                                         Parameter Search

  CovP41    CovP42    CovP43    CovP44    CovP45    CovP46    CovP47    CovP48    CovP49    CovP50

  0.1000         0         0         0    0.2000         0         0         0         0         0

                                         Parameter Search

  CovP51    CovP52    CovP53    CovP54    CovP55    CovP56    CovP57    CovP58    CovP59    CovP60

       0         0         0         0         0         0         0         0    0.2000         0

                                         Parameter Search

                                     Res Log Like    -2 Res Log Like

                                       -1646.0444          3292.0888

                                        Iteration History

                   Iteration    Evaluations    -2 Res Log Like       Criterion

                           1              2      3052.77234298    5076446.9586

                           2              1      3020.53129601    5396314.6003

                                    SNAKE gifford multivariate                                 994

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                        Iteration History

                   Iteration    Evaluations    -2 Res Log Like       Criterion

                           3              1      2623.03272815    3512091.3947

                           4              1      2239.29440240    2179422.9738

                           5              1      1955.97441629    1534676.7519

                           6              1      1857.64284936    1616514.1840

                           7              1      1753.59719832    1997053.3055

                           8              1      1602.83749339    3323477.4337

                           9              1      1493.10709367    5965459.3658

                          10              1      1432.24335881    10071334.555

                          11              3      1263.59574182       .

                          12              1       955.09012350       .

                          13              1       756.70827473       .

                          14              1       636.28480138       .

                          15              1       570.77910660       .

                          16              1       537.89890246    505.89610327

                          17              1       522.91363072    125.67368087

                          18              1       517.65753686     24.35200327

                          19              1       516.59637099      1.79963774

                          20              1       516.52797109      0.01407840

                          21              1       516.52755520      0.00000074

                          22              1       516.52755518      0.00000000

                    Convergence criteria met but final hessian is not positive

                                            definite.

                                        Estimated G Matrix

Row   Effect       trait     id       Col1       Col2       Col3       Col4       Col5       Col6

   1   trait        grow       1   0.000751   -0.00107   -0.00363   -0.02785   0.006168

   2   trait        heart      1   -0.00107     0.5930     0.1582    -0.3107     0.3585

   3   trait        liver      1   -0.00363     0.1582     0.3993    -1.7961     0.2958

   4   trait        smr        1   -0.02785    -0.3107    -1.7961     3.4202    -1.4543

   5   trait        stomach    1   0.006168     0.3585     0.2958    -1.4543     0.9790

                                        Estimated G Matrix

                        Row       Col7        Col8        Col9       Col10

                          1                            0.01991

                          2                             0.2445

                          3                             1.2976

                          4                            -3.0078

                          5                             1.0739

                                    SNAKE gifford multivariate                                 995

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                        Estimated G Matrix

Row   Effect       trait     id       Col1       Col2       Col3       Col4       Col5       Col6

   6   temp*trait   grow       1

   7   temp*trait   heart      1

   8   temp*trait   liver      1

   9   temp*trait   smr        1    0.01991     0.2445     1.2976    -3.0078     1.0739

  10   temp*trait   stomach    1

                                        Estimated G Matrix

                        Row       Col7        Col8        Col9       Col10

                          6

                          7

                          8

                          9                             2.5226

                         10

                                  Estimated G Correlation Matrix

Row   Effect       trait     id       Col1       Col2       Col3       Col4       Col5       Col6

   1   trait        grow       1     1.0000   -0.05076    -0.2097    -0.5496     0.2276

   2   trait        heart      1   -0.05076     1.0000     0.3251    -0.2181     0.4704

   3   trait        liver      1    -0.2097     0.3251     1.0000    -1.0000     0.4731

   4   trait        smr        1    -0.5496    -0.2181    -1.0000     1.0000    -0.7948

   5   trait        stomach    1     0.2276     0.4704     0.4731    -0.7948     1.0000

   6   temp*trait   grow       1                                                            1.0000

   7   temp*trait   heart      1

   8   temp*trait   liver      1

   9   temp*trait   smr        1     0.4576     0.1999     1.0000    -1.0000     0.6834

                                  Estimated G Correlation Matrix

                        Row       Col7        Col8        Col9       Col10

                          1                             0.4576

                          2                             0.1999

                          3                             1.0000

                          4                            -1.0000

                          5                             0.6834

                          6

                          7     1.0000

                          8                 1.0000

                          9                             1.0000

                                    SNAKE gifford multivariate                                 996

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                  Estimated G Correlation Matrix

Row   Effect       trait     id       Col1       Col2       Col3       Col4       Col5       Col6

  10   temp*trait   stomach    1

                                  Estimated G Correlation Matrix

                        Row       Col7        Col8        Col9       Col10

                         10                                         1.0000

                                  Covariance Parameter Estimates

                                                             Standard         Z

       Cov Parm      Subject    Group            Estimate       Error     Value        Pr Z

       UN(1,1)       id                          0.000751    0.000129      5.82      <.0001

       UN(2,1)       id                          -0.00107    0.003318     -0.32      0.7469

       UN(2,2)       id                            0.5930      0.1577      3.76      <.0001

       UN(3,1)       id                          -0.00363    0.002722     -1.33      0.1823

       UN(3,2)       id                            0.1582     0.09710      1.63      0.1033

       UN(3,3)       id                            0.3993      0.1111      3.59      0.0002

       UN(4,1)       id                          -0.02785     0.02200     -1.27      0.2057

       UN(4,2)       id                           -0.3107      0.7639     -0.41      0.6842

       UN(4,3)       id                           -1.7961      0.6333     -2.84      0.0046

       UN(4,4)       id                            3.4202      7.6157      0.45      0.3267

       UN(5,1)       id                          0.006168    0.004053      1.52      0.1280

       UN(5,2)       id                            0.3585      0.1483      2.42      0.0156

       UN(5,3)       id                            0.2958      0.1174      2.52      0.0118

       UN(5,4)       id                           -1.4543      0.6873     -2.12      0.0343

       UN(5,5)       id                            0.9790      0.1587      6.17      <.0001

       UN(6,1)       id                                 0           .       .         .

       UN(6,2)       id                                 0           .       .         .

       UN(6,3)       id                                 0           .       .         .

       UN(6,4)       id                                 0           .       .         .

       UN(6,5)       id                                 0           .       .         .

       UN(6,6)       id                                 0           .       .         .

       UN(7,1)       id                                 0           .       .         .

       UN(7,2)       id                                 0           .       .         .

       UN(7,3)       id                                 0           .       .         .

       UN(7,4)       id                                 0           .       .         .

       UN(7,5)       id                                 0           .       .         .

       UN(7,6)       id                                 0           .       .         .

       UN(7,7)       id                                 0           .       .         .

       UN(8,1)       id                                 0           .       .         .

       UN(8,2)       id                                 0           .       .         .

       UN(8,3)       id                                 0           .       .         .

       UN(8,4)       id                                 0           .       .         .

                                    SNAKE gifford multivariate                                 997

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                  Covariance Parameter Estimates

                                                             Standard         Z

       Cov Parm      Subject    Group            Estimate       Error     Value        Pr Z

       UN(8,5)       id                                 0           .       .         .

       UN(8,6)       id                                 0           .       .         .

       UN(8,7)       id                                 0           .       .         .

       UN(8,8)       id                                 0           .       .         .

       UN(9,1)       id                           0.01991     0.01563      1.27      0.2026

       UN(9,2)       id                            0.2445      0.5433      0.45      0.6527

       UN(9,3)       id                            1.2976      0.4513      2.88      0.0040

       UN(9,4)       id                           -3.0078      5.3254     -0.56      0.5722

       UN(9,5)       id                            1.0739      0.4884      2.20      0.0279

       UN(9,6)       id                                 0           .       .         .

       UN(9,7)       id                                 0           .       .         .

       UN(9,8)       id                                 0           .       .         .

       UN(9,9)       id                            2.5226      3.7309      0.68      0.2495

       UN(10,1)      id                                 0           .       .         .

       UN(10,2)      id                                 0           .       .         .

       UN(10,3)      id                                 0           .       .         .

       UN(10,4)      id                                 0           .       .         .

       UN(10,5)      id                                 0           .       .         .

       UN(10,6)      id                                 0           .       .         .

       UN(10,7)      id                                 0           .       .         .

       UN(10,8)      id                                 0           .       .         .

       UN(10,9)      id                                 0           .       .         .

       UN(10,10)     id                                 0           .       .         .

       Residual      id         trait grow              0           .       .         .

       Residual      id         trait heart        0.2930           0       .         .

       Residual      id         trait liver        0.1993           0       .         .

       Residual      id         trait smr          0.2168     0.03502      6.19      <.0001

       Residual      id         trait stomach           0           .       .         .

                                         Fit Statistics

                              -2 Res Log Likelihood           516.5

                              AIC (smaller is better)         618.5

                              AICC (smaller is better)        629.7

                              BIC (smaller is better)         738.7

                                 PARMS Model Likelihood Ratio Test

                                   DF    Chi-Square      Pr > ChiSq

                                   51       2775.56          <.0001

                                    SNAKE gifford multivariate                                 998

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                   Solution for Fixed Effects

                                                   Standard

       Effect        trait      sex    Estimate       Error      DF    t Value    Pr > |t|

       trait         grow               -0.3277     0.03308     378      -9.91      <.0001

       trait         heart              -2.3197      1.0897     378      -2.13      0.0339

       trait         liver              -4.7063      0.8233     378      -5.72      <.0001

       trait         smr               -19.4215      0.7135     378     -27.22      <.0001

       trait         stomach            -0.1774      0.1558     378      -1.14      0.2553

       mass*trait    grow                0.2982     0.02101      73      14.20      <.0001

       mass*trait    heart               1.3864      0.6801      73       2.04      0.0451

       mass*trait    liver               2.8763      0.5154      73       5.58      <.0001

       mass*trait    smr                 1.8862      0.1671      73      11.29      <.0001

       mass*trait    stomach                  0           .       .        .         .

       temp*trait    grow                     0           .       .        .         .

       temp*trait    heart                    0           .       .        .         .

       temp*trait    liver                    0           .       .        .         .

       temp*trait    smr                11.3638      0.4747      77      23.94      <.0001

       temp*trait    stomach                  0           .       .        .         .

       trait*sex     grow       f      -0.00298    0.006210      73      -0.48      0.6324

       trait*sex     grow       m             0           .       .        .         .

       trait*sex     heart      f        0.1831      0.2149      73       0.85      0.3971

       trait*sex     heart      m             0           .       .        .         .

       trait*sex     liver      f        0.2231      0.1625      73       1.37      0.1739

       trait*sex     liver      m             0           .       .        .         .

       trait*sex     smr        f      -0.04568     0.04914      73      -0.93      0.3557

       trait*sex     smr        m             0           .       .        .         .

       trait*sex     stomach    f        0.3549      0.2164      73       1.64      0.1053

       trait*sex     stomach    m             0           .       .        .         .

                                  Type 3 Tests of Fixed Effects

                                        Num     Den

                         Effect          DF      DF    F Value    Pr > F

                         trait            5     378     193.39    <.0001

                         mass*trait       4      73     105.26    <.0001

                         temp*trait       1      77     573.02    <.0001

                         trait*sex        5      73       1.27    0.2850

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Well almost.  Since the RCORR and GCORR have 1's on the diagonal, I am going to assume you want RCOV and GCOV, and in this case, the diagonal elements of RCOV, starting with (1,1)=0.000748, is the variance of zsmr22, after removing all fixed effects in the model.  So, I would interpret this as the inter-subject variability of zsmr22.  You did say that all of these scores were standardized to (0, 1) variables, so I would say that at 22C there isn't much animal to animal variation in metabolic rate.

You may want to only scale the scores, so that they are all just zero centered, and re-run this.  The diagonal values then should look like true variances.

Steve Denham

View solution in original post

12 REPLIES 12
SteveDenham
Jade | Level 19

Before I get into modeling, I am going to ask some physiological questions.

First, you have repeated measures of metabolic rate, but the organ weight data is only available at the final point, as near as I can understand.  If I am missing something on this, then my next question (and most of the rest) can be ignored.

1. I assume mass is organ weight, or body weight change.  What is mass for metabolic rate?

2. How can organ mass at the end of the trial be associated with smr at earlier timepoints?  I would think the two may be related, but it would be hard for me to consider the two together as a repeated measure.

3. Given that organ mass is a single timepoint, why not have two analyses--one a repeated measures analysis of metabolic rate, and one a multivariate of organ masses and smr at the final time point?  In the repeated measure analysis of metabolic rate, you might include the various organ masses as covariates. Will an approach like that address your research questions?

Steve Denham

fishhead
Calcite | Level 5

First, thanks so much for quick reply!

Yes, one measure of metabolism at each of three different temperatures.  Mass was measured at time of each metabolism measurement.  So, "mass" is the mass at time of metabolism.  After conditioning on mass, the aim is to see if the individual intercepts and slopes of metabolic response to temperature covary with internal organs that are implicated in energy metabolism (e.g. liver mass, also conditioned on the final mass to remove the allometry).  So, it is mass-independent metabolism and mass-independent organ sizes that we're interested in relating to one another. Of course, organ masses are taken at end of experiment after metabolism work is done.

I'm intrigued by your idea of a multivariate analysis at the final time point.  Perhaps metabolism at each of the temperatures (3) should be treated as separate traits, with a single measure each of course, and relate that to the organ masses etc.  if so, how do i do this so that mass effects, and sex, are also accounted for?  just use proc Mixed, but omit all random effects?

proc mixed;

class trait sex;

model score = trait trait*mass trait*sex ;

run;

thanks mate!

Pete

SteveDenham
Jade | Level 19

I managed to confuse myself a lot here.

There is body mass, and there is organ weight (or mass), and I think I confused the two.  See if the following is correct:

For any record, the following are available:

id

trait     (several organs, plus metabolic rate)

temp     (temperature)

sex

mass

score

Metabolic rate is measured at all temperatures.  Organ wt is measured at the end of the trial, after the animals have undergone all temperatures.

Does that accurately capture the experimental design?  If not, what am I missing?

Given that, consider the example in the PROC MIXED documentation in the REPEATED statement for the Kronecker product TYPE= option.  Would something like the following work (and of course it ignores all of the variance components you are trying to fix at zero currently, but hey, it's something different).

proc mixed maxiter=100 method=reml covtest;

class id trait sex;

where trait in ('smr' 'grow' 'stomach''liver''heart' ) ;

model score = trait  trait*mass  trait*temp  trait*sex / noint solution   ;

;

     repeated trait temp/ subject=id type=un@un  ;

You may need to consider temp as a classification variable for this to work well (or at all).  Now if the temperatures were applied sequentially, you might be able to change to un@ar(1) as a type.

Steve Denham

fishhead
Calcite | Level 5

Hi

your take on the data is basically correct.  here it is for individual 1 (of78 total):

idtrait$scoreobsjuliendaytemppop$sex$littermass
1gro_len0.080916100malf22938.3
1grow0.166412100malf22938.3
1heart0.0136100malf22941.1
1intesti0.3158100malf22941.1
1liver0.2724100malf22941.1
1smr1131.0214822malf22938.3
1smr1916.2727627malf22946.2
1smr2854.8236233malf22941.1

Note that temp was set to zero for all traits other than SMR (standard metabolic rate) to prevent SAS from trying to fit fixed/random effects of temp to them.

temperatures were applied randomly, not sequentially from 22 to 33C.

i'll try your suggested coding!!  thx!

Pete

fishhead
Calcite | Level 5

Trying your model, and making temp a categorical variable:

proc mixed maxiter=100 method=reml covtest ;

class id trait sex temp;

where trait in ('smr' 'grow' 'liver' 'heart' )  ;

     model score = trait trait*mass trait*temp  trait*sex / noint solution   ;

          repeated trait temp / subject=id type=un@un rcorr ;

run;

Yields this result - the covariance structure of which i cannot interpret at all!

                      Data Set                     WORK.SNAKE

                      Dependent Variable           score

                      Covariance Structure         Unstructured @

                                                   Unstructured

                      Subject Effect               id

                      Estimation Method            REML

                      Residual Variance Method     None

                      Fixed Effects SE Method      Model-Based

                      Degrees of Freedom Method    Between-Within

                                     Class Level Information

                        Class    Levels    Values

                        id           78    1 2 3 4 5 6 7 8 9 10 11 12 13

                                           14 15 16 17 18 19 20 21 22 23

                                           24 25 26 27 28 29 30 31 32 33

                                           34 35 36 37 38 39 40 41 42 43

                                           44 45 46 47 48 49 50 51 52 53

                                           54 55 56 57 58 59 60 61 62 63

                                           64 65 66 67 68 69 70 71 72 73

                                           74 75 76 77 78

                        trait         4    grow heart liver smr

                        sex           2    f m

                        temp          4    0 22 27 33

                                           Dimensions

                               Covariance Parameters            20

                               Columns in X                     22

                               Columns in Z                      0

                               Subjects                         78

                               Max Obs Per Subject               6

                                     Number of Observations

                           Number of Observations Read             468

                           Number of Observations Used             465

                           Number of Observations Not Used           3

                                    SNAKE gifford multivariate                                1031

                                                                    14:02 Sunday, January 22, 2012

                                       The Mixed Procedure

                                        Iteration History

                   Iteration    Evaluations    -2 Res Log Like       Criterion

                           0              1       817.36095618

                           1              2      1793.83609030    431151.14982

                           2              1      1073.84990331    323311.68917

                           3              1       652.23471322    75931.666262

                           4              1       440.01937907    5345.0261541

                           5              1       344.60561121    634.83797490

                           6              1       309.62726924     68.97791911

                           7              1       301.26778524      4.46781833

                           8              1       300.39610532      0.07755390

                           9              1       300.37671696      0.00006424

                          10              1       300.37669985      0.00000000

                    Convergence criteria met but final hessian is not positive

                                            definite.

                              Estimated R Correlation Matrix for id 1

            Row        Col1        Col2        Col3        Col4        Col5        Col6

              1      1.0000     -0.1260     -0.2866

              2     -0.1260      1.0000      0.1576

              3     -0.2866      0.1576      1.0000

              4                                          1.0000     0.07351     -0.2243

              5                                         0.07351      1.0000     0.03751

              6                                         -0.2243     0.03751      1.0000

                                 Covariance Parameter Estimates

                                                      Standard         Z

             Cov Parm          Subject    Estimate       Error     Value        Pr Z

             trait UN(1,1)     id         0.000727    0.000119      6.13      <.0001

                   UN(2,1)     id         -0.00312    0.002902     -1.08      0.2823

                   UN(2,2)     id           0.8440      0.1388      6.08      <.0001

                   UN(3,1)     id         -0.00569    0.002415     -2.36      0.0184

                   UN(3,2)     id           0.1067     0.08001      1.33      0.1824

                   UN(3,3)     id           0.5430     0.08941      6.07      <.0001

                   UN(4,1)     id                0           .       .         .

                   UN(4,2)     id                0           .       .         .

                   UN(4,3)     id                0           .       .         .

                   UN(4,4)     id           0.4886     65.4912      0.01      0.4970

             temp UN(1,1)      id           1.0000           0       .         .

                  UN(2,1)      id                0           .       .         .

                                 

                                       The Mixed Procedure

                                 Covariance Parameter Estimates

                                                      Standard         Z

             Cov Parm          Subject    Estimate       Error     Value        Pr Z

                  UN(2,2)      id           0.1519     20.3599      0.01      0.4970

                  UN(3,1)      id                0           .       .         .

                  UN(3,2)      id          0.01702      2.2813      0.01      0.9940

                  UN(3,3)      id           0.3529     47.3006      0.01      0.4970

                  UN(4,1)      id                0           .       .         .

                  UN(4,2)      id         -0.07503     10.0572     -0.01      0.9940

                  UN(4,3)      id          0.01912      2.5639      0.01      0.9940

                  UN(4,4)      id           0.7365     98.7178      0.01      0.4970

                                         Fit Statistics

                              -2 Res Log Likelihood           300.4

                              AIC (smaller is better)         338.4

                              AICC (smaller is better)        340.1

                              BIC (smaller is better)         383.2

                                 Null Model Likelihood Ratio Test

                                   DF    Chi-Square      Pr > ChiSq

                                   18        516.98          <.0001

                                   Solution for Fixed Effects

                                                      Standard

    Effect        trait    sex    temp    Estimate       Error      DF    t Value    Pr > |t|

    trait         grow                     -0.3846     0.03389     224     -11.35      <.0001

    trait         heart                    -4.7222      1.1527     224      -4.10      <.0001

    trait         liver                    -7.5913      0.9056     224      -8.38      <.0001

    trait         smr                      -2.2962      0.2683     224      -8.56      <.0001

    mass*trait    grow                      0.3347     0.02153     373      15.54      <.0001

    mass*trait    heart                     2.9054      0.7204     373       4.03      <.0001

    mass*trait    liver                     4.6960      0.5679     373       8.27      <.0001

    mass*trait    smr                       2.1312      0.1640     373      13.00      <.0001

    trait*temp    grow             0             0           .       .        .         .

    trait*temp    heart            0             0           .       .        .         .

    trait*temp    liver            0             0           .       .        .         .

    trait*temp    smr             22       -1.9272     0.08068     153     -23.89      <.0001

    trait*temp    smr             27       -1.2366     0.08134     153     -15.20      <.0001

    trait*temp    smr             33             0           .       .        .         .

    trait*sex     grow     f              -0.00481    0.006209     224      -0.77      0.4394

                                 

                                   Solution for Fixed Effects

                                                      Standard

    Effect        trait    sex    temp    Estimate       Error      DF    t Value    Pr > |t|

    trait*sex     grow     m                     0           .       .        .         .

    trait*sex     heart    f                0.1293      0.2105     224       0.61      0.5399

    trait*sex     heart    m                     0           .       .        .         .

    trait*sex     liver    f                0.1684      0.1692     224       1.00      0.3205

    trait*sex     liver    m                     0           .       .        .         .

    trait*sex     smr      f              -0.08404     0.04686     224      -1.79      0.0743

    trait*sex     smr      m                     0           .       .        .         .

                                  Type 3 Tests of Fixed Effects

                                        Num     Den

                         Effect          DF      DF    F Value    Pr > F

                         trait            4     224     109.90    <.0001

                         mass*trait       4     373     146.49    <.0001

                         trait*temp       2     153     298.59    <.0001

                         trait*sex        4     224       1.16    0.3283

SteveDenham
Jade | Level 19

I knew I was missing a design issue.  Temperature is a treatment effect applied randomly at sequential times.  That's important.  It means that temp is not a repeated factor.  It also means that you may not be capturing within subject correlation correctly for metabolic rate.  And last, and most importantly (at least to me), it is hard to wrap my head around metabolic rate and organ weights in a multivariate approach without defining "Sequence of applied temperatures" as a variable of interest.  With three temperatures, there are at most 6 sequences.  Now I would define trait as heart, liver, grow, etc, plus smr1, smr2 and smr3, all as an undefined R side matrix.  The hard part is fitting body mass in.  A separate analysis of smr with body mass as a covariate in a repeated measures in time design might be appropriate.

Anyway, throw out the code I suggested earlier with the Kronecker product, and try:

proc mixed data=yetanotherdataset;

class sequence sex trait id;

model score=sequence|sex|trait/solution noint;

repeated trait/subject=id type=un; /* you may have to go to a factor analytic covariance matrix to get this to work with this amount of data */

run;

Maybe this will run without the final Hessian problem, which I notice shows up in every output so far.  Estimating 15 coefficients with 78 data points should be doable though.

Then for the body mass and smr problem;

proc mixed data=stillanotherdataset;

where trait='smr';

class julienday sex temp id;

model sex|julienday|temp mass/solution /* You may need to examine the equal slopes assumption made here, especially with regard to sex */

random id;

repeated julienday/subject=id type=<this depends on the spacing of the days.  With only 3 timepoints, equally spaced, I would look at AR(1) and ARH(1)>;

lsmeans sex|julienday|temp;

run;

Steve Denham

fishhead
Calcite | Level 5

Hi

If i understand you correctly, u suggest we treat the across individual differences as r-side residuals, instead of gside, and treat each metabolism measures at each temp as a separate trait.

So, if i use this model:

proc mixed maxiter=100 method=reml covtest ;

  class id trait2 sex ;

       where trait2 in ('zsmr22' 'zsmr27' 'zsmr33' 'grow' 'intesti' 'liver' 'stomach' 'heart' )  ;

               model score = trait2 trait2*mass trait2*sex / noint solution   ;

   repeated trait2  / subject=id type=un rcorr ;

run;

Then i get this (edited down) output:

            

                                           Dimensions

                               Covariance Parameters            36

                               Columns in X                     32

                               Columns in Z                      0

                               Subjects                         78

                               Max Obs Per Subject               8

                   Iteration    Evaluations    -2 Res Log Like       Criterion

                           0              1      1236.65651524

                           1              4       580.46562888      0.00230689

                           2              1       579.79580628      0.00012298

                           3              1       579.76255875      0.00000053

                           4              1       579.76242042      0.00000000

                                    Convergence criteria met.

                              Estimated R Correlation Matrix for id 1

    Row       Col1       Col2       Col3       Col4       Col5       Col6       Col7       Col8

      1     1.0000   -0.03288    0.05073    -0.2411     0.1108    -0.1745    0.09822     0.2226

      2   -0.03288     1.0000     0.3456     0.1806     0.2789   -0.03436    0.02908     0.4050

      3    0.05073     0.3456     1.0000     0.4840     0.1841     0.1865     0.1581     0.4525

      4    -0.2411     0.1806     0.4840     1.0000   -0.01047     0.1267     0.3301     0.2697

      5     0.1108     0.2789     0.1841   -0.01047     1.0000     0.1202    -0.1200     0.3658

      6    -0.1745   -0.03436     0.1865     0.1267     0.1202     1.0000   -0.02654    0.01060

      7    0.09822    0.02908     0.1581     0.3301    -0.1200   -0.02654     1.0000    0.04925

      8     0.2226     0.4050     0.4525     0.2697     0.3658    0.01060    0.04925     1.0000

                                 Covariance Parameter Estimates

                                                   Standard         Z

                Cov Parm    Subject    Estimate       Error     Value        Pr Z

                UN(1,1)     id         0.000748    0.000127      5.88      <.0001

                UN(2,1)     id         -0.00085    0.003318     -0.26      0.7968

                UN(2,2)     id           0.9022      0.1619      5.57      <.0001

                UN(3,1)     id         0.000960    0.002463      0.39      0.6966

                UN(3,2)     id           0.2272     0.08847      2.57      0.0102

                UN(3,3)     id           0.4790     0.08551      5.60      <.0001

                UN(4,1)     id         -0.00489    0.002553     -1.92      0.0554

                UN(4,2)     id           0.1272     0.08845      1.44      0.1504

                UN(4,3)     id           0.2484     0.07028      3.53      0.0004

                UN(4,4)     id           0.5498     0.09223      5.96      <.0001

                UN(5,1)     id         0.006026    0.003945      1.53      0.1266

                UN(5,2)     id           0.3808      0.1451      2.62      0.0087

                UN(5,3)     id           0.3100      0.1058      2.93      0.0034

                UN(5,4)     id           0.1980      0.1118      1.77      0.0766

                UN(5,5)     id           0.9798      0.1589      6.16      <.0001

                UN(6,1)     id         0.000786    0.000869      0.90      0.3662

                UN(6,2)     id          0.06868     0.03312      2.07      0.0381

                                 

                                 Covariance Parameter Estimates

                                                   Standard         Z

                Cov Parm    Subject    Estimate       Error     Value        Pr Z

                UN(6,3)     id          0.03304     0.02360      1.40      0.1615

                UN(6,4)     id         -0.00201     0.02371     -0.08      0.9323

                UN(6,5)     id          0.09390     0.03800      2.47      0.0135

                UN(6,6)     id          0.06724     0.01168      5.76      <.0001

                UN(7,1)     id         -0.00192    0.001485     -1.29      0.1963

                UN(7,2)     id         -0.01312     0.04830     -0.27      0.7859

                UN(7,3)     id          0.05188     0.03709      1.40      0.1619

                UN(7,4)     id          0.03777     0.03614      1.05      0.2960

                UN(7,5)     id         0.004220     0.06473      0.07      0.9480

                UN(7,6)     id          0.01253     0.01419      0.88      0.3774

                UN(7,7)     id           0.1616     0.02667      6.06      <.0001

                UN(8,1)     id         0.001471    0.001859      0.79      0.4287

                UN(8,2)     id          0.01513     0.06443      0.23      0.8144

                UN(8,3)     id          0.05991     0.04706      1.27      0.2030

                UN(8,4)     id           0.1340     0.05014      2.67      0.0075

                UN(8,5)     id          0.02670     0.08283      0.32      0.7472

                UN(8,6)     id         -0.01704     0.01752     -0.97      0.3308

                UN(8,7)     id         -0.00584     0.02675     -0.22      0.8271

                UN(8,8)     id           0.2999     0.04909      6.11      <.0001

                           Null Model Likelihood Ratio Test

                                   DF    Chi-Square      Pr > ChiSq

                                   35        656.89          <.0001

                                    Solution for Fixed Effects

       Effect         trait2     sex    Estimate       Error      DF    t Value    Pr > |t|

       trait2         grow               -0.3306     0.03301      78     -10.02      <.0001

       trait2         heart              -1.8642      1.0857      78      -1.72      0.0900

       trait2         intesti            -6.1261      0.7638      78      -8.02      <.0001

       trait2         liver              -6.3726      0.8723      78      -7.31      <.0001

      trait2         stomach            -0.1802      0.1585      78      -1.14      0.2590

       trait2         zsmr22             -2.4600      0.3043      78      -8.09      <.0001

       trait2         zsmr27             -4.6424      0.5078      78      -9.14      <.0001

       trait2         zsmr33             -4.8471      0.6761      78      -7.17      <.0001

       mass*trait2    grow                0.3001     0.02096      78      14.32      <.0001

       mass*trait2    heart               1.1026      0.6775      78       1.63      0.1077

       mass*trait2    intesti             3.7744      0.4777      78       7.90      <.0001

       mass*trait2    liver               3.9293      0.5466      78       7.19      <.0001

       mass*trait2    stomach                  0           .       .        .         .

       mass*trait2    zsmr22              1.0173      0.1931      78       5.27      <.0001

       mass*trait2    zsmr27              2.7804      0.3205      78       8.68      <.0001

       mass*trait2    zsmr33              3.7533      0.4238      78       8.86      <.0001

       trait2*sex     grow       f      -0.00298    0.006293      78      -0.47      0.6374

       trait2*sex     grow       m             0           .       .        .         .

       trait2*sex     heart      f        0.1871      0.2172      78       0.86      0.3916

       trait2*sex     heart      m             0           .       .        .         .

       trait2*sex     intesti    f        0.1763      0.1576      78       1.12      0.2667

       trait2*sex     intesti    m             0           .       .        .         .

       trait2*sex     liver      f        0.1897      0.1697      78       1.12      0.2672

       trait2*sex     liver      m             0           .       .        .         .

       trait2*sex     stomach    f        0.3604      0.2242      78       1.61      0.1119

       trait2*sex     stomach    m             0           .       .        .         .

       trait2*sex     zsmr22     f      -0.07440     0.05960      78      -1.25      0.2157

       trait2*sex     zsmr22     m             0           .       .        .         .

       trait2*sex     zsmr27     f       0.07966     0.09218      78       0.86      0.3902

       trait2*sex     zsmr27     m             0           .       .        .         .

       trait2*sex     zsmr33     f       -0.1719      0.1249      78      -1.38      0.1728

       trait2*sex     zsmr33     m             0           .       .        .         .

                                  Type 3 Tests of Fixed Effects

                                         Num     Den

                         Effect           DF      DF    F Value    Pr > F

                         trait2            8      78      48.26    <.0001

                         mass*trait2       7      78      70.86    <.0001

                         trait2*sex        8      78       1.49    0.1737


Now, unfortunately i'm at a bit of loss of whether i can interpret the R corr matrix like a G corr matrix in this instance.  Is the diagonal of the R matrix effectively the across individual variances?


SteveDenham
Jade | Level 19

Well almost.  Since the RCORR and GCORR have 1's on the diagonal, I am going to assume you want RCOV and GCOV, and in this case, the diagonal elements of RCOV, starting with (1,1)=0.000748, is the variance of zsmr22, after removing all fixed effects in the model.  So, I would interpret this as the inter-subject variability of zsmr22.  You did say that all of these scores were standardized to (0, 1) variables, so I would say that at 22C there isn't much animal to animal variation in metabolic rate.

You may want to only scale the scores, so that they are all just zero centered, and re-run this.  The diagonal values then should look like true variances.

Steve Denham

fishhead
Calcite | Level 5

thanks again.  nearly there now.  although you say 1,1 is the variance of zsmr22, didn't you mean to say grow? (SAS seems to order alphabetically).  If SAS order this way, then the diagonal variances should be in same order as given in the fixed effects solution.

can mixed do a covtest of a particular covariance element, or do i have to go to glimmix to test whether particular covariances (correlations) are significant?  like, say i wanna know if 8,2 is significant?

SteveDenham
Jade | Level 19

You are right--it would be the variance due to grow not zsmr22, so throw out all that bs about metabolic rate at 22 that I had in a previous post.

Testing of individual variances or covariances is really tricky.  The p value in the Covariance Parameter Estimates table (from the covtest option) is a Wald type test that is really sensitive to normality assumptions.  You might be able to get after specific test by a likelihood ratio test.  If you restricted the parameter value to zero (and now we are back at the very beginning of this thread) and looked at the difference in -2 log likelihood, you should have a single degree of freedom chi squared test.

Or as you bring up, it's off to GLIMMIX.  Here is the code I would use to test if the variances are individually equal to zero:

proc glimmix ;

  class id trait2 sex ;

       where trait2 in ('zsmr22' 'zsmr27' 'zsmr33' 'grow' 'intesti' 'liver' 'stomach' 'heart' )  ;

               model score = trait2 trait2*mass trait2*sex / noint solution   ;

   random trait2  /residual subject=id type=un rcorr ;

covtest 'v1' general 1;

covtest 'v2' general 0 0 1;

covtest 'v3' general 0 0 0 0 0 1;

covtest 'v4' general 0 0 0 0 0 0 0 0 0 1; 

covtest 'v5' general 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1; 

covtest 'v6' general 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;   

covtest 'v7' general 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;  

covtest 'v8' general 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;; 

run;

You may want to add an ESTIMATE option on the COVTEST statements to see what the covariance estimates are under the null that the specified variance is zero--good for sensitivity analysis.

Steve Denham


fishhead
Calcite | Level 5

Yes, I was aware that covtest in Mixed is not great.

i tried your covtest statement in glimmix but they dont work.  i did successfully test covariances (not variances on the diagonal) using this 8x8 matrix and setting groups of covariances that logically cluster together to zero:

covtest

.                           

.    .                       

.    .    .                   

.    .    .    .               

.    .    .    .    .           

.    .    .    .    .    .       

.    .    .    .    .    .    .   

.    0    0    0    0    .    .    .

;

BUT, if i test any of the variances (diagonal elements) setting them to zero, it returns me no test, as shown here below:

                           Tests of Covariance Parameters
                            Based on the Restricted Likelihood

        Label           DF-2 Res Log Like  ChiSqPr > ChiSqNote

        Parameter list   1              .    .       .

Is this because a model without a given variance means any covariances with it must then also be zero, and so it screws with the test?  in other words, i cant test this?

thanks!

SteveDenham
Jade | Level 19

Not real sure on this one, but it may be worth trying the RESTART option on the COVTEST statements.  That would set the variance to zero at the start of the process rather than trying to backfit a zero into place.

Steve Denham

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 12 replies
  • 2191 views
  • 6 likes
  • 2 in conversation