I'm trying to do some trend analysis using a Theil-Sen slope estimator. Currently, I've seen two methods using the Theil-Sen function from the (amazing) open-air package, and using the mblm package. When I run the functions, they show virtually the same slope, but for whatever reason, they show completely different p-values and y-intercepts, which change the intrepetation of the results. It seems clear to me that the p-value and intercept are being calculated differently between the two functions, but I can't find in the code that would lead to such a signicant difference. Any ideas where this difference could be?
TheilSen(filter(LWCLoadingData, Year > 2008 & Year < 2018), pollutant = "TOCMass", date.format = "%Y", avg.time = "year", statistic = "median")
slope = 8.362
intercept = -189.6
Using the MBLM package
MedianTrends<-LWCLoadingData%>% filter(Year < 2018 & Year > 2008)%>% group_by(Year)%>% summarise(across(where(is.numeric), median, na.rm = TRUE)) MedianMBLM<-mblm(TOCMass~Year, dataframe = MedianTrends, repeated = FALSE)
slope = 8.369
intercept = -16675.723
The Theil-Sen and dplyr code are using the exact same median values, so the differences don' seem to be there. Any help would be appreciated here.