BookmarkSubscribeRSS Feed
HaddadMez
Calcite | Level 5

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

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
HaddadMez
Calcite | Level 5

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?

 

Green Piecewise Linear Regression.JPGIf so, do you have an idea how to reproduce it with SAS?

 

Thank you again for your help and guidance. 

HaddadMez

 

article reference : 

Greene, M.E., Rolfson, O., Garellick, G., Gordon, M., Nemes, S., 2015. Improved statistical analysis of pre- and post-treatment patient-reported outcome measures (PROMs): the applicability of piecewise linear regression splines. Qual Life Res 24, 567–573. https://doi.org/10.1007/s11136-014-0808-3
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
SteveDenham
Jade | Level 19

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 586 views
  • 2 likes
  • 3 in conversation