[英]R How to calculate the intercept of sen's slope function from trend package?
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: 第一次,我从“趋势包”中计算sen的斜率,但是它错过了使用该线性方程式来查找每年的预测值的截距:
f(S) = QS + B (Q : sen's slope, S : parameter, B : intercept) f(S)= QS + B(Q:森氏斜率,S:参数,B:截距)
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 ? 您能帮我如何计算f(S)方程的插值(B),以计算每年的S参数的预测值?
Thank you in advance for your help ! 预先感谢您的帮助 !
i had undestood that the R 'trend' package doesn't generate the intercept of Sen's slope 我不了解R'trend'软件包不会生成Sen斜率的截距
you can try using the 'zyp' package which generates the intercept based on the median of the values 您可以尝试使用“ zyp”包,该包根据值的中位数生成截距 . 。
here is the documentation of the zyp package and this is an example with dataframe 这是zyp软件包的文档,这是数据帧的示例
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 文档: https : //cran.r-project.org/web/packages/zyp/zyp.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.