<?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 How can I output predicted values and residuals from two ANOVA at the same time? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945749#M47274</link>
    <description>&lt;P&gt;Hello, I am using SAS Studio Release 3.81.&lt;/P&gt;&lt;P&gt;I'm learning basic SAS procedures for the first time. One of the methods is Two-Way ANOVA and now checking the model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For running the Two-Way ANOVA I use this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc anova data=athlete;
	class lifestyle sex;
	model systolic diastolic = lifestyle sex lifestyle*sex;
	means lifestyle sex / duncan lines;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This particular model has two different responses, and this code gives me the ANOVA for each of the models.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For model diagnostics, the book I'm using recommends this procedure:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc glm data=athlete;
	class lifestyle sex;
	model systolic = lifestyle sex lifestyle*sex;
	output out=systolic p=yhat student=resid;
title1 'Two-Way ANOVAs for Lifestyle BP Study';
run;

proc gplot data=systolic;
	plot resid*yhat / vref = 0;
	title2 'Resid vs Y-hat';
	
	plot resid*lifestyle / vref = 0;
	title2 'Resid vs Lifestyle';
	
	plot resid*sex / vref = 0;
	title2 'Resid vs Sex';
run;

proc univariate data = systolic normal;
	var resid;
	probplot resid / normal (mu = est sigma = est) square;
	title2 'Normal Test of Residuals';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would then have to run this again for the diastolic response. The issue I'm having is that I can only run the diagnostics for one response at a time. The proc glm step only outputs one set of predicted yhat and residuals for the first predictor listed. Is there a way to output the predicted values and residuals for each response variable in the proc glm?&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2024 03:40:58 GMT</pubDate>
    <dc:creator>kevinbu</dc:creator>
    <dc:date>2024-10-01T03:40:58Z</dc:date>
    <item>
      <title>How can I output predicted values and residuals from two ANOVA at the same time?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945749#M47274</link>
      <description>&lt;P&gt;Hello, I am using SAS Studio Release 3.81.&lt;/P&gt;&lt;P&gt;I'm learning basic SAS procedures for the first time. One of the methods is Two-Way ANOVA and now checking the model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For running the Two-Way ANOVA I use this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc anova data=athlete;
	class lifestyle sex;
	model systolic diastolic = lifestyle sex lifestyle*sex;
	means lifestyle sex / duncan lines;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This particular model has two different responses, and this code gives me the ANOVA for each of the models.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For model diagnostics, the book I'm using recommends this procedure:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc glm data=athlete;
	class lifestyle sex;
	model systolic = lifestyle sex lifestyle*sex;
	output out=systolic p=yhat student=resid;
title1 'Two-Way ANOVAs for Lifestyle BP Study';
run;

proc gplot data=systolic;
	plot resid*yhat / vref = 0;
	title2 'Resid vs Y-hat';
	
	plot resid*lifestyle / vref = 0;
	title2 'Resid vs Lifestyle';
	
	plot resid*sex / vref = 0;
	title2 'Resid vs Sex';
run;

proc univariate data = systolic normal;
	var resid;
	probplot resid / normal (mu = est sigma = est) square;
	title2 'Normal Test of Residuals';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would then have to run this again for the diastolic response. The issue I'm having is that I can only run the diagnostics for one response at a time. The proc glm step only outputs one set of predicted yhat and residuals for the first predictor listed. Is there a way to output the predicted values and residuals for each response variable in the proc glm?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 03:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945749#M47274</guid>
      <dc:creator>kevinbu</dc:creator>
      <dc:date>2024-10-01T03:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I output predicted values and residuals from two ANOVA at the same time?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945756#M47276</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=sashelp.heart;
	class status sex;
	model systolic diastolic = status|sex;
	output out=want p=yhat yhat2 student=resid resid2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Oct 2024 06:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945756#M47276</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-10-01T06:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I output predicted values and residuals from two ANOVA at the same time?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945794#M47277</link>
      <description>&lt;P&gt;Yes, thank you that works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In case anyone after me is curious, I found an example of this in the documentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_glm_details65.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_glm_details65.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 15:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-output-predicted-values-and-residuals-from-two-ANOVA/m-p/945794#M47277</guid>
      <dc:creator>kevinbu</dc:creator>
      <dc:date>2024-10-01T15:02:14Z</dc:date>
    </item>
  </channel>
</rss>

