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

I am learning to proc mixed. So my following question is hypothetical and any help is appreciated:

Supposed that I am comparing three age different un-equal groups of runners who ran with different shoe types and would like to see if they are significantly different in terms of their speed.

Then, my data can have the following variables: subj_id, group name, shoe type, speed of running.

 

proc mixed data=temp;

class subj_id group_name shoe_type;

model speed_of_running= group_name shoe_type group_name*shoe_type;

random subj_id;

run;

 

I have the following questions:

  • Is my syntax above correct for this application? Do I need to randomize subj_id?
  • Can I alter proc mixed so that I can see if each group is also different? For instance, if I have three groups of A, B, and C, can I make changes to see if A and B are different, B and C are different, A and C are different.
  • Can I alter proc mixed to see which group ran faster on average?

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Pr>|t| indicates if the statistical test for the hypothesis that estimate for that LSMEAN is equal to zero. The standard interpretation is that when this value is less than 0.05, then the estimate is not equal to zero. For group AM, the LSMEAN is 5.5424, which according to this statistical test, it is significantly different than 0.


To compare group A to group B, use

 

lsmeans group_name/lines;

I see in the documentation, there is no lines option in PROC MIXED, but there is one in PROC GLIMMIX, which for this design and analysis ought to give the same results as PROC MIXED.

 

 

--
Paige Miller

View solution in original post

8 REPLIES 8
PaigeMiller
Diamond | Level 26

You didn't really explain the design of your study, and I would need to know that to determine if your code is correct. So please explain the design of your study, so we can understand how subjects get assigned to groups and shoe_types and how often they run once assigned.

 

Specifically, does each subject_id run and is timed a single time? Or does each subject_id run and is timed more than once? Does each subject_id wear different shoe types throughout the study? I assume each subject can only appear in one group.

 

With regards to your last two bullet items, the LSMEANS statement will compute the means for you and do statistical testing, so that you can compare groups and compare shoe types.

--
Paige Miller
HBa
Fluorite | Level 6 HBa
Fluorite | Level 6

Thank you PaigeMiller

Let's consider that i have 35 subjects in the three unequal groups. the subject_id variable goes from 1 to 35. All subjects run 5 minutes with each of the shoe types while i measure their speed. For instance, it can be running bare feet, sport shoe and dress shoe. the order of shoe type for each subject is randomly assigned. so, technically, each subject can only appear in one group but is tested three times for the three conditions of shoe type.

 

PS:can you also tell me how the code would have been different if

a- each test was repeated three times. i.e. each subject belongs to one of the three age groups but runs 9 times (three times with each shoe).

 

b- can you also tell my how the code would have been different if the subject appeared in more than one group. For instance if my test groups instead of being different in age, they were the same subject by were were tested before and after having breakfast, or were tested morning, afternoon and night)

PaigeMiller
Diamond | Level 26

It seems to me then that you want this RANDOM statement

 

random subj_id(group_name);

since subject_id is nested within group_name.

--
Paige Miller
HBa
Fluorite | Level 6 HBa
Fluorite | Level 6

So when i use lsmeans, waht does the p value referes to? 

So if i have gorups A, B and C and i include a statement lsmean(group_name), i get something like the following: 

 

Effect                  Group_name      Estimate Error DF t Value Pr > |t|

Group_name              A               .......

 

Is the p value refering to the difference in mean of A as compared to all other groups?

thanks

 

PaigeMiller
Diamond | Level 26

Please show us the actual code used, and the actual table produced by that code.

--
Paige Miller
HBa
Fluorite | Level 6 HBa
Fluorite | Level 6

 

proc mixed data=temp;

class subj GROUP ShoeType ;

model SPEED= GROUP ShoeType GROUP*ShoeType ;

random subj (GROUP);

lsmeans GROUP;

run;

 

 

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

 

Kdisart YA                                              10:25 Monday, January 27, 2020  22

 

The Mixed Procedure

 

                  Model Information

 

Data Set                     WORK.TEMP

Dependent Variable           SPEED

Covariance Structure         Variance Components

Estimation Method            REML

Residual Variance Method     Profile

Fixed Effects SE Method      Model-Based

Degrees of Freedom Method    Containment

 

 

             Class Level Information

 

Class    Levels    Values

 

subj        26    3 4 5 7 8 9 10 11 12 13 15 16

                   17 19 20 21 22 23 24 25 26 27

                   29 30 31 32

