[#BloombergLP-bdlsta-LineFit-fit]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlsta.adoc[bdlsta]::xref:BloombergLP/bdlsta/LineFit.adoc[LineFit]::fit
:relfileprefix: ../../../
:mrdocs:

Calculate the least&hyphen;squares line fit coefficients&period;

== Synopsis

Declared in `&lt;bdlsta&lowbar;linefit&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
fit(
    double* alpha,
    double* beta) const;
----

== Description

Calculate line fit coefficients `Y &equals; Alpha &plus; Beta &ast; X`, and populate the specified `alpha` (intercept) and `beta` (slope)&period; The behavior is undefined if `2 &gt; count` or all X&apos;s are identical&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *alpha*
| receives the intercept of the fitted line
| *beta*
| receives the slope of the fitted line
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
