BookmarkSubscribeRSS Feed
samer_badri75
Quartz | Level 8
data d;
   input Day Temp RH;
   label Day = "Reaction Day (Hours)"
         Temp = "Temperature (Degrees Centigrade)"
         RH  = "Percent of humidity";
   datalines;

11	26	62
13	22	75
10	25	62
14	22	75
10	26	62
14	22	75
11	26	62
11	22	75
14	27	95
8	30	75
8	24	80
13	27	95
6	30	75
8	24	80
12	27	94
7	30	75
6	24	80
14	27	95
7	30	75
8	24	80


;
ods graphics on;
proc rsreg data=d plots=(ridge surface);
   model Day=RH Temp / lackfit;
   ridge max;
run;
ods graphics off;

Greeting All

I used rsreg in multiple regression to find which model is the best I got linear with 0.2825 R-Square and Quadratic 0.6200 R Square

Is there a way to write an equation based combine the linear model with the Quadratic?

Best regards

Samir

10 REPLIES 10
data_null__
Jade | Level 19

Isn't this what you're looking for?

 

Capture.PNG

samer_badri75
Quartz | Level 8

Hi sir,

Thanks for your response to my Q, I know this my question is can I wrote the equation based on linear and quadratic at the same time because that will make R -square and RMSE Low.

Day = 315.928-2.6139 RH -15.536 Temp + 0.0430 RH2 -0.1519 Temp*RH +0.5035 Temp2

This for the quadratic can I add the liner to it in one equation ?

Rick_SAS
SAS Super FREQ

I'm not sure I understand your question, but here are a few comments:

1. The ModelANOVA tables shows the Type 1 sums of squares for the linear, quadratic, and crossproduct (interaction) terms in the model. This seems to be the table from which you observed the statistics "linear with 0.2825 R-Square and Quadratic 0.6200 R Square."

2. The fact that the CorssProduct term (Temp*RH) term is not significant can also be seen in the ParameterEstimates table, which has a p-value of 0.1082 for the interaction term.

3. The question you ask is "Is there a way to write an equation based combine the linear model with the Quadratic?"  I'm not sure what you mean by this, but perhaps you are asking "what are the parameter estimates for the quadratic model that does not include the Temp*RH term?" If so, you can use PROC GLM to specify that model:

proc glm data=d ;*plots=(ridge surface);
   model Day=RH Temp RH*RH Temp*Temp / solution;
run;

 

samer_badri75
Quartz | Level 8

1.PNG

Thanks for your help

I used the code you apply which mean that we are dropping the non-sig, and the results showed that it was Quadratic if I am right, with high R-Sq and low RMSE

 

Y=427.163+(-4.317*RH)+(-19.83*Temp)+(0.0282 RH^2)+(0.352*Temp^2)

 
Rick_SAS
SAS Super FREQ

Yes. The formula you write is the correct interpretation of the GLM output.

samer_badri75
Quartz | Level 8

Many thanks, Sir

I have another issue related to multiple linear regresstion which was high R-Squ but the model non-sig and both Temp and RH were non-sig too, I know the sample size was very small. Can I write the equation and used it in this case.

 

Best regards

 

Rick_SAS
SAS Super FREQ

I cannot give advice without seeing the parameter estimates.

samer_badri75
Quartz | Level 8
options pageno=1 linesize=80;
goptions reset=all;
title "Multiple regression for shelf_life";
data  shelf_life;
input  Temp   RH    Days;
	datalines;

10	94	65
10	93	51
10	94	70
9	93	78


	;
	run;
* Print data set;
proc print data= shelf_life;
run;
* Plot y vs. x variables;
proc gplot data=shelf_life;
	plot Days*(Temp   RH  );
	symbol1 i=rl v=star c=black;
	run;
* Multiple regression analysis;
ods html;
ods graphics on;
proc reg data=shelf_life;
	* Specify regression model and request residual-residual plots;
	model Days = Temp RH  / clb stb partial tol selaction=RSquare;
	run;
	Plot r.*pred. r.*nqq.;
run;
quit;
proc reg data=shelf_life;
	* Specify regression model and request residual-residual plots;
	model Days = Temp / clb stb partial tol selaction=RSquare;
	run;
ods graphics off;
ods html close;
quit;

Sorry for that i add the code

Rick_SAS
SAS Super FREQ

 Can I write the equation and used it in this case.

 

No. With only four observations, the estimates in your model are not significantly different from 0. You would need to gather more data before you could claim that Days depend on Temp or RH.

samer_badri75
Quartz | Level 8

I understand that.

The data were based on low temp which was just 4 points and high temp. When I was plotting a 3D for all the data which was linear it showed in 3D not linear, then I divided into two groups. 222.PNG

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 1278 views
  • 2 likes
  • 3 in conversation