GROUP           3    AM OA YA

ShoeType          3    1 2 3

 

 

            Dimensions

 

Covariance Parameters             2

Columns in X                     16

Columns in Z                     26

Subjects                          1

Max Obs per Subject             234

 

 

          Number of Observations

 

Number of Observations Read             234

Number of Observations Used             234

Number of Observations Not Used           0

 

 

                     Iteration History

 

Iteration    Evaluations    -2 Res Log Like       Criterion

 

        0              1      1001.35302689

        1              1       954.65672525      0.00000000

 

 

                   Convergence criteria met.

 

 

 Covariance Parameter

       Estimates

 

Cov Parm       Estimate

 

subj(GROUP)       1.5245

Residual         3.0052

 

 

           Fit Statistics

 

-2 Res Log Likelihood           954.7

AIC (Smaller is Better)         958.7

AICC (Smaller is Better)        958.7

BIC (Smaller is Better)         961.2

 

 

        Type 3 Tests of Fixed Effects

 

              Num     Den

Effect         DF      DF    F Value    Pr > F

 

GROUP             2      23       1.09    0.3540

ShoeType            2     202      13.11    <.0001

GROUP*ShoeType        4     202       2.78    0.0280

 

 

                        Least Squares Means

 

                             Standard

Effect    GROUP    Estimate       Error      DF    t Value    Pr > |t|

 

GROUP       AM       5.5424      0.5565      23       9.96      <.0001

GROUP       OA       5.4719      0.4311      23      12.69      <.0001

GROUP       YA       4.6901      0.4311      23      10.88      <.0001

 

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

I also receive the following when I type lsmeans GROUP*ShoeType

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

 

 

                                 Least Squares Means

 

                                               Standard

Effect      GROUP    ShoeType            Estimate       Error      DF    t Value    Pr > |t|

 

GROUP*ShoeType    AM                1      4.7795      0.6489     202       7.37      <.0001

GROUP*ShoeType    AM                2      5.9108      0.6489     202       9.11      <.0001

GROUP*ShoeType    AM                3      5.9370      0.6489     202       9.15      <.0001

GROUP*ShoeType    OA                1      5.3605      0.5026     202      10.67      <.0001

GROUP*ShoeType    OA                2      4.8596      0.5026     202       9.67      <.0001

GROUP*ShoeType    OA                3      6.1958      0.5026     202      12.33      <.0001

GROUP*ShoeType    YA                1      3.6963      0.5026     202       7.35      <.0001

GROUP*ShoeType    YA                2      4.3853      0.5026     202       8.72      <.0001

GROUP*ShoeType    YA                3      5.9887      0.5026     202      11.92      <.0001

PaigeMiller
Diamond | Level 26

Pr>|t| indicates if the statistical test for the hypothesis that estimate for that LSMEAN is equal to zero. The standard interpretation is that when this value is less than 0.05, then the estimate is not equal to zero. For group AM, the LSMEAN is 5.5424, which according to this statistical test, it is significantly different than 0.


To compare group A to group B, use

 

lsmeans group_name/lines;

I see in the documentation, there is no lines option in PROC MIXED, but there is one in PROC GLIMMIX, which for this design and analysis ought to give the same results as PROC MIXED.

 

 

--
Paige Miller
HBa
Fluorite | Level 6 HBa
Fluorite | Level 6

Thank you for your response. so, if variable "YOA" refers to the three groups that are called AM, OA and YA and variable "cond" refer to the condition (e.g. shoe type) and include conditions 1, 2 and 3. when i include lsmeans YOA*cond/lines; in my codes, i see the following: 


T Grouping for YOA*cond Least Squares Means (Alpha=0.05)

LS-means with the same letter are not significantly different.

YOA condEstimate   
      
OA315.9907 A 
    A 
OA114.4178BA 
   BA 
OA213.7219BA 
   BA 
AM213.2346BA 
   BA 
AM312.613BA 
   BA 
AM111.5453BAC
   B C
YA310.5709B C
     C
YA17.4639  C
     C
YA27.0647  C

 

does this mean that under condition 3 (i.e. the same shoe type),  OA and AM were not different?  also, AM conditions  1 and 2 were significantly different? In other words, which column do I have to look at?  

thanks

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 8 replies
  • 1437 views
  • 0 likes
  • 2 in conversation