> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> تُرجِع ميل خط الانحدار.

# regr_slope

<h2 id="regr_slope">
  regr\_slope
</h2>

أُضيف في: v26.9.0

تُرجع ميل خط المربعات الصغرى لانحدار `y` على `x`:

$$
\frac{\Sigma{(x - \bar{x})(y - \bar{y})}}{\Sigma{(x - \bar{x})^2}}
$$

تُرجع `nan` عندما تكون قيمة `x` ثابتة، لأن الخط الملائم يكون حينئذٍ عموديًا.

**الصيغة**

```sql theme={null}
regr_slope(y, x)
```

**الأسماء البديلة**: `regrSlope`

**الوسيطات**

* `y` — المتغير التابع. [`(U)Int*`](/reference/data-types/int-uint) أو [`Float*`](/reference/data-types/float)
* `x` — المتغير المستقل. [`(U)Int*`](/reference/data-types/int-uint) أو [`Float*`](/reference/data-types/float)

**القيمة المعادة**

تُرجع ميل خط الانحدار. [`Float64`](/reference/data-types/float)

**أمثلة**

**الاستخدام الأساسي**

```sql title=Query theme={null}
SELECT regr_slope(y, x)
FROM VALUES('x Float64, y Float64', (1, 2), (2, 4), (3, 6), (4, 8))
```

```response title=Response theme={null}
┌─regr_slope(y, x)─┐
│                2 │
└──────────────────┘
```
