I want to estimate the precipitation trends (in percentage) at long-term. At the first time, I calculate the sen's slope from the "trend package" but it misses the intercept to apply this linear equation to find the predicted value of each year:
f(S) = QS + B (Q : sen's slope, S : parameter, B : intercept)
I use this example to explain my problematic:
# import data
require(trend)
data("maxau")
maxau
# Estimate Annual trend with sen's slope
s <- maxau[,"s"]
sens.slope(s) # equal to -0.2876139 / year
Can you help me how to calculate the intercpt (B) of f(S) equation in order to calculate the predicted value of S parameter for each year ?
Thank you in advance for your help !
i had undestood that the R 'trend' package doesn't generate the intercept of Sen's slope
you can try using the 'zyp' package which generates the intercept based on the median of the values .
here is the documentation of the zyp package and this is an example with dataframe
library(zyp)
df=data.frame(x=c(1,2,3,4,5),y=c(3,6,8,1,9))
zyp.sen(y~x,df)
documentation: https://cran.r-project.org/web/packages/zyp/zyp.pdf