| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> |
| <title>AbstractMultipleLinearRegression (Apache Commons Math 3.3 API)</title> |
| <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="AbstractMultipleLinearRegression (Apache Commons Math 3.3 API)"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar_top"> |
| <!-- --> |
| </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/AbstractMultipleLinearRegression.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../../org/apache/commons/math3/stat/regression/GLSMultipleLinearRegression.html" title="class in org.apache.commons.math3.stat.regression"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../index.html?org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html" target="_top">Frames</a></li> |
| <li><a href="AbstractMultipleLinearRegression.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor_summary">Constr</a> | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor_detail">Constr</a> | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.commons.math3.stat.regression</div> |
| <h2 title="Class AbstractMultipleLinearRegression" class="title">Class AbstractMultipleLinearRegression</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.commons.math3.stat.regression.AbstractMultipleLinearRegression</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../../../../../org/apache/commons/math3/stat/regression/GLSMultipleLinearRegression.html" title="class in org.apache.commons.math3.stat.regression">GLSMultipleLinearRegression</a>, <a href="../../../../../../org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html" title="class in org.apache.commons.math3.stat.regression">OLSMultipleLinearRegression</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public abstract class <span class="strong">AbstractMultipleLinearRegression</span> |
| extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> |
| implements <a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></pre> |
| <div class="block">Abstract base class for implementations of MultipleLinearRegression.</div> |
| <dl><dt><span class="strong">Since:</span></dt> |
| <dd>2.0</dd> |
| <dt><span class="strong">Version:</span></dt> |
| <dd>$Id: AbstractMultipleLinearRegression.java 1547633 2013-12-03 23:03:06Z tn $</dd></dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor_summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#AbstractMultipleLinearRegression()">AbstractMultipleLinearRegression</a></strong>()</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span>Methods</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected abstract <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#calculateBeta()">calculateBeta</a></strong>()</code> |
| <div class="block">Calculates the beta of multiple linear regression in matrix notation.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected abstract <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#calculateBetaVariance()">calculateBetaVariance</a></strong>()</code> |
| <div class="block">Calculates the beta variance of multiple linear regression in matrix |
| notation.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected double</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#calculateErrorVariance()">calculateErrorVariance</a></strong>()</code> |
| <div class="block">Calculates the variance of the error term.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#calculateResiduals()">calculateResiduals</a></strong>()</code> |
| <div class="block">Calculates the residuals of multiple linear regression in matrix |
| notation.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected double</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#calculateYVariance()">calculateYVariance</a></strong>()</code> |
| <div class="block">Calculates the variance of the y values.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateErrorVariance()">estimateErrorVariance</a></strong>()</code> |
| <div class="block">Estimates the variance of the error.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateRegressandVariance()">estimateRegressandVariance</a></strong>()</code> |
| <div class="block">Returns the variance of the regressand, ie Var(y).</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateRegressionParameters()">estimateRegressionParameters</a></strong>()</code> |
| <div class="block">Estimates the regression parameters b.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateRegressionParametersStandardErrors()">estimateRegressionParametersStandardErrors</a></strong>()</code> |
| <div class="block">Returns the standard errors of the regression parameters.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>double[][]</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateRegressionParametersVariance()">estimateRegressionParametersVariance</a></strong>()</code> |
| <div class="block">Estimates the variance of the regression parameters, ie Var(b).</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateRegressionStandardError()">estimateRegressionStandardError</a></strong>()</code> |
| <div class="block">Estimates the standard error of the regression.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#estimateResiduals()">estimateResiduals</a></strong>()</code> |
| <div class="block">Estimates the residuals, ie u = y - X*b.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#getX()">getX</a></strong>()</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#getY()">getY</a></strong>()</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#isNoIntercept()">isNoIntercept</a></strong>()</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#newSampleData(double[], int, int)">newSampleData</a></strong>(double[] data, |
| int nobs, |
| int nvars)</code> |
| <div class="block">Loads model x and y sample data from a flat input array, overriding any previous sample.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#newXSampleData(double[][])">newXSampleData</a></strong>(double[][] x)</code> |
| <div class="block">Loads new x sample data, overriding any previous data.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#newYSampleData(double[])">newYSampleData</a></strong>(double[] y)</code> |
| <div class="block">Loads new y sample data, overriding any previous data.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#setNoIntercept(boolean)">setNoIntercept</a></strong>(boolean noIntercept)</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#validateCovarianceData(double[][], double[][])">validateCovarianceData</a></strong>(double[][] x, |
| double[][] covariance)</code> |
| <div class="block">Validates that the x data and covariance matrix have the same |
| number of rows and that the covariance matrix is square.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#validateSampleData(double[][], double[])">validateSampleData</a></strong>(double[][] x, |
| double[] y)</code> |
| <div class="block">Validates sample data.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor_detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="AbstractMultipleLinearRegression()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>AbstractMultipleLinearRegression</h4> |
| <pre>public AbstractMultipleLinearRegression()</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getX()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getX</h4> |
| <pre>protected <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a> getX()</pre> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>the X sample data.</dd></dl> |
| </li> |
| </ul> |
| <a name="getY()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getY</h4> |
| <pre>protected <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a> getY()</pre> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>the Y sample data.</dd></dl> |
| </li> |
| </ul> |
| <a name="isNoIntercept()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isNoIntercept</h4> |
| <pre>public boolean isNoIntercept()</pre> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>true if the model has no intercept term; false otherwise</dd><dt><span class="strong">Since:</span></dt> |
| <dd>2.2</dd></dl> |
| </li> |
| </ul> |
| <a name="setNoIntercept(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setNoIntercept</h4> |
| <pre>public void setNoIntercept(boolean noIntercept)</pre> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>noIntercept</code> - true means the model is to be estimated without an intercept term</dd><dt><span class="strong">Since:</span></dt> |
| <dd>2.2</dd></dl> |
| </li> |
| </ul> |
| <a name="newSampleData(double[], int, int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newSampleData</h4> |
| <pre>public void newSampleData(double[] data, |
| int nobs, |
| int nvars)</pre> |
| <div class="block"><p>Loads model x and y sample data from a flat input array, overriding any previous sample. |
| </p> |
| <p>Assumes that rows are concatenated with y values first in each row. For example, an input |
| <code>data</code> array containing the sequence of values (1, 2, 3, 4, 5, 6, 7, 8, 9) with |
| <code>nobs = 3</code> and <code>nvars = 2</code> creates a regression dataset with two |
| independent variables, as below: |
| <pre> |
| y x[0] x[1] |
| -------------- |
| 1 2 3 |
| 4 5 6 |
| 7 8 9 |
| </pre> |
| </p> |
| <p>Note that there is no need to add an initial unitary column (column of 1's) when |
| specifying a model including an intercept term. If <a href="../../../../../../org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#isNoIntercept()"><code>isNoIntercept()</code></a> is <code>true</code>, |
| the X matrix will be created without an initial column of "1"s; otherwise this column will |
| be added. |
| </p> |
| <p>Throws IllegalArgumentException if any of the following preconditions fail: |
| <ul><li><code>data</code> cannot be null</li> |
| <li><code>data.length = nobs * (nvars + 1)</li> |
| <li><code>nobs > nvars</code></li></ul> |
| </p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - input data array</dd><dd><code>nobs</code> - number of observations (rows)</dd><dd><code>nvars</code> - number of independent variables (columns, not counting y)</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if the data array is null</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/DimensionMismatchException.html" title="class in org.apache.commons.math3.exception">DimensionMismatchException</a></code> - if the length of the data array is not equal |
| to <code>nobs * (nvars + 1)</code></dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if <code>nobs</code> is less than |
| <code>nvars + 1</code></dd></dl> |
| </li> |
| </ul> |
| <a name="newYSampleData(double[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newYSampleData</h4> |
| <pre>protected void newYSampleData(double[] y)</pre> |
| <div class="block">Loads new y sample data, overriding any previous data.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>y</code> - the array representing the y sample</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if y is null</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html" title="class in org.apache.commons.math3.exception">NoDataException</a></code> - if y is empty</dd></dl> |
| </li> |
| </ul> |
| <a name="newXSampleData(double[][])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newXSampleData</h4> |
| <pre>protected void newXSampleData(double[][] x)</pre> |
| <div class="block"><p>Loads new x sample data, overriding any previous data. |
| </p> |
| The input <code>x</code> array should have one row for each sample |
| observation, with columns corresponding to independent variables. |
| For example, if <pre> |
| <code> x = new double[][] {{1, 2}, {3, 4}, {5, 6}} </code></pre> |
| then <code>setXSampleData(x) </code> results in a model with two independent |
| variables and 3 observations: |
| <pre> |
| x[0] x[1] |
| ---------- |
| 1 2 |
| 3 4 |
| 5 6 |
| </pre> |
| </p> |
| <p>Note that there is no need to add an initial unitary column (column of 1's) when |
| specifying a model including an intercept term. |
| </p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the rectangular array representing the x sample</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if x is null</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html" title="class in org.apache.commons.math3.exception">NoDataException</a></code> - if x is empty</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/DimensionMismatchException.html" title="class in org.apache.commons.math3.exception">DimensionMismatchException</a></code> - if x is not rectangular</dd></dl> |
| </li> |
| </ul> |
| <a name="validateSampleData(double[][], double[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>validateSampleData</h4> |
| <pre>protected void validateSampleData(double[][] x, |
| double[] y) |
| throws <a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></pre> |
| <div class="block">Validates sample data. Checks that |
| <ul><li>Neither x nor y is null or empty;</li> |
| <li>The length (i.e. number of rows) of x equals the length of y</li> |
| <li>x has at least one more row than it has columns (i.e. there is |
| sufficient data to estimate regression coefficients for each of the |
| columns in x plus an intercept.</li> |
| </ul></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the [n,k] array representing the x data</dd><dd><code>y</code> - the [n,1] array representing the y data</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>x</code> or <code>y</code> is null</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/DimensionMismatchException.html" title="class in org.apache.commons.math3.exception">DimensionMismatchException</a></code> - if <code>x</code> and <code>y</code> do not |
| have the same length</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html" title="class in org.apache.commons.math3.exception">NoDataException</a></code> - if <code>x</code> or <code>y</code> are zero-length</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if the number of rows of <code>x</code> |
| is not larger than the number of columns + 1</dd></dl> |
| </li> |
| </ul> |
| <a name="validateCovarianceData(double[][], double[][])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>validateCovarianceData</h4> |
| <pre>protected void validateCovarianceData(double[][] x, |
| double[][] covariance)</pre> |
| <div class="block">Validates that the x data and covariance matrix have the same |
| number of rows and that the covariance matrix is square.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the [n,k] array representing the x sample</dd><dd><code>covariance</code> - the [n,n] array representing the covariance matrix</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/DimensionMismatchException.html" title="class in org.apache.commons.math3.exception">DimensionMismatchException</a></code> - if the number of rows in x is not equal |
| to the number of rows in covariance</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/linear/NonSquareMatrixException.html" title="class in org.apache.commons.math3.linear">NonSquareMatrixException</a></code> - if the covariance matrix is not square</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateRegressionParameters()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateRegressionParameters</h4> |
| <pre>public double[] estimateRegressionParameters()</pre> |
| <div class="block">Estimates the regression parameters b.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html#estimateRegressionParameters()">estimateRegressionParameters</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>The [k,1] array representing b</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateResiduals()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateResiduals</h4> |
| <pre>public double[] estimateResiduals()</pre> |
| <div class="block">Estimates the residuals, ie u = y - X*b.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html#estimateResiduals()">estimateResiduals</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>The [n,1] array representing the residuals</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateRegressionParametersVariance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateRegressionParametersVariance</h4> |
| <pre>public double[][] estimateRegressionParametersVariance()</pre> |
| <div class="block">Estimates the variance of the regression parameters, ie Var(b).</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html#estimateRegressionParametersVariance()">estimateRegressionParametersVariance</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>The [k,k] array representing the variance of b</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateRegressionParametersStandardErrors()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateRegressionParametersStandardErrors</h4> |
| <pre>public double[] estimateRegressionParametersStandardErrors()</pre> |
| <div class="block">Returns the standard errors of the regression parameters.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html#estimateRegressionParametersStandardErrors()">estimateRegressionParametersStandardErrors</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>standard errors of estimated regression parameters</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateRegressandVariance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateRegressandVariance</h4> |
| <pre>public double estimateRegressandVariance()</pre> |
| <div class="block">Returns the variance of the regressand, ie Var(y).</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html#estimateRegressandVariance()">estimateRegressandVariance</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/MultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">MultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>The double representing the variance of y</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateErrorVariance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateErrorVariance</h4> |
| <pre>public double estimateErrorVariance()</pre> |
| <div class="block">Estimates the variance of the error.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>estimate of the error variance</dd><dt><span class="strong">Since:</span></dt> |
| <dd>2.2</dd></dl> |
| </li> |
| </ul> |
| <a name="estimateRegressionStandardError()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>estimateRegressionStandardError</h4> |
| <pre>public double estimateRegressionStandardError()</pre> |
| <div class="block">Estimates the standard error of the regression.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>regression standard error</dd><dt><span class="strong">Since:</span></dt> |
| <dd>2.2</dd></dl> |
| </li> |
| </ul> |
| <a name="calculateBeta()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>calculateBeta</h4> |
| <pre>protected abstract <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a> calculateBeta()</pre> |
| <div class="block">Calculates the beta of multiple linear regression in matrix notation.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>beta</dd></dl> |
| </li> |
| </ul> |
| <a name="calculateBetaVariance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>calculateBetaVariance</h4> |
| <pre>protected abstract <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a> calculateBetaVariance()</pre> |
| <div class="block">Calculates the beta variance of multiple linear regression in matrix |
| notation.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>beta variance</dd></dl> |
| </li> |
| </ul> |
| <a name="calculateYVariance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>calculateYVariance</h4> |
| <pre>protected double calculateYVariance()</pre> |
| <div class="block">Calculates the variance of the y values.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>Y variance</dd></dl> |
| </li> |
| </ul> |
| <a name="calculateErrorVariance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>calculateErrorVariance</h4> |
| <pre>protected double calculateErrorVariance()</pre> |
| <div class="block"><p>Calculates the variance of the error term.</p> |
| Uses the formula <pre> |
| var(u) = u · u / (n - k) |
| </pre> |
| where n and k are the row and column dimensions of the design |
| matrix X.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>error variance estimate</dd><dt><span class="strong">Since:</span></dt> |
| <dd>2.2</dd></dl> |
| </li> |
| </ul> |
| <a name="calculateResiduals()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>calculateResiduals</h4> |
| <pre>protected <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a> calculateResiduals()</pre> |
| <div class="block">Calculates the residuals of multiple linear regression in matrix |
| notation. |
| |
| <pre> |
| u = y - X * b |
| </pre></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>The residuals [n,1] matrix</dd></dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar_bottom"> |
| <!-- --> |
| </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/AbstractMultipleLinearRegression.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../../org/apache/commons/math3/stat/regression/GLSMultipleLinearRegression.html" title="class in org.apache.commons.math3.stat.regression"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../index.html?org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html" target="_top">Frames</a></li> |
| <li><a href="AbstractMultipleLinearRegression.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor_summary">Constr</a> | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor_detail">Constr</a> | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2003–2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |