<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/math.linearModelCoeff.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>math.linearModelCoeff</api:function-name><api:suggest>math.linearmodelcoeff</api:suggest><api:suggest>math</api:suggest><api:suggest>linearmodelcoeff</api:suggest><api:function-link mode="xquery" fullname="math:linear-model-coeff">/apidoc/8.0/math:linear-model-coeff.xml</api:function-link><api:function mode="javascript" name="linearModelCoeff" type="builtin" lib="math" category="MathBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="math" namespace="http://marklogic.com/xdmp/math" fullname="math.linearModelCoeff"><api:summary>
  Returns the coefficients of the linear model.  Currently only simple
  linear regression model is supported so the return should contain only
  one coefficient (also called "slope").
</api:summary><api:params><api:param name="linear-model" type="math:linear-model"><api:param-description>
    A linear model.
  </api:param-description><api:param-name>linear-model</api:param-name><api:param-type>math.linearModel</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var arr = new Array();
for (i=1; i &lt; 11; i++) { 
  var x = new Array();
  var j = 2 * i + 1;
  x.push(j, i);
  arr.push(x); };
var lm = math.linearModel(xdmp.arrayValues(arr));
math.linearModelCoeff(lm);

  =&gt; 2
</pre></api:example></api:function></api:function-page>