# LSMestimate statement – you’ll think it’s cool

Jon Peltier and I were going back and forth on twitter about why it is that people will post answers on a forum or mailing list that are completely incorrect. As Peter Flom says, “They are often in error but never in doubt.”

Jon suggested there are three types; those who don’t know and admit it, those who don’t know they don’t know and those who know they don’t know but won’t admit it.

I’m going to be in the first type today and admit several things I did not know.

I have always hated the idea of custom hypotheses using the ESTIMATE or CONTRAST statements because they are a pain in the ass to do, but sometimes they just make sense. Essentially, any time your interest is not in whether “any of these cell means are different from any other”, the standard test, but whether one or more specific cell means are different than the others, than you want a CONTRAST or ESTIMATE statement.

First coolness thing about the LSMESTIMATE statement is that it is easier to write. Here (from the SAS documentation) is an example of the ESTIMATE statement replaced by LSMESTIMATE

```estimate 'AB12' intercept 1
a 1 0
b 0 1 0
a*b 0 1 0 0 0 0;
estimate 'avg ABij' intercept 6
a 3 3
b 2 2 2
a*b 1 1 1 1 1 1 / divisor=6;
estimate 'AB12 vs avg ABij' a 3 -3
b -2 4 -2
a*b -1 5 -1 -1 -1 -1 / divisor=6;```

Is replaced by

`       lsmestimate a*b 'AB12 vs avg ABij' -1 5 -1 -1 -1 -1 / divisor=6;`

Not only is it a lot less trouble to write, and, I think, to interpret, but, I have very bad vision. I wear nuclear-strength contacts to see past the end of my nose, glasses on top of them to read and enlarge everything on my screen 125% or more, so the odds of me typing something like the first several statements without making a mistake somewhere are very slim. It is very hard for me to tell of there is actually a space there or not, which is why I was very enthusiastic about the other syntax option for LSMESTIMATE.

Phil Gibbs, in a paper at the Denver SAS Users Group meeting, gave some very good examples of exactly when you would want to use custom hypotheses, for example if you thought one drug was more effective for disease A and a second drug was more effective for disease B, which seems a perfectly reasonable set of hypotheses, barring you are testing some incredible drug that cures all ills (according to my grandmother, one already exists and it is called rum).

Even better, he pointed out that you can use non-positional syntax where rather than listing all of the cells with zeroes for those you don’t want to contrast  you can just have the ones you are interested in, like this …

```LSMESTIMATE drug "drug pair 1,2 vs drug pair 3,4" [ 1,1] [ 1,2] [-1,3] [-1,4] / divisor=2;```

This isn’t all that new of a statement and I don’t know how I overlooked it when I came out. I was probably in a session where it was mentioned, didn’t have any use for it at the moment and just remembered how much I hated ESTIMATE and CONTRAST statements.

Most interesting to me was the fact that this paper was originally presented at PharmaSUG , which I have never attended because I haven’t done anything with pharmaceuticals in years (and no, I’m not referring to those parties in college).

Right before Phil spoke, Dr. Patrick Thornton had given a talk on ODS that he had presented at PharmaSUG. He mentioned that there is way more than just information of interest to the pharmaceutical industry there and you should check it out. Although he was not speaking to me personally, I did check it out and found that there really are a LOT of interesting papers presented there, and it is in San Francisco next year, right close to home, so I just might head up that way.