Hi there,

Does anyone know a non-parametric test for testing the significant difference between slopes?

I have two independent continuous variables divided into three decades (categories). I am specifically looking for a non-parametric test because I am unable to get my data to be normally distributed and their variances are not the same. And I want to find a p-value for each two decades compared, e.g. decades 1 slope to decade 2 slope, decade 1 slope to decade 3 slope, and decade 2 slope to decade 3 slope.

Here is the data I am working with:

```
df <- data.frame(
"d" = c("D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1",
"D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1",
"D1", "D1", "D1", "D1", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2",
"D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2", "D2",
"D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3",
"D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3",
"D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3", "D3",
"D3"),
"x" = c(1.560,0.618,1.350,1.610,0.984,20.800,6.300,0.221,6.880,0.784,0.444,11.600,0.986,2.600,3.380,1.170,7.550,
17.000,29.200,1.750,93.000,5.740,2.630,38.500,7.190,3.330,33.500,12.200,7.950,4.610,29.800,2.730,12.400,
4.410,1.690,3.350,6.410,1.210,51.200,0.232,0.171,8.550,0.330,1.330,68.500,0.642,0.485,14.400,22.000,5.010,
13.700,20.200,9.870,184.000,13.800,5.230,NA,62.400,17.400,0.940,NA,34.800,5.250,0.625,NA,118.000,3.320,
4.420,NA,10.900,20.000,93.100,32.300,7.060,22.600,NA,74.200,22.600,17.100,6.230,2.580,1.680,1.200,NA,31.100,
19.100,83.300,12.300,14.200,7.600,3.840,2.370,NA,5.610,51.900,9.950,13.400,6.640,1.690,2.120,NA,NA,45.900,
2.520,NA,69.000,1.280,3.750,NA,81.800,9.360,31.400,NA,30.100,9.940,1.740,104.000,10.200,3.080,NA),
"y" = c(0.025, 0.075, 0.270, 0.045, 0.045, 0.345, 0.080, 0.030, 0.115, 0.072, 0.025, 0.177, 0.025, 0.039, 0.123,
0.076, 0.041, 0.471, 0.378, 0.019, 0.599, 0.031, 0.012, 0.251, 0.047, 0.031, 0.713, 0.159, 0.030, 0.096,
0.306, 0.027, 0.124, 0.050, 0.029, 0.051, 0.115, 0.020, 0.654, 0.049, 0.037, 0.170, 0.063, 0.039, 0.977,
0.022, 0.049, 0.241, 0.250, 0.045, 0.219, 0.203, 0.149, 1.11, 0.093, 0.088, 0.061, 1.10, 0.059, 0.035,
0.017, 0.656, 0.071, 0.019, 0.025, 0.323, 0.042, 0.016, 0.037, 0.166, 0.355, 0.321, 0.268, 0.066, 0.124,
0.039, 0.252, 0.094, 0.115, 0.038, 0.028, 0.058, 0.035, 0.044, 0.447, 0.155, 0.474, 0.070, 0.061, 0.047,
0.025, 0.012, 0.030, 0.121, 0.309, 0.039, 0.109, 0.035, 0.036, 0.016, 0.015, 0.547, 0.277, 0.021, 0.010,
0.969, 0.123, 0.023, 0.020, 0.641, 0.129, 0.160, 0.029, 0.211, 0.043, 0.022, 1.28, 0.088, 0.015, 0.010)
)
```

I was able to do this with an ANOVA test using this code:

```
library(lsmeans) # found code from : https://stats.stackexchange.com/questions/33013/what-test-can-i-use-to-compare-slopes-from-two-or-more-regression-models
d.interaction <- lm(y ~ x*d, data = df)
anova(d.interaction)
#obtain slopes
d.interaction$coefficients
d.lst <- lstrends(d.interaction, "d", var="x")
#compare slopes
pairs(d.lst)
```

However, I need a non-parametric test. I was told a Kruskal-Wallis test would be the test I need but I cannot for the life of me to find a code that does something similar to this ANOVA code above does (specifically finding a p-values for each decade slope compared to one another). If I have to filter the data to only compare two decade slopes at a time, I'm ok doing that too (I can easily do that with my data).

Does anyone have an idea as to how I can achieve this? If you have any questions or need further explanation, please don't hesitate to ask!

Thanks in advance!