<?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 WEIGHT statement gives incorrect LSmeans in proc HPMIXED--help! in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/WEIGHT-statement-gives-incorrect-LSmeans-in-proc-HPMIXED-help/m-p/541553#M27162</link>
    <description>&lt;P&gt;I have a set of data consisting of daily expenses for dairy cows for the first 4 years after they join the milking herd (at around 2 years of age).&amp;nbsp; My objective is to compare 2 different breeds of cows for these daily expenses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a problem with 1 expense variable, growing cost, which is all assigned on day 1 after first calving, so most cows have a cost of around $1,425 on day 1 with a range of roughly $900 to $1,800.&amp;nbsp; A value of $0 is assigned for every day of the rest of their lives (up to a max of 1461 days).&amp;nbsp; Some cows had short lifespans and so may only have 100 days of lifetime; therefore, 100 rows in the data.&amp;nbsp; Other cows lived all 4 years and so have 1461 rows, but again with only the growing cost on day 1.&amp;nbsp; I want to assign a weight to every day of each cow's life, such that these 2 example cows have equal weight in the analysis.&amp;nbsp; I did this simply by assigning dayweight=1/lifespan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I run "WEIGHT dayweight;" in the model, I get back least squares means that are way to high and nonsensical.&amp;nbsp; Here is my model statement code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc hpmixed data=have;&lt;BR /&gt;class herd breed sire;&lt;BR /&gt;model growcost=herd breed;&lt;BR /&gt;random sire(breed);&lt;BR /&gt;test herd breed/htype=3;&lt;BR /&gt;weight dayweight;&lt;BR /&gt;lsmeans herd breed/pdiff;&lt;BR /&gt;run;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My LSmeans without the weight statement make sense--Breed 1=$1.92 per day, Breed 2=$1.77 per day, and these very closely match the raw means.&lt;/P&gt;&lt;P&gt;However, with using the WEIGHT statement, I get Breed 1=$24.81 per day, and Breed 2=$16.50 per day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am doing wrong?&amp;nbsp; Thanks in advance for your suggestions!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 19:37:32 GMT</pubDate>
    <dc:creator>haze0025</dc:creator>
    <dc:date>2019-03-08T19:37:32Z</dc:date>
    <item>
      <title>WEIGHT statement gives incorrect LSmeans in proc HPMIXED--help!</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/WEIGHT-statement-gives-incorrect-LSmeans-in-proc-HPMIXED-help/m-p/541553#M27162</link>
      <description>&lt;P&gt;I have a set of data consisting of daily expenses for dairy cows for the first 4 years after they join the milking herd (at around 2 years of age).&amp;nbsp; My objective is to compare 2 different breeds of cows for these daily expenses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a problem with 1 expense variable, growing cost, which is all assigned on day 1 after first calving, so most cows have a cost of around $1,425 on day 1 with a range of roughly $900 to $1,800.&amp;nbsp; A value of $0 is assigned for every day of the rest of their lives (up to a max of 1461 days).&amp;nbsp; Some cows had short lifespans and so may only have 100 days of lifetime; therefore, 100 rows in the data.&amp;nbsp; Other cows lived all 4 years and so have 1461 rows, but again with only the growing cost on day 1.&amp;nbsp; I want to assign a weight to every day of each cow's life, such that these 2 example cows have equal weight in the analysis.&amp;nbsp; I did this simply by assigning dayweight=1/lifespan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I run "WEIGHT dayweight;" in the model, I get back least squares means that are way to high and nonsensical.&amp;nbsp; Here is my model statement code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc hpmixed data=have;&lt;BR /&gt;class herd breed sire;&lt;BR /&gt;model growcost=herd breed;&lt;BR /&gt;random sire(breed);&lt;BR /&gt;test herd breed/htype=3;&lt;BR /&gt;weight dayweight;&lt;BR /&gt;lsmeans herd breed/pdiff;&lt;BR /&gt;run;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My LSmeans without the weight statement make sense--Breed 1=$1.92 per day, Breed 2=$1.77 per day, and these very closely match the raw means.&lt;/P&gt;&lt;P&gt;However, with using the WEIGHT statement, I get Breed 1=$24.81 per day, and Breed 2=$16.50 per day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am doing wrong?&amp;nbsp; Thanks in advance for your suggestions!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 19:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/WEIGHT-statement-gives-incorrect-LSmeans-in-proc-HPMIXED-help/m-p/541553#M27162</guid>
      <dc:creator>haze0025</dc:creator>
      <dc:date>2019-03-08T19:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: WEIGHT statement gives incorrect LSmeans in proc HPMIXED--help!</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/WEIGHT-statement-gives-incorrect-LSmeans-in-proc-HPMIXED-help/m-p/541685#M27163</link>
      <description>&lt;P&gt;You say you have 100 records in the data if the cow lives 100 days. That doesn't make sense to me because&amp;nbsp;you also say that a cow might have GrowCost = 1200 for the first day but then you assign GFrowCost=0 for the other 99 days. That doesn't lead to a sound model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that none of your variables are changing during the life of a cow, so you should have one observation per cow and drop the weight variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to compute the daily cost per cow, you can add LifeSpan the data and model the&amp;nbsp;rate. See &lt;A href="http://support.sas.com/kb/24/188.html" target="_self"&gt;how to model rates in SAS.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2019 13:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/WEIGHT-statement-gives-incorrect-LSmeans-in-proc-HPMIXED-help/m-p/541685#M27163</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-03-09T13:10:19Z</dc:date>
    </item>
  </channel>
</rss>

