<?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: Weighted Least Square for Simple Linear Regression in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529913#M144867</link>
    <description>&lt;P&gt;It's fairly simple to do when you have replicates, as in your example data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Compute variance estimates of dependent variable Y for each value of X */
proc sql;
create table three as
select *,
    1/var(y) as invVar
from one
group by x;
quit;

/* Weighted regression */
proc reg data=three plots=all;
  model Y=X / p r clm cli influence;
  weight invVar;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 24 Jan 2019 23:12:40 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-01-24T23:12:40Z</dc:date>
    <item>
      <title>Weighted Least Square for Simple Linear Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529872#M144844</link>
      <description>&lt;P&gt;How do I run weighted least squares on the data below using PROC REG where the weights are chosen to account for unequal variances?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
  input X @;
  do i= 1 to 4;
   input Y @;
   output;
  end;
  drop i;
datalines;
2.5  7.5 9.5 8.0 8.5
5.0  11.0 12.0 9.0 10.0
7.5  11.0 16.0 12.5 14.0
10.0  16.5 14.5 21.5 19.0
;
run;


proc reg data=one plots=all;
  model Y=X / p r clm cli influence;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529872#M144844</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2019-01-24T21:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Least Square for Simple Linear Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529876#M144848</link>
      <description>&lt;P&gt;Use the WEIGHT statement in PROC REG.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_reg_syntax22.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_reg_syntax22.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529876#M144848</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-24T21:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Least Square for Simple Linear Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529885#M144852</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, what would my weight be with regard to this question? What variable do I use?</description>
      <pubDate>Thu, 24 Jan 2019 21:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529885#M144852</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2019-01-24T21:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Least Square for Simple Linear Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529887#M144853</link>
      <description>&lt;P&gt;I think this is all explained in the documentation.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;A WEIGHT statement names a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=" aa-argument"&gt;variable&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;in the input data set with values that are relative weights for a weighted least squares fit. If the weight value is proportional to the reciprocal of the variance for each observation, then the weighted estimates are the best linear unbiased estimates (BLUE).&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, for the VERY SIMPLE data set you provide, there is no such variable. You could compute the variance for each observation, and then make a new variable to use in the WEIGHT statement which is the reciprocal of the variance.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529887#M144853</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-24T21:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Least Square for Simple Linear Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529913#M144867</link>
      <description>&lt;P&gt;It's fairly simple to do when you have replicates, as in your example data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Compute variance estimates of dependent variable Y for each value of X */
proc sql;
create table three as
select *,
    1/var(y) as invVar
from one
group by x;
quit;

/* Weighted regression */
proc reg data=three plots=all;
  model Y=X / p r clm cli influence;
  weight invVar;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Jan 2019 23:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weighted-Least-Square-for-Simple-Linear-Regression/m-p/529913#M144867</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-24T23:12:40Z</dc:date>
    </item>
  </channel>
</rss>

