| <!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>SimpleRegression (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="SimpleRegression (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/SimpleRegression.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><a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html" title="class in org.apache.commons.math3.stat.regression"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface 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/SimpleRegression.html" target="_top">Frames</a></li> |
| <li><a href="SimpleRegression.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 SimpleRegression" class="title">Class SimpleRegression</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.SimpleRegression</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <span class="strong">SimpleRegression</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="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></pre> |
| <div class="block">Estimates an ordinary least squares regression model |
| with one independent variable. |
| <p> |
| <code> y = intercept + slope * x </code></p> |
| <p> |
| Standard errors for <code>intercept</code> and <code>slope</code> are |
| available as well as ANOVA, r-square and Pearson's r statistics.</p> |
| <p> |
| Observations (x,y pairs) can be added to the model one at a time or they |
| can be provided in a 2-dimensional array. The observations are not stored |
| in memory, so there is no limit to the number of observations that can be |
| added to the model.</p> |
| <p> |
| <strong>Usage Notes</strong>: <ul> |
| <li> When there are fewer than two observations in the model, or when |
| there is no variation in the x values (i.e. all x values are the same) |
| all statistics return <code>NaN</code>. At least two observations with |
| different x coordinates are required to estimate a bivariate regression |
| model. |
| </li> |
| <li> Getters for the statistics always compute values based on the current |
| set of observations -- i.e., you can get statistics, then add more data |
| and get updated statistics without using a new instance. There is no |
| "compute" method that updates all statistics. Each of the getters performs |
| the necessary computations to return the requested statistic. |
| </li> |
| <li> The intercept term may be suppressed by passing <code>false</code> to |
| the <a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#SimpleRegression(boolean)"><code>SimpleRegression(boolean)</code></a> constructor. When the |
| <code>hasIntercept</code> property is false, the model is estimated without a |
| constant term and <a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#getIntercept()"><code>getIntercept()</code></a> returns <code>0</code>.</li> |
| </ul></p></div> |
| <dl><dt><span class="strong">Version:</span></dt> |
| <dd>$Id: SimpleRegression.java 1519851 2013-09-03 21:16:35Z tn $</dd> |
| <dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../serialized-form.html#org.apache.commons.math3.stat.regression.SimpleRegression">Serialized Form</a></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/SimpleRegression.html#SimpleRegression()">SimpleRegression</a></strong>()</code> |
| <div class="block">Create an empty SimpleRegression instance</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#SimpleRegression(boolean)">SimpleRegression</a></strong>(boolean includeIntercept)</code> |
| <div class="block">Create a SimpleRegression instance, specifying whether or not to estimate |
| an intercept.</div> |
| </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>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#addData(double[][])">addData</a></strong>(double[][] data)</code> |
| <div class="block">Adds the observations represented by the elements in |
| <code>data</code>.</div> |
| </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/SimpleRegression.html#addData(double, double)">addData</a></strong>(double x, |
| double y)</code> |
| <div class="block">Adds the observation (x,y) to the regression data set.</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/SimpleRegression.html#addObservation(double[], double)">addObservation</a></strong>(double[] x, |
| double y)</code> |
| <div class="block">Adds one observation to the regression model.</div> |
| </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/SimpleRegression.html#addObservations(double[][], double[])">addObservations</a></strong>(double[][] x, |
| double[] y)</code> |
| <div class="block">Adds a series of observations to the regression model.</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/SimpleRegression.html#append(org.apache.commons.math3.stat.regression.SimpleRegression)">append</a></strong>(<a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html" title="class in org.apache.commons.math3.stat.regression">SimpleRegression</a> reg)</code> |
| <div class="block">Appends data from another regression calculation to this one.</div> |
| </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/SimpleRegression.html#clear()">clear</a></strong>()</code> |
| <div class="block">Clears all data from the model.</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/SimpleRegression.html#getIntercept()">getIntercept</a></strong>()</code> |
| <div class="block">Returns the intercept of the estimated regression line, if |
| <a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#hasIntercept()"><code>hasIntercept()</code></a> is true; otherwise 0.</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/SimpleRegression.html#getInterceptStdErr()">getInterceptStdErr</a></strong>()</code> |
| <div class="block">Returns the <a href="http://www.xycoon.com/standarderrorb0.htm"> |
| standard error of the intercept estimate</a>, |
| usually denoted s(b0).</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/SimpleRegression.html#getMeanSquareError()">getMeanSquareError</a></strong>()</code> |
| <div class="block">Returns the sum of squared errors divided by the degrees of freedom, |
| usually abbreviated MSE.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>long</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#getN()">getN</a></strong>()</code> |
| <div class="block">Returns the number of observations that have been added to the model.</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/SimpleRegression.html#getR()">getR</a></strong>()</code> |
| <div class="block">Returns <a href="http://mathworld.wolfram.com/CorrelationCoefficient.html"> |
| Pearson's product moment correlation coefficient</a>, |
| usually denoted r.</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/SimpleRegression.html#getRegressionSumSquares()">getRegressionSumSquares</a></strong>()</code> |
| <div class="block">Returns the sum of squared deviations of the predicted y values about |
| their mean (which equals the mean of y).</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/SimpleRegression.html#getRSquare()">getRSquare</a></strong>()</code> |
| <div class="block">Returns the <a href="http://www.xycoon.com/coefficient1.htm"> |
| coefficient of determination</a>, |
| usually denoted r-square.</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/SimpleRegression.html#getSignificance()">getSignificance</a></strong>()</code> |
| <div class="block">Returns the significance level of the slope (equiv) correlation.</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/SimpleRegression.html#getSlope()">getSlope</a></strong>()</code> |
| <div class="block">Returns the slope of the estimated regression line.</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/SimpleRegression.html#getSlopeConfidenceInterval()">getSlopeConfidenceInterval</a></strong>()</code> |
| <div class="block">Returns the half-width of a 95% confidence interval for the slope |
| estimate.</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/SimpleRegression.html#getSlopeConfidenceInterval(double)">getSlopeConfidenceInterval</a></strong>(double alpha)</code> |
| <div class="block">Returns the half-width of a (100-100*alpha)% confidence interval for |
| the slope estimate.</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/SimpleRegression.html#getSlopeStdErr()">getSlopeStdErr</a></strong>()</code> |
| <div class="block">Returns the <a href="http://www.xycoon.com/standerrorb(1).htm">standard |
| error of the slope estimate</a>, |
| usually denoted s(b1).</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/SimpleRegression.html#getSumOfCrossProducts()">getSumOfCrossProducts</a></strong>()</code> |
| <div class="block">Returns the sum of crossproducts, x<sub>i</sub>*y<sub>i</sub>.</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/SimpleRegression.html#getSumSquaredErrors()">getSumSquaredErrors</a></strong>()</code> |
| <div class="block">Returns the <a href="http://www.xycoon.com/SumOfSquares.htm"> |
| sum of squared errors</a> (SSE) associated with the regression |
| model.</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/SimpleRegression.html#getTotalSumSquares()">getTotalSumSquares</a></strong>()</code> |
| <div class="block">Returns the sum of squared deviations of the y values about their mean.</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/SimpleRegression.html#getXSumSquares()">getXSumSquares</a></strong>()</code> |
| <div class="block">Returns the sum of squared deviations of the x values about their mean.</div> |
| </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/SimpleRegression.html#hasIntercept()">hasIntercept</a></strong>()</code> |
| <div class="block">Returns true if the model includes an intercept term.</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/SimpleRegression.html#predict(double)">predict</a></strong>(double x)</code> |
| <div class="block">Returns the "predicted" <code>y</code> value associated with the |
| supplied <code>x</code> value, based on the data that has been |
| added to the model when this method is activated.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html" title="class in org.apache.commons.math3.stat.regression">RegressionResults</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#regress()">regress</a></strong>()</code> |
| <div class="block">Performs a regression on data present in buffers and outputs a RegressionResults object.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html" title="class in org.apache.commons.math3.stat.regression">RegressionResults</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#regress(int[])">regress</a></strong>(int[] variablesToInclude)</code> |
| <div class="block">Performs a regression on data present in buffers including only regressors |
| indexed in variablesToInclude and outputs a RegressionResults object</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/SimpleRegression.html#removeData(double[][])">removeData</a></strong>(double[][] data)</code> |
| <div class="block">Removes observations represented by the elements in <code>data</code>.</div> |
| </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/SimpleRegression.html#removeData(double, double)">removeData</a></strong>(double x, |
| double y)</code> |
| <div class="block">Removes the observation (x,y) from the regression data set.</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="SimpleRegression()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleRegression</h4> |
| <pre>public SimpleRegression()</pre> |
| <div class="block">Create an empty SimpleRegression instance</div> |
| </li> |
| </ul> |
| <a name="SimpleRegression(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>SimpleRegression</h4> |
| <pre>public SimpleRegression(boolean includeIntercept)</pre> |
| <div class="block">Create a SimpleRegression instance, specifying whether or not to estimate |
| an intercept. |
| |
| <p>Use <code>false</code> to estimate a model with no intercept. When the |
| <code>hasIntercept</code> property is false, the model is estimated without a |
| constant term and <a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#getIntercept()"><code>getIntercept()</code></a> returns <code>0</code>.</p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>includeIntercept</code> - whether or not to include an intercept term in |
| the regression model</dd></dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="addData(double, double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addData</h4> |
| <pre>public void addData(double x, |
| double y)</pre> |
| <div class="block">Adds the observation (x,y) to the regression data set. |
| <p> |
| Uses updating formulas for means and sums of squares defined in |
| "Algorithms for Computing the Sample Variance: Analysis and |
| Recommendations", Chan, T.F., Golub, G.H., and LeVeque, R.J. |
| 1983, American Statistician, vol. 37, pp. 242-247, referenced in |
| Weisberg, S. "Applied Linear Regression". 2nd Ed. 1985.</p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - independent variable value</dd><dd><code>y</code> - dependent variable value</dd></dl> |
| </li> |
| </ul> |
| <a name="append(org.apache.commons.math3.stat.regression.SimpleRegression)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>append</h4> |
| <pre>public void append(<a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html" title="class in org.apache.commons.math3.stat.regression">SimpleRegression</a> reg)</pre> |
| <div class="block">Appends data from another regression calculation to this one. |
| |
| <p>The mean update formulae are based on a paper written by Philippe |
| Pébay: |
| <a |
| href="http://prod.sandia.gov/techlib/access-control.cgi/2008/086212.pdf"> |
| Formulas for Robust, One-Pass Parallel Computation of Covariances and |
| Arbitrary-Order Statistical Moments</a>, 2008, Technical Report |
| SAND2008-6212, Sandia National Laboratories.</p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>reg</code> - model to append data from</dd><dt><span class="strong">Since:</span></dt> |
| <dd>3.3</dd></dl> |
| </li> |
| </ul> |
| <a name="removeData(double, double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>removeData</h4> |
| <pre>public void removeData(double x, |
| double y)</pre> |
| <div class="block">Removes the observation (x,y) from the regression data set. |
| <p> |
| Mirrors the addData method. This method permits the use of |
| SimpleRegression instances in streaming mode where the regression |
| is applied to a sliding "window" of observations, however the caller is |
| responsible for maintaining the set of observations in the window.</p> |
| |
| The method has no effect if there are no points of data (i.e. n=0)</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - independent variable value</dd><dd><code>y</code> - dependent variable value</dd></dl> |
| </li> |
| </ul> |
| <a name="addData(double[][])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addData</h4> |
| <pre>public void addData(double[][] data) |
| throws <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></pre> |
| <div class="block">Adds the observations represented by the elements in |
| <code>data</code>. |
| <p> |
| <code>(data[0][0],data[0][1])</code> will be the first observation, then |
| <code>(data[1][0],data[1][1])</code>, etc.</p> |
| <p> |
| This method does not replace data that has already been added. The |
| observations represented by <code>data</code> are added to the existing |
| dataset.</p> |
| <p> |
| To replace all data, use <code>clear()</code> before adding the new |
| data.</p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - array of observations to be added</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></code> - if the length of <code>data[i]</code> is not |
| greater than or equal to 2</dd></dl> |
| </li> |
| </ul> |
| <a name="addObservation(double[], double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addObservation</h4> |
| <pre>public void addObservation(double[] x, |
| double y) |
| throws <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></pre> |
| <div class="block">Adds one observation to the regression model.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#addObservation(double[], double)">addObservation</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the independent variables which form the design matrix</dd><dd><code>y</code> - the dependent or response variable</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></code> - if the length of <code>x</code> does not equal |
| the number of independent variables in the model</dd></dl> |
| </li> |
| </ul> |
| <a name="addObservations(double[][], double[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addObservations</h4> |
| <pre>public void addObservations(double[][] x, |
| double[] y) |
| throws <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></pre> |
| <div class="block">Adds a series of observations to the regression model. The lengths of |
| x and y must be the same and x must be rectangular.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#addObservations(double[][], double[])">addObservations</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - a series of observations on the independent variables</dd><dd><code>y</code> - a series of observations on the dependent variable |
| The length of x and y must be the same</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></code> - if <code>x</code> is not rectangular, does not match |
| the length of <code>y</code> or does not contain sufficient data to estimate the model</dd></dl> |
| </li> |
| </ul> |
| <a name="removeData(double[][])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>removeData</h4> |
| <pre>public void removeData(double[][] data)</pre> |
| <div class="block">Removes observations represented by the elements in <code>data</code>. |
| <p> |
| If the array is larger than the current n, only the first n elements are |
| processed. This method permits the use of SimpleRegression instances in |
| streaming mode where the regression is applied to a sliding "window" of |
| observations, however the caller is responsible for maintaining the set |
| of observations in the window.</p> |
| <p> |
| To remove all data, use <code>clear()</code>.</p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - array of observations to be removed</dd></dl> |
| </li> |
| </ul> |
| <a name="clear()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>clear</h4> |
| <pre>public void clear()</pre> |
| <div class="block">Clears all data from the model.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#clear()">clear</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getN()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getN</h4> |
| <pre>public long getN()</pre> |
| <div class="block">Returns the number of observations that have been added to the model.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#getN()">getN</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>n number of observations that have been added.</dd></dl> |
| </li> |
| </ul> |
| <a name="predict(double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>predict</h4> |
| <pre>public double predict(double x)</pre> |
| <div class="block">Returns the "predicted" <code>y</code> value associated with the |
| supplied <code>x</code> value, based on the data that has been |
| added to the model when this method is activated. |
| <p> |
| <code> predict(x) = intercept + slope * x </code></p> |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double,NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - input <code>x</code> value</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>predicted <code>y</code> value</dd></dl> |
| </li> |
| </ul> |
| <a name="getIntercept()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getIntercept</h4> |
| <pre>public double getIntercept()</pre> |
| <div class="block">Returns the intercept of the estimated regression line, if |
| <a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#hasIntercept()"><code>hasIntercept()</code></a> is true; otherwise 0. |
| <p> |
| The least squares estimate of the intercept is computed using the |
| <a href="http://www.xycoon.com/estimation4.htm">normal equations</a>. |
| The intercept is sometimes denoted b0.</p> |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double,NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>the intercept of the regression line if the model includes an |
| intercept; 0 otherwise</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#SimpleRegression(boolean)"><code>SimpleRegression(boolean)</code></a></dd></dl> |
| </li> |
| </ul> |
| <a name="hasIntercept()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hasIntercept</h4> |
| <pre>public boolean hasIntercept()</pre> |
| <div class="block">Returns true if the model includes an intercept term.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#hasIntercept()">hasIntercept</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>true if the regression includes an intercept; false otherwise</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#SimpleRegression(boolean)"><code>SimpleRegression(boolean)</code></a></dd></dl> |
| </li> |
| </ul> |
| <a name="getSlope()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSlope</h4> |
| <pre>public double getSlope()</pre> |
| <div class="block">Returns the slope of the estimated regression line. |
| <p> |
| The least squares estimate of the slope is computed using the |
| <a href="http://www.xycoon.com/estimation4.htm">normal equations</a>. |
| The slope is sometimes denoted b1.</p> |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double.NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>the slope of the regression line</dd></dl> |
| </li> |
| </ul> |
| <a name="getSumSquaredErrors()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSumSquaredErrors</h4> |
| <pre>public double getSumSquaredErrors()</pre> |
| <div class="block">Returns the <a href="http://www.xycoon.com/SumOfSquares.htm"> |
| sum of squared errors</a> (SSE) associated with the regression |
| model. |
| <p> |
| The sum is computed using the computational formula</p> |
| <p> |
| <code>SSE = SYY - (SXY * SXY / SXX)</code></p> |
| <p> |
| where <code>SYY</code> is the sum of the squared deviations of the y |
| values about their mean, <code>SXX</code> is similarly defined and |
| <code>SXY</code> is the sum of the products of x and y mean deviations. |
| </p><p> |
| The sums are accumulated using the updating algorithm referenced in |
| <a href="../../../../../../org/apache/commons/math3/stat/regression/SimpleRegression.html#addData(double, double)"><code>addData(double, double)</code></a>.</p> |
| <p> |
| The return value is constrained to be non-negative - i.e., if due to |
| rounding errors the computational formula returns a negative result, |
| 0 is returned.</p> |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double,NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>sum of squared errors associated with the regression model</dd></dl> |
| </li> |
| </ul> |
| <a name="getTotalSumSquares()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTotalSumSquares</h4> |
| <pre>public double getTotalSumSquares()</pre> |
| <div class="block">Returns the sum of squared deviations of the y values about their mean. |
| <p> |
| This is defined as SSTO |
| <a href="http://www.xycoon.com/SumOfSquares.htm">here</a>.</p> |
| <p> |
| If <code>n < 2</code>, this returns <code>Double.NaN</code>.</p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>sum of squared deviations of y values</dd></dl> |
| </li> |
| </ul> |
| <a name="getXSumSquares()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getXSumSquares</h4> |
| <pre>public double getXSumSquares()</pre> |
| <div class="block">Returns the sum of squared deviations of the x values about their mean. |
| |
| If <code>n < 2</code>, this returns <code>Double.NaN</code>.</p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>sum of squared deviations of x values</dd></dl> |
| </li> |
| </ul> |
| <a name="getSumOfCrossProducts()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSumOfCrossProducts</h4> |
| <pre>public double getSumOfCrossProducts()</pre> |
| <div class="block">Returns the sum of crossproducts, x<sub>i</sub>*y<sub>i</sub>.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>sum of cross products</dd></dl> |
| </li> |
| </ul> |
| <a name="getRegressionSumSquares()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRegressionSumSquares</h4> |
| <pre>public double getRegressionSumSquares()</pre> |
| <div class="block">Returns the sum of squared deviations of the predicted y values about |
| their mean (which equals the mean of y). |
| <p> |
| This is usually abbreviated SSR or SSM. It is defined as SSM |
| <a href="http://www.xycoon.com/SumOfSquares.htm">here</a></p> |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double.NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>sum of squared deviations of predicted y values</dd></dl> |
| </li> |
| </ul> |
| <a name="getMeanSquareError()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMeanSquareError</h4> |
| <pre>public double getMeanSquareError()</pre> |
| <div class="block">Returns the sum of squared errors divided by the degrees of freedom, |
| usually abbreviated MSE. |
| <p> |
| If there are fewer than <strong>three</strong> data pairs in the model, |
| or if there is no variation in <code>x</code>, this returns |
| <code>Double.NaN</code>.</p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>sum of squared deviations of y values</dd></dl> |
| </li> |
| </ul> |
| <a name="getR()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getR</h4> |
| <pre>public double getR()</pre> |
| <div class="block">Returns <a href="http://mathworld.wolfram.com/CorrelationCoefficient.html"> |
| Pearson's product moment correlation coefficient</a>, |
| usually denoted r. |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double,NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>Pearson's r</dd></dl> |
| </li> |
| </ul> |
| <a name="getRSquare()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRSquare</h4> |
| <pre>public double getRSquare()</pre> |
| <div class="block">Returns the <a href="http://www.xycoon.com/coefficient1.htm"> |
| coefficient of determination</a>, |
| usually denoted r-square. |
| <p> |
| <strong>Preconditions</strong>: <ul> |
| <li>At least two observations (with at least two different x values) |
| must have been added before invoking this method. If this method is |
| invoked before a model can be estimated, <code>Double,NaN</code> is |
| returned. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>r-square</dd></dl> |
| </li> |
| </ul> |
| <a name="getInterceptStdErr()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInterceptStdErr</h4> |
| <pre>public double getInterceptStdErr()</pre> |
| <div class="block">Returns the <a href="http://www.xycoon.com/standarderrorb0.htm"> |
| standard error of the intercept estimate</a>, |
| usually denoted s(b0). |
| <p> |
| If there are fewer that <strong>three</strong> observations in the |
| model, or if there is no variation in x, this returns |
| <code>Double.NaN</code>.</p> Additionally, a <code>Double.NaN</code> is |
| returned when the intercept is constrained to be zero</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>standard error associated with intercept estimate</dd></dl> |
| </li> |
| </ul> |
| <a name="getSlopeStdErr()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSlopeStdErr</h4> |
| <pre>public double getSlopeStdErr()</pre> |
| <div class="block">Returns the <a href="http://www.xycoon.com/standerrorb(1).htm">standard |
| error of the slope estimate</a>, |
| usually denoted s(b1). |
| <p> |
| If there are fewer that <strong>three</strong> data pairs in the model, |
| or if there is no variation in x, this returns <code>Double.NaN</code>. |
| </p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>standard error associated with slope estimate</dd></dl> |
| </li> |
| </ul> |
| <a name="getSlopeConfidenceInterval()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSlopeConfidenceInterval</h4> |
| <pre>public double getSlopeConfidenceInterval() |
| throws <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></pre> |
| <div class="block">Returns the half-width of a 95% confidence interval for the slope |
| estimate. |
| <p> |
| The 95% confidence interval is</p> |
| <p> |
| <code>(getSlope() - getSlopeConfidenceInterval(), |
| getSlope() + getSlopeConfidenceInterval())</code></p> |
| <p> |
| If there are fewer that <strong>three</strong> observations in the |
| model, or if there is no variation in x, this returns |
| <code>Double.NaN</code>.</p> |
| <p> |
| <strong>Usage Note</strong>:<br> |
| The validity of this statistic depends on the assumption that the |
| observations included in the model are drawn from a |
| <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html"> |
| Bivariate Normal Distribution</a>.</p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>half-width of 95% confidence interval for the slope estimate</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></code> - if the confidence interval can not be computed.</dd></dl> |
| </li> |
| </ul> |
| <a name="getSlopeConfidenceInterval(double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSlopeConfidenceInterval</h4> |
| <pre>public double getSlopeConfidenceInterval(double alpha) |
| throws <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></pre> |
| <div class="block">Returns the half-width of a (100-100*alpha)% confidence interval for |
| the slope estimate. |
| <p> |
| The (100-100*alpha)% confidence interval is </p> |
| <p> |
| <code>(getSlope() - getSlopeConfidenceInterval(), |
| getSlope() + getSlopeConfidenceInterval())</code></p> |
| <p> |
| To request, for example, a 99% confidence interval, use |
| <code>alpha = .01</code></p> |
| <p> |
| <strong>Usage Note</strong>:<br> |
| The validity of this statistic depends on the assumption that the |
| observations included in the model are drawn from a |
| <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html"> |
| Bivariate Normal Distribution</a>.</p> |
| <p> |
| <strong> Preconditions:</strong><ul> |
| <li>If there are fewer that <strong>three</strong> observations in the |
| model, or if there is no variation in x, this returns |
| <code>Double.NaN</code>. |
| </li> |
| <li><code>(0 < alpha < 1)</code>; otherwise an |
| <code>OutOfRangeException</code> is thrown. |
| </li></ul></p></div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>alpha</code> - the desired significance level</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>half-width of 95% confidence interval for the slope estimate</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></code> - if the confidence interval can not be computed.</dd></dl> |
| </li> |
| </ul> |
| <a name="getSignificance()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSignificance</h4> |
| <pre>public double getSignificance()</pre> |
| <div class="block">Returns the significance level of the slope (equiv) correlation. |
| <p> |
| Specifically, the returned value is the smallest <code>alpha</code> |
| such that the slope confidence interval with significance level |
| equal to <code>alpha</code> does not include <code>0</code>. |
| On regression output, this is often denoted <code>Prob(|t| > 0)</code> |
| </p><p> |
| <strong>Usage Note</strong>:<br> |
| The validity of this statistic depends on the assumption that the |
| observations included in the model are drawn from a |
| <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html"> |
| Bivariate Normal Distribution</a>.</p> |
| <p> |
| If there are fewer that <strong>three</strong> observations in the |
| model, or if there is no variation in x, this returns |
| <code>Double.NaN</code>.</p></div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>significance level for slope/correlation</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/MaxCountExceededException.html" title="class in org.apache.commons.math3.exception">MaxCountExceededException</a></code> - if the significance level can not be computed.</dd></dl> |
| </li> |
| </ul> |
| <a name="regress()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>regress</h4> |
| <pre>public <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html" title="class in org.apache.commons.math3.stat.regression">RegressionResults</a> regress() |
| throws <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a>, |
| <a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html" title="class in org.apache.commons.math3.exception">NoDataException</a></pre> |
| <div class="block">Performs a regression on data present in buffers and outputs a RegressionResults object. |
| |
| <p>If there are fewer than 3 observations in the model and <code>hasIntercept</code> is true |
| a <code>NoDataException</code> is thrown. If there is no intercept term, the model must |
| contain at least 2 observations.</p></div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#regress()">regress</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Returns:</span></dt><dd>RegressionResults acts as a container of regression output</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html" title="class in org.apache.commons.math3.stat.regression">ModelSpecificationException</a></code> - if the model is not correctly specified</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html" title="class in org.apache.commons.math3.exception">NoDataException</a></code> - if there is not sufficient data in the model to |
| estimate the regression parameters</dd></dl> |
| </li> |
| </ul> |
| <a name="regress(int[])"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>regress</h4> |
| <pre>public <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html" title="class in org.apache.commons.math3.stat.regression">RegressionResults</a> regress(int[] variablesToInclude) |
| throws <a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></pre> |
| <div class="block">Performs a regression on data present in buffers including only regressors |
| indexed in variablesToInclude and outputs a RegressionResults object</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html#regress(int[])">regress</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface in org.apache.commons.math3.stat.regression">UpdatingMultipleLinearRegression</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>variablesToInclude</code> - an array of indices of regressors to include</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>RegressionResults acts as a container of regression output</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if the variablesToInclude array is null or zero length</dd> |
| <dd><code><a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></code> - if a requested variable is not present in model</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/SimpleRegression.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><a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html" title="class in org.apache.commons.math3.stat.regression"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../../org/apache/commons/math3/stat/regression/UpdatingMultipleLinearRegression.html" title="interface 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/SimpleRegression.html" target="_top">Frames</a></li> |
| <li><a href="SimpleRegression.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> |