<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reproducing stderr of difference of lsmeans in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69763#M3373</link>
    <description>Ok I figured out how to get it.  Really simple too.  Instead of li and lj I needed L=li-lj and then do  Sij^2=MSE*L'*inv(X'X)*L&lt;BR /&gt;
&lt;BR /&gt;
Have a nice weekend.</description>
    <pubDate>Fri, 19 Mar 2010 21:33:10 GMT</pubDate>
    <dc:creator>RickM</dc:creator>
    <dc:date>2010-03-19T21:33:10Z</dc:date>
    <item>
      <title>Reproducing stderr of difference of lsmeans</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69762#M3372</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I am trying to reproduce lsmeans from proc GLM in R and with the help of the online docs and through matrix algebra I can recreate everything but the standard error of the difference of lsmeans.&lt;BR /&gt;
&lt;BR /&gt;
From the SAS doc:&lt;BR /&gt;
for LS-means defined by the linear combinations li'b and lj'b of the parameter estimates, Sij^2=MSE*li'*inv(X'X)*lj&lt;BR /&gt;
&lt;BR /&gt;
This is giving me a negative number.  &lt;BR /&gt;
&lt;BR /&gt;
For balanced data I could get the standard error by taking the square root of the sum of the variances (or sqrt(2)*se of the individual lsmean) but most of the time my data will be unbalanced so this does not hold.&lt;BR /&gt;
&lt;BR /&gt;
Is there a nice closed form of the relationship between the se for individual lsmeans and their contrasts?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help,&lt;BR /&gt;
Rick

Message was edited by: RickM</description>
      <pubDate>Fri, 19 Mar 2010 19:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69762#M3372</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-03-19T19:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reproducing stderr of difference of lsmeans</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69763#M3373</link>
      <description>Ok I figured out how to get it.  Really simple too.  Instead of li and lj I needed L=li-lj and then do  Sij^2=MSE*L'*inv(X'X)*L&lt;BR /&gt;
&lt;BR /&gt;
Have a nice weekend.</description>
      <pubDate>Fri, 19 Mar 2010 21:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69763#M3373</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-03-19T21:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reproducing stderr of difference of lsmeans</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69764#M3374</link>
      <description>Yes, because using the vector li on the left and lj on the right of inv(X'X) just returns the covariance of the two lsmeans that are obtained from li*beta and lj*beta.  But the standard error of the difference is the sum of the variances of the lsmeans minus 2 times the covariance of the lsmeans.  By using the matrix L, you get all the necessary terms for computing the variance of the difference.</description>
      <pubDate>Fri, 19 Mar 2010 22:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Reproducing-stderr-of-difference-of-lsmeans/m-p/69764#M3374</guid>
      <dc:creator>Dale</dc:creator>
      <dc:date>2010-03-19T22:59:06Z</dc:date>
    </item>
  </channel>
</rss>

