cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Augustin
Level I

How to Compare Slopes (to each other - not to the mean slope) in linear modeling

Hi everyone, @martindemel 

in JMP 18.0.1, I am launching a linear model :

Y ~ X1 * X2

Where :

- Y is the continuous response

- X1 is a continuous regressor

- X2 is a categorical regressor (3 categories named "A", "B", "C")

Some people call this model an ANCOVA

 

From this I get :

an intercept and a slope (over X1) per categories of X2., like in the following graphic:

Augustin_0-1730976305132.png

 

I would like to compare these slopes against each other in a paire-wise manner.

like so (done in R 4.2.2

library(emmeans)

pairs(emtrends(lm(Y ~ X2 * X1, data = df), ~ X2, var="X1"))

contrast estimate     SE df t.ratio p.value
 A - B       0.211 0.0616 54   3.431  0.0033
 A - C      -1.721 0.0616 54 -27.934  <.0001
 B - C      -1.932 0.0616 54 -31.365  <.0001

P value adjustment: tukey method for comparing a family of 3 estimates 

 

For now, in JMP I only found ways to do very close things but not exactly what I want :

1. Fit model appraoch: Compare Slopes with Overall Average

--> Red Triangle / estimates / Compare slopes

This compares each slope to the avergage slope (with a Nelson adjustment)

image.png

 

 

2. Fit curve approach: Equivalence Test Results

--> red triangle (from linear fit) / Equivalence test

This approach performs pairwise (accross categories of X2) equivalence tests for each parameters of the fit. here, there are only 2 paramters, the intercept and the slope.

 

image.png

 

 

Conclusion and final question :

I know there are multiple ways to decide whether one slope is different from the others. But I am looking for the specific approach of pairewise comparison between slopes (same as performable in R, see above).

 

Description of the attachements :

- data.xlsx = Excel file of the data (simulated data)

- Compare_slopes_example.jmp =  JMP table, with the data from data.xlsx and the fit model, fit curve analyses saved to it.

 

I thank you very much for your help !
Have a nice day = )

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

great add @MRB3855 
From the post I understood that the custom test should be set up like that (where the first three columns are not necessary but show what @Mark_Bailey described in his answer:

martindemel_0-1731082326260.png

 

/****NeverStopLearning****/

View solution in original post

7 REPLIES 7
dlehman1
Level V

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

I think you want to use the Fit model platform using X1, X2, and X1*X2 (cross effect) as factors.  That allows both the slopes and intercepts to vary and I believe provides all the information needed to statistically compare the slopes and intercepts with both the averages and each other.  Somebody with a more complete statistical background can probably suggest exactly where to look for that information.

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

Yes, @dlehman1 is correct. With the model he specified, the test of X2 will tell you if the intercepts of the three lines are different. The test of the interaction will tell you if the slopes are different. To understand why, look at the Prediction Equation of this model and you can see how the X2 parameter is an adjustment to the intercept while the X1*X2 parameter is an adjustment to the X1 slope.

Dan Obermiller

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

Hi, I found another thread which discusses this question in more detail. They address as far I can see that you do not just want t understand if there is a difference in the slopes but what difference in each comparison. 

Comparison of Slopes 

 The one approach is kind of manual approach taking each level as a reference (using value order for the levels) and fit a model, the other one is using the  nonlinear fit. @julian has also created an add-in it seems (to be found in the thread as well), however I'm not sure how current it is, as both the post and the add-in is from 2016. 

 

[edit: btw this first approach has been put into a JMP note as well for reference: [removed link as it was not accessible for all users]]

 

 

 

/****NeverStopLearning****/
MRB3855
Super User

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

Hi @martindemel  @Augustin : That link didn't work for me, but the add-in still works and the link is here. 

https://community.jmp.com/t5/JMP-Add-Ins/Compare-Simple-Slopes-in-One-Way-ANCOVA-w-Interaction-add-i...

 

 

 

MRB3855
Super User

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

great add @MRB3855 
From the post I understood that the custom test should be set up like that (where the first three columns are not necessary but show what @Mark_Bailey described in his answer:

martindemel_0-1731082326260.png

 

/****NeverStopLearning****/
Augustin
Level I

Re: How to Compare Slopes (to each other - not to the mean slope) in linear modeling

Thank you @MRB3855, @martindemel 
thanks to this custom testing and the contrasts showed by @martindemel  I have the same resutls as with R.

The only thing that could remain would be to get a Tuckey adjustment of the p-values.

 

 

Thank you very much !