## proc mixed /diff; Differences of Least Squares Means output specification

Solved
Occasional Contributor
Posts: 12

# proc mixed /diff; Differences of Least Squares Means output specification

[ Edited ]

Hello SAS board,

I am using the code below to analyse our 3x2x2 within-subject experiment. Everything works great. The question is whether Standard Error from the  " Differences of Least Squares Means" table refers to standard error of mean of the difference?  For example, if I am looking at the comparison :

Visibility (level 1) Globality (level 1) Congruency (level 1) vs. Visibility (level 1) Globality (level 1) Congruency (Level 2

the t value in the table comes from the (paired sample) t test for these two conditions? And then the SE is calculated for the difference between the two conditions?

``````PROC mixed ;
CLASS visibility sub globality congruency ;
MODEL rt= visibility|globality|congruency ;
Repeated /subject=sub type=cs;
LSMeans globality|congruency|visibility/diff cl;
run; quit;``````

I need to know this, because I have to plot figures with error bars representing standard error of mean corrected for the within-subject design.

I will greatly appreciate your feedback and time!

Dina.

Accepted Solutions
Solution
‎02-05-2018 02:19 AM
PROC Star
Posts: 404

## Re: proc mixed /diff; Differences of Least Squares Means output specification

In a mixed design, the standard error (SE) of a mean will include all sources of variance (block, whole plot, subplot, etc.). Consequently figures depicting the mean and SE may appear to be inconsistent with results from statistical analysis, which control for variance sources.

The difference between two means will "be adjusted for" some sources of variance, depending on which two means are compared. The classic text by Cochran and Cox (Experimental Design, 2nd ed) describes the mathematics nicely (I think in the chapter on split-plot designs, but I don't have my copy at hand to check); I'm sure the same information is available in other design texts. That's why you see different SEs for different pairwise comparisons.

You may be confusing "pairwise" mean comparisons with "paired t-test", which is the point that @StatsMan and @PaigeMiller are making. A pairwise comparison of means can be done in conjunction with any experimental design. A paired t-test corresponds to a specific experimental design. Not the same thing.

I hope this helps.

All Replies
SAS Employee
Posts: 27

## Re: proc mixed /diff; Differences of Least Squares Means output specification

The SE's in the LS-means table are the standard errors for the individual ls-means.  The SE's in the Differences of LS-means table are the standard errors for the differences of the ls-means.

The p-values in the Differences table are the p-values for the test of the difference in each pair of ls-means reported.  Nothing is paired, just comparison of means.

Occasional Contributor
Posts: 12

## Re: proc mixed /diff; Differences of Least Squares Means output specification

Just to make sure I got this. Are the t tests from the " Differences of
Least Squares Means" table paired t tests?
Many thanks,
Dina.
Posts: 3,055

## Re: proc mixed /diff; Differences of Least Squares Means output specification

Nothing is paired in this analysis.

--
Paige Miller
Solution
‎02-05-2018 02:19 AM
PROC Star
Posts: 404

## Re: proc mixed /diff; Differences of Least Squares Means output specification

In a mixed design, the standard error (SE) of a mean will include all sources of variance (block, whole plot, subplot, etc.). Consequently figures depicting the mean and SE may appear to be inconsistent with results from statistical analysis, which control for variance sources.

The difference between two means will "be adjusted for" some sources of variance, depending on which two means are compared. The classic text by Cochran and Cox (Experimental Design, 2nd ed) describes the mathematics nicely (I think in the chapter on split-plot designs, but I don't have my copy at hand to check); I'm sure the same information is available in other design texts. That's why you see different SEs for different pairwise comparisons.

You may be confusing "pairwise" mean comparisons with "paired t-test", which is the point that @StatsMan and @PaigeMiller are making. A pairwise comparison of means can be done in conjunction with any experimental design. A paired t-test corresponds to a specific experimental design. Not the same thing.

I hope this helps.

Occasional Contributor
Posts: 12

## Re: proc mixed /diff; Differences of Least Squares Means output specification

I want to thank everyone who contributed to the discussion!

As we have a within-subject design, I thought it was the case of paired t-test.

Many thanks for the clarification,

Dina.

PROC Star
Posts: 404

## Re: proc mixed /diff; Differences of Least Squares Means output specification

A paired t-test is a within-subjects design, so you are right on that point. But it has only one fixed effects factor with two levels and so only one comparison. Your scenario is more complicated, and the stat model cannot be a paired t-test.

☑ This topic is solved.