Greeting All
I used the code I attached and I got the 3D surface, the problem is it starts from -40 t0 40, while in the real data the minimum day was 5,
Who can I make the plot start from 5 and Up
Thanks
data d;
input Day Temp RH ;
label Day = "Reaction Day (Hours)"
Temp = "Temperature (Degrees Centigrade)"
RH = "Percent of humidity";
datalines;
26 10 90
26 10 90
26 10 90
26 10 90
24 10 90
22 10 90
22 10 90
27 10 90
13 22 76
7 22 75
12 22 75
13 22 75
17 22 75
17 22 75
8 22 75
8 22 75
14 24 78
14 24 78
12 24 78
15 24 78
15 24 78
12 24 77
10 24 76
10 24 76
5 25 63
11 26 62
11 26 62
11 26 62
10 26 62
10 26 62
15 26 94
26 26 94
20 26 94
22 26 94
15 26 63
8 26 62
20 26 94
20 26 94
16 27 94
14 27 95
7 29 66
8 30 69
7 30 74
10 30 74
10 30 74
10 30 74
10 30 74
10 30 74
;
ods graphics on;
proc print data=d;
proc rsreg data=d plots=(ridge surface);
model Day=RH Temp / lackfit;
ridge max;
run;
proc rsreg data=d
plots =surface(3d);
model Day = Temp RH;
ods select 'Temp * RH = Pred';
run;
ods graphics off;1.PNG
Here are a few of my thoughts about this topic:
By using these ideas and the associated SAS code, you can truncate the surface or contour plot, as you requested.rsreg2.png
You are plotting the PREDICTED surface, which is not constrained by the range of the data. The predicted surface is evaluated on a rectangular regions [min(RH), max(RH)] x [min(Temp), max[Temp)], and this model has a minimum predicted value when (RH, Temp) are both small.
By default, PROC RSREG extends the rectangular domain by 10% beyond the range of the data. You can use the EXTEND=0 option to tell it not to extrapolate beyond the data range. The code would look like this:
proc rsreg data=d plots=(ridge surface(EXTEND=0));
model Day=RH Temp / lackfit;
ridge max;
run;
proc rsreg data=d plots =surface(3d EXTEND=0);
model Day = Temp RH;
ods select 'Temp * RH = Pred';
run;
You have another option, which you might prefer. The steps are:
1. Score the model on a regular grid and use the OUT= option to write the predicted values to a data set.
2. Use a DATA step to set the predicted values to missing when the predicted values are less than zero (or 5, if you prefer)
3. Use PROC SGRENDER to generate the surface plot. Only the nonmissing predicted values will be displayed as part of the surface.
Hi Rick
Many thanks for your help, I used the code you apply, it makes a small difference, but still start from below the 0.
1.PNG
2.PNG
Here are a few of my thoughts about this topic:
By using these ideas and the associated SAS code, you can truncate the surface or contour plot, as you requested.rsreg2.png
Greeting Rick
Is there a chance to optimize three variables by adding a code for that?
Best regards
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.
Ready to level-up your skills? Choose your own adventure.