cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
tomparker
Level II

How to calculate regression slopes by subject in table with many subjects each measured at different ages?

Renal function is measured as Glomerular Filtration rate (GFR) and loss of function in renal disease is estimated as the (negative) slope of GFR by advancing age. In studies of kidney disease, it is often the objective to test for baseline predictors of the slope of GFR by age or time. The attached table shows typical data for 10 subjects with each having GFR measured at two or more ages. Can anyone suggest a method (using JMP10) to calculate the slope for each subject to produce a new table with SubjectID in column one and Slope in column two? Subsequent columns optionally may contain additional information about the fit. 

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to calculate regression slopes by subject in table with many subjects each measured at different ages?

You can use the Fit Y by X platform. Add GFR as Y, Age as X. Then in the bivariate report, select "Group By..." under the red triangle and select Patient before choosing "Fit Line" (also under the red triangle). Finally, right-click on any of the tables named "Parameter Estimates" and select "make combined data table" to make a table with all the slopes (the intercepts will be there too but are easy to sort out and delete).

The JSL version would be something like this:

dt = Data Table( "Sample_GFRbyAgebyPt.jmp" );

biv = dt << Bivariate( Y( :GFR ), X( :Age ), Group by( :Patient ), Fit Line( 1 ) );

slopes = Report( biv )["Parameter Estimates"][1] << make combined data table;

slopes << select where( :Term == "Intercept" ) << delete rows;

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to calculate regression slopes by subject in table with many subjects each measured at different ages?

You can use the Fit Y by X platform. Add GFR as Y, Age as X. Then in the bivariate report, select "Group By..." under the red triangle and select Patient before choosing "Fit Line" (also under the red triangle). Finally, right-click on any of the tables named "Parameter Estimates" and select "make combined data table" to make a table with all the slopes (the intercepts will be there too but are easy to sort out and delete).

The JSL version would be something like this:

dt = Data Table( "Sample_GFRbyAgebyPt.jmp" );

biv = dt << Bivariate( Y( :GFR ), X( :Age ), Group by( :Patient ), Fit Line( 1 ) );

slopes = Report( biv )["Parameter Estimates"][1] << make combined data table;

slopes << select where( :Term == "Intercept" ) << delete rows;

tomparker
Level II

Re: How to calculate regression slopes by subject in table with many subjects each measured at different ages?

Thanks MS: The script worked immediately and removed the intercept rows. After a couple of stumbles, I was able to get the same results using the JMP menus. The slopes agree with independent regression runs. Very Good.

TSP