DATA :
response variable (Y) : biological marker , quantitative continuous
Predictor variable (X) : Time variable , quantitative continuous
Procedure used:
Linear regression model (Proc Reg) : Y=X
Dear community,
I would like to output a graph presenting the sum square residuals (between the linear regression model and the data set) on the Y axis and the Time variable on the X axis in order to determine visually the minimum residual sum of squares and its respective Time (x)
Or alternatively, calculate the Timevar x corresponding to the minimum residuals sum of squares.
Can you help me with the procedure to use ?
Thanks in advance for your help.
HaddadMez
@HaddadMez wrote:
DATA :
response variable (Y) : biological marker , quantitative continuous
Predictor variable (X) : Time variable , quantitative continuous
Procedure used:
Linear regression model (Proc Reg) : Y=X
Dear community,
I would like to output a graph presenting the sum square residuals (between the linear regression model and the data set) on the Y axis and the Time variable on the X axis in order to determine visually the minimum residual sum of squares and its respective Time (x)
Or alternatively, calculate the Timevar x corresponding to the minimum residuals sum of squares.
The sum of squares of the residuals is a single number. Do you really want to plot a single number?
This sum of squares of the residuals does not vary by X. So your quest to find the timevar x corresponding to the minimum sum of squares also does not make sense.
Dear PaigeMiller,
Thank you for your reply.
My goal is to apply a 2 piecewise linear regression model (left graph on the joint picture) to the Data presented in the previous mail. In order to estimate the Timevar (x value) corresponding to the changepoint, I wanted to adopt the same approach as the one used in the article referred below.
Approach : estimate a changepoint by minimizing the residuals sum of squares (cf right graph in the picture).
If the residuals sum of square is a single number and does not vary depending on x values, I misinterpreted the figure 1. Do you think they have calculated the residuals sum of squares values for models with different changepoints and selected the one with the lowest residuals sum of squares value?
If so, do you have an idea how to reproduce it with SAS?
Thank you again for your help and guidance.
HaddadMez
article reference :
If your goal is to produce a model using "piecewise linear regression splines" ... Google finds lots of examples of doing this, that's really where you should start.
Here's a blog post from @Rick_SAS that gives an example.
The data for figure 1 are generated by fitting models with the change point successively incremented from -0.5 to 1.0, probably by a step size of 0.01, and keeping the RSS in a dataset for future plotting vs. change point values. At each possible change point (-0.50, -0.49, -0.48...0.98, 0.99, 1.00) the model is fit and a single residual sum of squares is obtained. Since it appears that the model is linear with normal residuals, this is the same as plotting the residual standard deviation against the change point. It is a lot of work for one graph, and a maximum likelihood optimizer (as in NLIN or NLMIXED) should find a similar value (unless the starting value was around 0.66 where there is a local minimum).
SteveDenham
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.