# series_fit_line()series_fit_line()

• `rsquare`：r-square 是用于衡量拟合质量的标准。`rsquare`: r-square is a standard measure of the fit quality. 此值是 [0-1] 范围内的数字，其中 1 表示拟合度最好，0 表示数据无序，与任何直线均不拟合。The value's a number in the range [0-1], where 1 - is the best possible fit, and 0 means the data is unordered and doesn't fit any line.
• `slope`：近似直线的斜率（即 y=ax+b 中的“a”）。`slope`: Slope of the approximated line ("a" from y=ax+b).
• `variance`：输入数据的方差。`variance`: Variance of the input data.
• `rvariance`：剩余方差，即输入数据值和近似数据值之间的方差。`rvariance`: Residual variance that is the variance between the input data values the approximated ones.
• `interception`：近似直线的截距（即 y=ax+b 中的“b”）。`interception`: Interception of the approximated line ("b" from y=ax+b).
• `line_fit`：数值数组，其中包含拟合度最好的直线的一系列值。`line_fit`: Numerical array holding a series of values of the best fitted line. 序列长度等于输入数组的长度。The series length is equal to the length of the input array. 该值用于绘制图表。The value's used for charting.

## 语法Syntax

`series_fit_line(`x`)``series_fit_line(`x`)`

## 参数Arguments

• x：数值的动态数组。x : Dynamic array of numeric values.

## 示例Examples

``````print id=' ', x=range(bin(now(), 1h)-11h, bin(now(), 1h), 1h), y=dynamic([2,5,6,8,11,15,17,18,25,26,30,30])
| extend (RSquare,Slope,Variance,RVariance,Interception,LineFit)=series_fit_line(y)
| render timechart
``````

RSquareRSquare 斜率Slope VarianceVariance RVarianceRVariance InterceptionInterception LineFitLineFit
0.9820.982 2.7302.730 98.62898.628 1.6861.686 -1.666-1.666 1.064、3.7945、6.526、9.256、11.987、14.718、17.449、20.180、22.910、25.641、28.371、31.1021.064, 3.7945, 6.526, 9.256, 11.987, 14.718, 17.449, 20.180, 22.910, 25.641, 28.371, 31.102