Programming the statistical procedures from SAS

Confidence bands for difference in lines

Reply
New Contributor
Posts: 2

Confidence bands for difference in lines

I am learning proc mixed. I have the following model:

proc mixed;

  class group;

  model post = group pre group*pre/ddfm=kr;

The interaction term is significant. How do I take a difference in the lines and construct a 95% confidence band around the difference?

Respected Advisor
Posts: 2,655

Confidence bands for difference in lines

Warning.  Untested code will follow.

I think you will need lsmeans statements that set the value of pre.  Something like:

proc mixed;

  class group;

  model post = group pre group*pre/ddfm=kr;

  lsmeans group/diff at pre=val1 cl adjdfe=row;

  lsmeans group/diff at pre=val2 cl adjdfe=row;

  lsmeans group/diff at pre=val3 cl adjdfe=row;

  lsmeans group/diff at pre=val4 cl adjdfe=row;

  lsmeans group/diff at pre=val5 cl adjdfe=row;

  ods output diffs=diffs;

run;

The dataset diffs should include the differences between all least squares means of group at various values (val1 through val5) of pre. Here I have variable names, but you really need the values at which you want to estimate the least squares means.  I include an ODS output statement, in case you want to plot the differences and their confidence limits.

Good luck.

Ask a Question
Discussion stats
  • 1 reply
  • 79 views
  • 0 likes
  • 2 in conversation