ods trace on /listing;
ods output estimates=stat1;
ods output FITSTATISTICS=stat2;
ods output LSMEANCL=stat3;
ods output OverallANOVA=stat4;
ods output LsmeandiffCL=stat5;
ods output LsmeanCL=stat6;
proc glm data=new1;
class trt;
model clnr=trt/ss1 ss2 ss3 ss4;
lsmeans trt/pdiff cl alpha=0.10;
estimate 'A vs B' trt 1 -1;
quit; run;
ods trace on /listing
ods output estimates=stat7;
ods output FITSTATISTICS=stat8;
ods output LSMEANCL=stat9;
ods output OverallANOVA=stat10;
ods output LsmeandiffCL=stat11;
ods output LsmeanCL=stat12;
proc glm data=newL1;
class trt;
model Lclnr=trt/ss1 ss2 ss3 ss4;
lsmeans trt/pdiff cl alpha=0.10;
estimate 'A vs B' trt 1 -1; quit;
The code was used to analyze the attached data set CLnr1. The outputs from stat6 and stat12 were compared which are the Lsmean CI.
Stat6
Obs Effect Dependent TRT LowerCL LSMean UpperCL 1 2
TRT | CLnr | A | 102.984141 | 114.620000 | 126.255859 |
TRT | CLnr | B | 38.763546 | 47.962500 | 57.161454 |
Stat12
Obs Effect Dependent TRT LowerCL LSMean UpperCL 1 2
TRT | LCLnr | A | 4.554136 | 4.732812 | 4.911488 |
TRT | LCLnr | B | 3.699795 | 3.841051 | 3.982307 |
The values of exp(lower CL) and exp(upper CL) give values for A (94-134) and B(40-53) which are close to the values for the normal scale.
However for stat5 for the difference on the normal scale I get:
bs Effect Dependent i j LowerCL Difference UpperCL TRT _TRT 1
TRT | CLnr | 1 | 2 | 51.824632 | 66.657500 | 81.490368 | A | B |
Whereas for stat 11 for the LClnr I get
s Effect Dependent i j LowerCL Difference UpperCL TRT _TRT 1
TRT | LCLnr | 1 | 2 | 0.663993 | 0.891761 | 1.119529 | A | B |
If I do the exp(lowerCL) and exp(UpperCL) I get (1.93-3.03) which is not in agreement with the normal scale.
Can someone explain to me why the normal scale and log scale agree for the CL for A and B but not for the difference between A and B for the normal and log scale?
On the log scale, Difference is an estimate of log(A) - log(B) = log(A/B)
So, EXP(Difference) is an estimate of the ratio A/B, not A - B.
I have used EXP(difference) which based upon your response is not correct.
Therefore my question is how should the log(A/B) ratio on the log scale be exponentiated to have it reflect the A-B difference on the Normal scale for the respective confidence intervals?
This is why it is a good idea to use GENMOD or GLIMMIX, so that results can be presented on both the transformed and original scale. PROC GLM just can't do that.
Steve Denham
I was able to get the CI on the log scale (see code below) by use of the command LRCI. How do I get the CI
m on the normal scale per your suggestion?
Proc genmod data=y;
class trt;
model lauc144=trt/lrci;
run;
Thisresolved the issue.
Thanks
When you take a log transform, you are now in the realm of the geometric distribution. Google
geometric mean site:sas.com
for lots of information on your question.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.