commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r948061 [20/22] - in /websites/production/commons/content/proper/commons-math: ./ xref/ xref/org/apache/commons/math3/ xref/org/apache/commons/math3/analysis/ xref/org/apache/commons/math3/analysis/differentiation/ xref/org/apache/commons/m...
Date Fri, 17 Apr 2015 19:17:18 GMT
Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html Fri Apr 17 19:17:13 2015
@@ -164,124 +164,133 @@
 <a class="jxr_linenumber" name="L156" href="#L156">156</a> <em class="jxr_javadoccomment">     * the {@link #calculateRSquared() R-squared} computation.&lt;/p&gt;</em>
 <a class="jxr_linenumber" name="L157" href="#L157">157</a> <em class="jxr_javadoccomment">     *</em>
 <a class="jxr_linenumber" name="L158" href="#L158">158</a> <em class="jxr_javadoccomment">     * @return SSTO - the total sum of squares</em>
-<a class="jxr_linenumber" name="L159" href="#L159">159</a> <em class="jxr_javadoccomment">     * @throws MathIllegalArgumentException if the sample has not been set or does</em>
-<a class="jxr_linenumber" name="L160" href="#L160">160</a> <em class="jxr_javadoccomment">     * not contain at least 3 observations</em>
-<a class="jxr_linenumber" name="L161" href="#L161">161</a> <em class="jxr_javadoccomment">     * @see #isNoIntercept()</em>
-<a class="jxr_linenumber" name="L162" href="#L162">162</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
-<a class="jxr_linenumber" name="L163" href="#L163">163</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L164" href="#L164">164</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateTotalSumOfSquares() <strong class="jxr_keyword">throws</strong> MathIllegalArgumentException {
-<a class="jxr_linenumber" name="L165" href="#L165">165</a>         <strong class="jxr_keyword">if</strong> (isNoIntercept()) {
-<a class="jxr_linenumber" name="L166" href="#L166">166</a>             <strong class="jxr_keyword">return</strong> StatUtils.sumSq(getY().toArray());
-<a class="jxr_linenumber" name="L167" href="#L167">167</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="L168" href="#L168">168</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/SecondMoment.html">SecondMoment</a>().evaluate(getY().toArray());
-<a class="jxr_linenumber" name="L169" href="#L169">169</a>         }
-<a class="jxr_linenumber" name="L170" href="#L170">170</a>     }
-<a class="jxr_linenumber" name="L171" href="#L171">171</a> 
-<a class="jxr_linenumber" name="L172" href="#L172">172</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L173" href="#L173">173</a> <em class="jxr_javadoccomment">     * Returns the sum of squared residuals.</em>
-<a class="jxr_linenumber" name="L174" href="#L174">174</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L175" href="#L175">175</a> <em class="jxr_javadoccomment">     * @return residual sum of squares</em>
-<a class="jxr_linenumber" name="L176" href="#L176">176</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
-<a class="jxr_linenumber" name="L177" href="#L177">177</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L178" href="#L178">178</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateResidualSumOfSquares() {
-<a class="jxr_linenumber" name="L179" href="#L179">179</a>         <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html">RealVector</a> residuals = calculateResiduals();
-<a class="jxr_linenumber" name="L180" href="#L180">180</a>         <em class="jxr_comment">// No advertised DME, args are valid</em>
-<a class="jxr_linenumber" name="L181" href="#L181">181</a>         <strong class="jxr_keyword">return</strong> residuals.dotProduct(residuals);
-<a class="jxr_linenumber" name="L182" href="#L182">182</a>     }
-<a class="jxr_linenumber" name="L183" href="#L183">183</a> 
-<a class="jxr_linenumber" name="L184" href="#L184">184</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L185" href="#L185">185</a> <em class="jxr_javadoccomment">     * Returns the R-Squared statistic, defined by the formula &lt;pre&gt;</em>
-<a class="jxr_linenumber" name="L186" href="#L186">186</a> <em class="jxr_javadoccomment">     * R&lt;sup&gt;2&lt;/sup&gt; = 1 - SSR / SSTO</em>
-<a class="jxr_linenumber" name="L187" href="#L187">187</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
-<a class="jxr_linenumber" name="L188" href="#L188">188</a> <em class="jxr_javadoccomment">     * where SSR is the {@link #calculateResidualSumOfSquares() sum of squared residuals}</em>
-<a class="jxr_linenumber" name="L189" href="#L189">189</a> <em class="jxr_javadoccomment">     * and SSTO is the {@link #calculateTotalSumOfSquares() total sum of squares}</em>
-<a class="jxr_linenumber" name="L190" href="#L190">190</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L191" href="#L191">191</a> <em class="jxr_javadoccomment">     * @return R-square statistic</em>
-<a class="jxr_linenumber" name="L192" href="#L192">192</a> <em class="jxr_javadoccomment">     * @throws MathIllegalArgumentException if the sample has not been set or does</em>
-<a class="jxr_linenumber" name="L193" href="#L193">193</a> <em class="jxr_javadoccomment">     * not contain at least 3 observations</em>
-<a class="jxr_linenumber" name="L194" href="#L194">194</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
-<a class="jxr_linenumber" name="L195" href="#L195">195</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L196" href="#L196">196</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateRSquared() <strong class="jxr_keyword">throws</strong> MathIllegalArgumentException {
-<a class="jxr_linenumber" name="L197" href="#L197">197</a>         <strong class="jxr_keyword">return</strong> 1 - calculateResidualSumOfSquares() / calculateTotalSumOfSquares();
-<a class="jxr_linenumber" name="L198" href="#L198">198</a>     }
-<a class="jxr_linenumber" name="L199" href="#L199">199</a> 
-<a class="jxr_linenumber" name="L200" href="#L200">200</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L201" href="#L201">201</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Returns the adjusted R-squared statistic, defined by the formula &lt;pre&gt;</em>
-<a class="jxr_linenumber" name="L202" href="#L202">202</a> <em class="jxr_javadoccomment">     * R&lt;sup&gt;2&lt;/sup&gt;&lt;sub&gt;adj&lt;/sub&gt; = 1 - [SSR (n - 1)] / [SSTO (n - p)]</em>
-<a class="jxr_linenumber" name="L203" href="#L203">203</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
-<a class="jxr_linenumber" name="L204" href="#L204">204</a> <em class="jxr_javadoccomment">     * where SSR is the {@link #calculateResidualSumOfSquares() sum of squared residuals},</em>
-<a class="jxr_linenumber" name="L205" href="#L205">205</a> <em class="jxr_javadoccomment">     * SSTO is the {@link #calculateTotalSumOfSquares() total sum of squares}, n is the number</em>
-<a class="jxr_linenumber" name="L206" href="#L206">206</a> <em class="jxr_javadoccomment">     * of observations and p is the number of parameters estimated (including the intercept).&lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L207" href="#L207">207</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L208" href="#L208">208</a> <em class="jxr_javadoccomment">     * &lt;p&gt;If the regression is estimated without an intercept term, what is returned is &lt;pre&gt;</em>
-<a class="jxr_linenumber" name="L209" href="#L209">209</a> <em class="jxr_javadoccomment">     * &lt;code&gt; 1 - (1 - {@link #calculateRSquared()}) * (n / (n - p)) &lt;/code&gt;</em>
-<a class="jxr_linenumber" name="L210" href="#L210">210</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;&lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L211" href="#L211">211</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L212" href="#L212">212</a> <em class="jxr_javadoccomment">     * @return adjusted R-Squared statistic</em>
-<a class="jxr_linenumber" name="L213" href="#L213">213</a> <em class="jxr_javadoccomment">     * @throws MathIllegalArgumentException if the sample has not been set or does</em>
-<a class="jxr_linenumber" name="L214" href="#L214">214</a> <em class="jxr_javadoccomment">     * not contain at least 3 observations</em>
-<a class="jxr_linenumber" name="L215" href="#L215">215</a> <em class="jxr_javadoccomment">     * @see #isNoIntercept()</em>
-<a class="jxr_linenumber" name="L216" href="#L216">216</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
-<a class="jxr_linenumber" name="L217" href="#L217">217</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L218" href="#L218">218</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateAdjustedRSquared() <strong class="jxr_keyword">throws</strong> MathIllegalArgumentException {
-<a class="jxr_linenumber" name="L219" href="#L219">219</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> n = getX().getRowDimension();
-<a class="jxr_linenumber" name="L220" href="#L220">220</a>         <strong class="jxr_keyword">if</strong> (isNoIntercept()) {
-<a class="jxr_linenumber" name="L221" href="#L221">221</a>             <strong class="jxr_keyword">return</strong> 1 - (1 - calculateRSquared()) * (n / (n - getX().getColumnDimension()));
-<a class="jxr_linenumber" name="L222" href="#L222">222</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="L223" href="#L223">223</a>             <strong class="jxr_keyword">return</strong> 1 - (calculateResidualSumOfSquares() * (n - 1)) /
-<a class="jxr_linenumber" name="L224" href="#L224">224</a>                 (calculateTotalSumOfSquares() * (n - getX().getColumnDimension()));
-<a class="jxr_linenumber" name="L225" href="#L225">225</a>         }
-<a class="jxr_linenumber" name="L226" href="#L226">226</a>     }
-<a class="jxr_linenumber" name="L227" href="#L227">227</a> 
-<a class="jxr_linenumber" name="L228" href="#L228">228</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L229" href="#L229">229</a> <em class="jxr_javadoccomment">     * {@inheritDoc}</em>
-<a class="jxr_linenumber" name="L230" href="#L230">230</a> <em class="jxr_javadoccomment">     * &lt;p&gt;This implementation computes and caches the QR decomposition of the X matrix</em>
-<a class="jxr_linenumber" name="L231" href="#L231">231</a> <em class="jxr_javadoccomment">     * once it is successfully loaded.&lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L232" href="#L232">232</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L233" href="#L233">233</a>     @Override
-<a class="jxr_linenumber" name="L234" href="#L234">234</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> newXSampleData(<strong class="jxr_keyword">double</strong>[][] x) {
-<a class="jxr_linenumber" name="L235" href="#L235">235</a>         <strong class="jxr_keyword">super</strong>.newXSampleData(x);
-<a class="jxr_linenumber" name="L236" href="#L236">236</a>         qr = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/linear/QRDecomposition.html">QRDecomposition</a>(getX(), threshold);
-<a class="jxr_linenumber" name="L237" href="#L237">237</a>     }
-<a class="jxr_linenumber" name="L238" href="#L238">238</a> 
-<a class="jxr_linenumber" name="L239" href="#L239">239</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L240" href="#L240">240</a> <em class="jxr_javadoccomment">     * Calculates the regression coefficients using OLS.</em>
-<a class="jxr_linenumber" name="L241" href="#L241">241</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L242" href="#L242">242</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Data for the model must have been successfully loaded using one of</em>
-<a class="jxr_linenumber" name="L243" href="#L243">243</a> <em class="jxr_javadoccomment">     * the {@code newSampleData} methods before invoking this method; otherwise</em>
-<a class="jxr_linenumber" name="L244" href="#L244">244</a> <em class="jxr_javadoccomment">     * a {@code NullPointerException} will be thrown.&lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L245" href="#L245">245</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L246" href="#L246">246</a> <em class="jxr_javadoccomment">     * @return beta</em>
-<a class="jxr_linenumber" name="L247" href="#L247">247</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L248" href="#L248">248</a>     @Override
-<a class="jxr_linenumber" name="L249" href="#L249">249</a>     <strong class="jxr_keyword">protected</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html">RealVector</a> calculateBeta() {
-<a class="jxr_linenumber" name="L250" href="#L250">250</a>         <strong class="jxr_keyword">return</strong> qr.getSolver().solve(getY());
-<a class="jxr_linenumber" name="L251" href="#L251">251</a>     }
-<a class="jxr_linenumber" name="L252" href="#L252">252</a> 
-<a class="jxr_linenumber" name="L253" href="#L253">253</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L254" href="#L254">254</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Calculates the variance-covariance matrix of the regression parameters.</em>
-<a class="jxr_linenumber" name="L255" href="#L255">255</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L256" href="#L256">256</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Var(b) = (X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;</em>
-<a class="jxr_linenumber" name="L257" href="#L257">257</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L258" href="#L258">258</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Uses QR decomposition to reduce (X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;</em>
-<a class="jxr_linenumber" name="L259" href="#L259">259</a> <em class="jxr_javadoccomment">     * to (R&lt;sup&gt;T&lt;/sup&gt;R)&lt;sup&gt;-1&lt;/sup&gt;, with only the top p rows of</em>
-<a class="jxr_linenumber" name="L260" href="#L260">260</a> <em class="jxr_javadoccomment">     * R included, where p = the length of the beta vector.&lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L261" href="#L261">261</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L262" href="#L262">262</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Data for the model must have been successfully loaded using one of</em>
-<a class="jxr_linenumber" name="L263" href="#L263">263</a> <em class="jxr_javadoccomment">     * the {@code newSampleData} methods before invoking this method; otherwise</em>
-<a class="jxr_linenumber" name="L264" href="#L264">264</a> <em class="jxr_javadoccomment">     * a {@code NullPointerException} will be thrown.&lt;/p&gt;</em>
-<a class="jxr_linenumber" name="L265" href="#L265">265</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L266" href="#L266">266</a> <em class="jxr_javadoccomment">     * @return The beta variance-covariance matrix</em>
-<a class="jxr_linenumber" name="L267" href="#L267">267</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L268" href="#L268">268</a>     @Override
-<a class="jxr_linenumber" name="L269" href="#L269">269</a>     <strong class="jxr_keyword">protected</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> calculateBetaVariance() {
-<a class="jxr_linenumber" name="L270" href="#L270">270</a>         <strong class="jxr_keyword">int</strong> p = getX().getColumnDimension();
-<a class="jxr_linenumber" name="L271" href="#L271">271</a>         <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> Raug = qr.getR().getSubMatrix(0, p - 1 , 0, p - 1);
-<a class="jxr_linenumber" name="L272" href="#L272">272</a>         <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> Rinv = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/linear/LUDecomposition.html">LUDecomposition</a>(Raug).getSolver().getInverse();
-<a class="jxr_linenumber" name="L273" href="#L273">273</a>         <strong class="jxr_keyword">return</strong> Rinv.multiply(Rinv.transpose());
-<a class="jxr_linenumber" name="L274" href="#L274">274</a>     }
-<a class="jxr_linenumber" name="L275" href="#L275">275</a> 
-<a class="jxr_linenumber" name="L276" href="#L276">276</a> }
+<a class="jxr_linenumber" name="L159" href="#L159">159</a> <em class="jxr_javadoccomment">     * @throws NullPointerException if the sample has not been set</em>
+<a class="jxr_linenumber" name="L160" href="#L160">160</a> <em class="jxr_javadoccomment">     * @see #isNoIntercept()</em>
+<a class="jxr_linenumber" name="L161" href="#L161">161</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
+<a class="jxr_linenumber" name="L162" href="#L162">162</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L163" href="#L163">163</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateTotalSumOfSquares() {
+<a class="jxr_linenumber" name="L164" href="#L164">164</a>         <strong class="jxr_keyword">if</strong> (isNoIntercept()) {
+<a class="jxr_linenumber" name="L165" href="#L165">165</a>             <strong class="jxr_keyword">return</strong> StatUtils.sumSq(getY().toArray());
+<a class="jxr_linenumber" name="L166" href="#L166">166</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="L167" href="#L167">167</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/SecondMoment.html">SecondMoment</a>().evaluate(getY().toArray());
+<a class="jxr_linenumber" name="L168" href="#L168">168</a>         }
+<a class="jxr_linenumber" name="L169" href="#L169">169</a>     }
+<a class="jxr_linenumber" name="L170" href="#L170">170</a> 
+<a class="jxr_linenumber" name="L171" href="#L171">171</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L172" href="#L172">172</a> <em class="jxr_javadoccomment">     * Returns the sum of squared residuals.</em>
+<a class="jxr_linenumber" name="L173" href="#L173">173</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L174" href="#L174">174</a> <em class="jxr_javadoccomment">     * @return residual sum of squares</em>
+<a class="jxr_linenumber" name="L175" href="#L175">175</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
+<a class="jxr_linenumber" name="L176" href="#L176">176</a> <em class="jxr_javadoccomment">     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular</em>
+<a class="jxr_linenumber" name="L177" href="#L177">177</a> <em class="jxr_javadoccomment">     * @throws NullPointerException if the data for the model have not been loaded</em>
+<a class="jxr_linenumber" name="L178" href="#L178">178</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L179" href="#L179">179</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateResidualSumOfSquares() {
+<a class="jxr_linenumber" name="L180" href="#L180">180</a>         <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html">RealVector</a> residuals = calculateResiduals();
+<a class="jxr_linenumber" name="L181" href="#L181">181</a>         <em class="jxr_comment">// No advertised DME, args are valid</em>
+<a class="jxr_linenumber" name="L182" href="#L182">182</a>         <strong class="jxr_keyword">return</strong> residuals.dotProduct(residuals);
+<a class="jxr_linenumber" name="L183" href="#L183">183</a>     }
+<a class="jxr_linenumber" name="L184" href="#L184">184</a> 
+<a class="jxr_linenumber" name="L185" href="#L185">185</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L186" href="#L186">186</a> <em class="jxr_javadoccomment">     * Returns the R-Squared statistic, defined by the formula &lt;pre&gt;</em>
+<a class="jxr_linenumber" name="L187" href="#L187">187</a> <em class="jxr_javadoccomment">     * R&lt;sup&gt;2&lt;/sup&gt; = 1 - SSR / SSTO</em>
+<a class="jxr_linenumber" name="L188" href="#L188">188</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
+<a class="jxr_linenumber" name="L189" href="#L189">189</a> <em class="jxr_javadoccomment">     * where SSR is the {@link #calculateResidualSumOfSquares() sum of squared residuals}</em>
+<a class="jxr_linenumber" name="L190" href="#L190">190</a> <em class="jxr_javadoccomment">     * and SSTO is the {@link #calculateTotalSumOfSquares() total sum of squares}</em>
+<a class="jxr_linenumber" name="L191" href="#L191">191</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L192" href="#L192">192</a> <em class="jxr_javadoccomment">     * &lt;p&gt;If there is no variance in y, i.e., SSTO = 0, NaN is returned.&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L193" href="#L193">193</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L194" href="#L194">194</a> <em class="jxr_javadoccomment">     * @return R-square statistic</em>
+<a class="jxr_linenumber" name="L195" href="#L195">195</a> <em class="jxr_javadoccomment">     * @throws NullPointerException if the sample has not been set</em>
+<a class="jxr_linenumber" name="L196" href="#L196">196</a> <em class="jxr_javadoccomment">     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular</em>
+<a class="jxr_linenumber" name="L197" href="#L197">197</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
+<a class="jxr_linenumber" name="L198" href="#L198">198</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L199" href="#L199">199</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateRSquared() {
+<a class="jxr_linenumber" name="L200" href="#L200">200</a>         <strong class="jxr_keyword">return</strong> 1 - calculateResidualSumOfSquares() / calculateTotalSumOfSquares();
+<a class="jxr_linenumber" name="L201" href="#L201">201</a>     }
+<a class="jxr_linenumber" name="L202" href="#L202">202</a> 
+<a class="jxr_linenumber" name="L203" href="#L203">203</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L204" href="#L204">204</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Returns the adjusted R-squared statistic, defined by the formula &lt;pre&gt;</em>
+<a class="jxr_linenumber" name="L205" href="#L205">205</a> <em class="jxr_javadoccomment">     * R&lt;sup&gt;2&lt;/sup&gt;&lt;sub&gt;adj&lt;/sub&gt; = 1 - [SSR (n - 1)] / [SSTO (n - p)]</em>
+<a class="jxr_linenumber" name="L206" href="#L206">206</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
+<a class="jxr_linenumber" name="L207" href="#L207">207</a> <em class="jxr_javadoccomment">     * where SSR is the {@link #calculateResidualSumOfSquares() sum of squared residuals},</em>
+<a class="jxr_linenumber" name="L208" href="#L208">208</a> <em class="jxr_javadoccomment">     * SSTO is the {@link #calculateTotalSumOfSquares() total sum of squares}, n is the number</em>
+<a class="jxr_linenumber" name="L209" href="#L209">209</a> <em class="jxr_javadoccomment">     * of observations and p is the number of parameters estimated (including the intercept).&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L210" href="#L210">210</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L211" href="#L211">211</a> <em class="jxr_javadoccomment">     * &lt;p&gt;If the regression is estimated without an intercept term, what is returned is &lt;pre&gt;</em>
+<a class="jxr_linenumber" name="L212" href="#L212">212</a> <em class="jxr_javadoccomment">     * &lt;code&gt; 1 - (1 - {@link #calculateRSquared()}) * (n / (n - p)) &lt;/code&gt;</em>
+<a class="jxr_linenumber" name="L213" href="#L213">213</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L214" href="#L214">214</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L215" href="#L215">215</a> <em class="jxr_javadoccomment">     * &lt;p&gt;If there is no variance in y, i.e., SSTO = 0, NaN is returned.&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L216" href="#L216">216</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L217" href="#L217">217</a> <em class="jxr_javadoccomment">     * @return adjusted R-Squared statistic</em>
+<a class="jxr_linenumber" name="L218" href="#L218">218</a> <em class="jxr_javadoccomment">     * @throws NullPointerException if the sample has not been set</em>
+<a class="jxr_linenumber" name="L219" href="#L219">219</a> <em class="jxr_javadoccomment">     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular</em>
+<a class="jxr_linenumber" name="L220" href="#L220">220</a> <em class="jxr_javadoccomment">     * @see #isNoIntercept()</em>
+<a class="jxr_linenumber" name="L221" href="#L221">221</a> <em class="jxr_javadoccomment">     * @since 2.2</em>
+<a class="jxr_linenumber" name="L222" href="#L222">222</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L223" href="#L223">223</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> calculateAdjustedRSquared() {
+<a class="jxr_linenumber" name="L224" href="#L224">224</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> n = getX().getRowDimension();
+<a class="jxr_linenumber" name="L225" href="#L225">225</a>         <strong class="jxr_keyword">if</strong> (isNoIntercept()) {
+<a class="jxr_linenumber" name="L226" href="#L226">226</a>             <strong class="jxr_keyword">return</strong> 1 - (1 - calculateRSquared()) * (n / (n - getX().getColumnDimension()));
+<a class="jxr_linenumber" name="L227" href="#L227">227</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="L228" href="#L228">228</a>             <strong class="jxr_keyword">return</strong> 1 - (calculateResidualSumOfSquares() * (n - 1)) /
+<a class="jxr_linenumber" name="L229" href="#L229">229</a>                 (calculateTotalSumOfSquares() * (n - getX().getColumnDimension()));
+<a class="jxr_linenumber" name="L230" href="#L230">230</a>         }
+<a class="jxr_linenumber" name="L231" href="#L231">231</a>     }
+<a class="jxr_linenumber" name="L232" href="#L232">232</a> 
+<a class="jxr_linenumber" name="L233" href="#L233">233</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L234" href="#L234">234</a> <em class="jxr_javadoccomment">     * {@inheritDoc}</em>
+<a class="jxr_linenumber" name="L235" href="#L235">235</a> <em class="jxr_javadoccomment">     * &lt;p&gt;This implementation computes and caches the QR decomposition of the X matrix</em>
+<a class="jxr_linenumber" name="L236" href="#L236">236</a> <em class="jxr_javadoccomment">     * once it is successfully loaded.&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L237" href="#L237">237</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L238" href="#L238">238</a>     @Override
+<a class="jxr_linenumber" name="L239" href="#L239">239</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> newXSampleData(<strong class="jxr_keyword">double</strong>[][] x) {
+<a class="jxr_linenumber" name="L240" href="#L240">240</a>         <strong class="jxr_keyword">super</strong>.newXSampleData(x);
+<a class="jxr_linenumber" name="L241" href="#L241">241</a>         qr = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/linear/QRDecomposition.html">QRDecomposition</a>(getX(), threshold);
+<a class="jxr_linenumber" name="L242" href="#L242">242</a>     }
+<a class="jxr_linenumber" name="L243" href="#L243">243</a> 
+<a class="jxr_linenumber" name="L244" href="#L244">244</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L245" href="#L245">245</a> <em class="jxr_javadoccomment">     * Calculates the regression coefficients using OLS.</em>
+<a class="jxr_linenumber" name="L246" href="#L246">246</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L247" href="#L247">247</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Data for the model must have been successfully loaded using one of</em>
+<a class="jxr_linenumber" name="L248" href="#L248">248</a> <em class="jxr_javadoccomment">     * the {@code newSampleData} methods before invoking this method; otherwise</em>
+<a class="jxr_linenumber" name="L249" href="#L249">249</a> <em class="jxr_javadoccomment">     * a {@code NullPointerException} will be thrown.&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L250" href="#L250">250</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L251" href="#L251">251</a> <em class="jxr_javadoccomment">     * @return beta</em>
+<a class="jxr_linenumber" name="L252" href="#L252">252</a> <em class="jxr_javadoccomment">     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular</em>
+<a class="jxr_linenumber" name="L253" href="#L253">253</a> <em class="jxr_javadoccomment">     * @throws NullPointerException if the data for the model have not been loaded</em>
+<a class="jxr_linenumber" name="L254" href="#L254">254</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L255" href="#L255">255</a>     @Override
+<a class="jxr_linenumber" name="L256" href="#L256">256</a>     <strong class="jxr_keyword">protected</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealVector.html">RealVector</a> calculateBeta() {
+<a class="jxr_linenumber" name="L257" href="#L257">257</a>         <strong class="jxr_keyword">return</strong> qr.getSolver().solve(getY());
+<a class="jxr_linenumber" name="L258" href="#L258">258</a>     }
+<a class="jxr_linenumber" name="L259" href="#L259">259</a> 
+<a class="jxr_linenumber" name="L260" href="#L260">260</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L261" href="#L261">261</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Calculates the variance-covariance matrix of the regression parameters.</em>
+<a class="jxr_linenumber" name="L262" href="#L262">262</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L263" href="#L263">263</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Var(b) = (X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;</em>
+<a class="jxr_linenumber" name="L264" href="#L264">264</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L265" href="#L265">265</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Uses QR decomposition to reduce (X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;</em>
+<a class="jxr_linenumber" name="L266" href="#L266">266</a> <em class="jxr_javadoccomment">     * to (R&lt;sup&gt;T&lt;/sup&gt;R)&lt;sup&gt;-1&lt;/sup&gt;, with only the top p rows of</em>
+<a class="jxr_linenumber" name="L267" href="#L267">267</a> <em class="jxr_javadoccomment">     * R included, where p = the length of the beta vector.&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L268" href="#L268">268</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L269" href="#L269">269</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Data for the model must have been successfully loaded using one of</em>
+<a class="jxr_linenumber" name="L270" href="#L270">270</a> <em class="jxr_javadoccomment">     * the {@code newSampleData} methods before invoking this method; otherwise</em>
+<a class="jxr_linenumber" name="L271" href="#L271">271</a> <em class="jxr_javadoccomment">     * a {@code NullPointerException} will be thrown.&lt;/p&gt;</em>
+<a class="jxr_linenumber" name="L272" href="#L272">272</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L273" href="#L273">273</a> <em class="jxr_javadoccomment">     * @return The beta variance-covariance matrix</em>
+<a class="jxr_linenumber" name="L274" href="#L274">274</a> <em class="jxr_javadoccomment">     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular</em>
+<a class="jxr_linenumber" name="L275" href="#L275">275</a> <em class="jxr_javadoccomment">     * @throws NullPointerException if the data for the model have not been loaded</em>
+<a class="jxr_linenumber" name="L276" href="#L276">276</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L277" href="#L277">277</a>     @Override
+<a class="jxr_linenumber" name="L278" href="#L278">278</a>     <strong class="jxr_keyword">protected</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> calculateBetaVariance() {
+<a class="jxr_linenumber" name="L279" href="#L279">279</a>         <strong class="jxr_keyword">int</strong> p = getX().getColumnDimension();
+<a class="jxr_linenumber" name="L280" href="#L280">280</a>         <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> Raug = qr.getR().getSubMatrix(0, p - 1 , 0, p - 1);
+<a class="jxr_linenumber" name="L281" href="#L281">281</a>         <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> Rinv = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/linear/LUDecomposition.html">LUDecomposition</a>(Raug).getSolver().getInverse();
+<a class="jxr_linenumber" name="L282" href="#L282">282</a>         <strong class="jxr_keyword">return</strong> Rinv.multiply(Rinv.transpose());
+<a class="jxr_linenumber" name="L283" href="#L283">283</a>     }
+<a class="jxr_linenumber" name="L284" href="#L284">284</a> 
+<a class="jxr_linenumber" name="L285" href="#L285">285</a> }
 </pre>
 <hr/>
 <div id="footer">Copyright &#169; 2003&#x2013;2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</div>

Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/SimpleRegression.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/SimpleRegression.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/SimpleRegression.html Fri Apr 17 19:17:13 2015
@@ -778,125 +778,115 @@
 <a class="jxr_linenumber" name="L770" href="#L770">770</a> <em class="jxr_javadoccomment">     */</em>
 <a class="jxr_linenumber" name="L771" href="#L771">771</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a> regress() <strong class="jxr_keyword">throws</strong> ModelSpecificationException, NoDataException {
 <a class="jxr_linenumber" name="L772" href="#L772">772</a>         <strong class="jxr_keyword">if</strong> (hasIntercept) {
-<a class="jxr_linenumber" name="L773" href="#L773">773</a>           <strong class="jxr_keyword">if</strong>( n &lt; 3 ){
-<a class="jxr_linenumber" name="L774" href="#L774">774</a>               <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html">NoDataException</a>(LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION);
-<a class="jxr_linenumber" name="L775" href="#L775">775</a>           }
-<a class="jxr_linenumber" name="L776" href="#L776">776</a>           <strong class="jxr_keyword">if</strong>( FastMath.abs( sumXX ) &gt; Precision.SAFE_MIN ){
-<a class="jxr_linenumber" name="L777" href="#L777">777</a>               <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ getIntercept(), getSlope() };
-<a class="jxr_linenumber" name="L778" href="#L778">778</a>               <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> mse = getMeanSquareError();
-<a class="jxr_linenumber" name="L779" href="#L779">779</a>               <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _syy = sumYY + sumY * sumY / n;
-<a class="jxr_linenumber" name="L780" href="#L780">780</a>               <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L781" href="#L781">781</a>                 mse * (xbar *xbar /sumXX + 1.0 / n),
-<a class="jxr_linenumber" name="L782" href="#L782">782</a>                 -xbar*mse/sumXX,
-<a class="jxr_linenumber" name="L783" href="#L783">783</a>                 mse/sumXX };
-<a class="jxr_linenumber" name="L784" href="#L784">784</a>               <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L785" href="#L785">785</a>                       params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 2,
-<a class="jxr_linenumber" name="L786" href="#L786">786</a>                       sumY, _syy, getSumSquaredErrors(),<strong class="jxr_keyword">true</strong>,false);
-<a class="jxr_linenumber" name="L787" href="#L787">787</a>           }<strong class="jxr_keyword">else</strong>{
-<a class="jxr_linenumber" name="L788" href="#L788">788</a>               <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ sumY / n, Double.NaN };
-<a class="jxr_linenumber" name="L789" href="#L789">789</a>               <em class="jxr_comment">//final double mse = getMeanSquareError();</em>
-<a class="jxr_linenumber" name="L790" href="#L790">790</a>               <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L791" href="#L791">791</a>                 ybar / (n - 1.0),
-<a class="jxr_linenumber" name="L792" href="#L792">792</a>                 Double.NaN,
-<a class="jxr_linenumber" name="L793" href="#L793">793</a>                 Double.NaN };
-<a class="jxr_linenumber" name="L794" href="#L794">794</a>               <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L795" href="#L795">795</a>                       params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
-<a class="jxr_linenumber" name="L796" href="#L796">796</a>                       sumY, sumYY, getSumSquaredErrors(),<strong class="jxr_keyword">true</strong>,false);
-<a class="jxr_linenumber" name="L797" href="#L797">797</a>           }
-<a class="jxr_linenumber" name="L798" href="#L798">798</a>         }<strong class="jxr_keyword">else</strong>{
-<a class="jxr_linenumber" name="L799" href="#L799">799</a>           <strong class="jxr_keyword">if</strong> (n &lt; 2) {
-<a class="jxr_linenumber" name="L800" href="#L800">800</a>               <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html">NoDataException</a>(LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION);
-<a class="jxr_linenumber" name="L801" href="#L801">801</a>           }
-<a class="jxr_linenumber" name="L802" href="#L802">802</a>           <strong class="jxr_keyword">if</strong>( !Double.isNaN(sumXX) ){
-<a class="jxr_linenumber" name="L803" href="#L803">803</a>           <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ getMeanSquareError() / sumXX };
-<a class="jxr_linenumber" name="L804" href="#L804">804</a>           <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ sumXY/sumXX };
-<a class="jxr_linenumber" name="L805" href="#L805">805</a>           <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L806" href="#L806">806</a>                       params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
-<a class="jxr_linenumber" name="L807" href="#L807">807</a>                       sumY, sumYY, getSumSquaredErrors(),false,false);
-<a class="jxr_linenumber" name="L808" href="#L808">808</a>           }<strong class="jxr_keyword">else</strong>{
-<a class="jxr_linenumber" name="L809" href="#L809">809</a>           <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{Double.NaN };
-<a class="jxr_linenumber" name="L810" href="#L810">810</a>           <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ Double.NaN };
-<a class="jxr_linenumber" name="L811" href="#L811">811</a>           <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L812" href="#L812">812</a>                       params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
-<a class="jxr_linenumber" name="L813" href="#L813">813</a>                       Double.NaN, Double.NaN, Double.NaN,false,false);
-<a class="jxr_linenumber" name="L814" href="#L814">814</a>           }
-<a class="jxr_linenumber" name="L815" href="#L815">815</a>         }
-<a class="jxr_linenumber" name="L816" href="#L816">816</a>     }
-<a class="jxr_linenumber" name="L817" href="#L817">817</a> 
-<a class="jxr_linenumber" name="L818" href="#L818">818</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L819" href="#L819">819</a> <em class="jxr_javadoccomment">     * Performs a regression on data present in buffers including only regressors</em>
-<a class="jxr_linenumber" name="L820" href="#L820">820</a> <em class="jxr_javadoccomment">     * indexed in variablesToInclude and outputs a RegressionResults object</em>
-<a class="jxr_linenumber" name="L821" href="#L821">821</a> <em class="jxr_javadoccomment">     * @param variablesToInclude an array of indices of regressors to include</em>
-<a class="jxr_linenumber" name="L822" href="#L822">822</a> <em class="jxr_javadoccomment">     * @return RegressionResults acts as a container of regression output</em>
-<a class="jxr_linenumber" name="L823" href="#L823">823</a> <em class="jxr_javadoccomment">     * @throws MathIllegalArgumentException if the variablesToInclude array is null or zero length</em>
-<a class="jxr_linenumber" name="L824" href="#L824">824</a> <em class="jxr_javadoccomment">     * @throws OutOfRangeException if a requested variable is not present in model</em>
-<a class="jxr_linenumber" name="L825" href="#L825">825</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L826" href="#L826">826</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a> regress(<strong class="jxr_keyword">int</strong>[] variablesToInclude) <strong class="jxr_keyword">throws</strong> MathIllegalArgumentException{
-<a class="jxr_linenumber" name="L827" href="#L827">827</a>         <strong class="jxr_keyword">if</strong>( variablesToInclude == <strong class="jxr_keyword">null</strong> || variablesToInclude.length == 0){
-<a class="jxr_linenumber" name="L828" href="#L828">828</a>           <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html">MathIllegalArgumentException</a>(LocalizedFormats.ARRAY_ZERO_LENGTH_OR_NULL_NOT_ALLOWED);
-<a class="jxr_linenumber" name="L829" href="#L829">829</a>         }
-<a class="jxr_linenumber" name="L830" href="#L830">830</a>         <strong class="jxr_keyword">if</strong>( variablesToInclude.length &gt; 2 || (variablesToInclude.length &gt; 1 &amp;&amp; !hasIntercept) ){
-<a class="jxr_linenumber" name="L831" href="#L831">831</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html">ModelSpecificationException</a>(
-<a class="jxr_linenumber" name="L832" href="#L832">832</a>                     LocalizedFormats.ARRAY_SIZE_EXCEEDS_MAX_VARIABLES,
-<a class="jxr_linenumber" name="L833" href="#L833">833</a>                     (variablesToInclude.length &gt; 1 &amp;&amp; !hasIntercept) ? 1 : 2);
-<a class="jxr_linenumber" name="L834" href="#L834">834</a>         }
-<a class="jxr_linenumber" name="L835" href="#L835">835</a> 
-<a class="jxr_linenumber" name="L836" href="#L836">836</a>         <strong class="jxr_keyword">if</strong>( hasIntercept ){
-<a class="jxr_linenumber" name="L837" href="#L837">837</a>             <strong class="jxr_keyword">if</strong>( variablesToInclude.length == 2 ){
-<a class="jxr_linenumber" name="L838" href="#L838">838</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[0] == 1 ){
-<a class="jxr_linenumber" name="L839" href="#L839">839</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html">ModelSpecificationException</a>(LocalizedFormats.NOT_INCREASING_SEQUENCE);
-<a class="jxr_linenumber" name="L840" href="#L840">840</a>                 }<strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong>( variablesToInclude[0] != 0 ){
-<a class="jxr_linenumber" name="L841" href="#L841">841</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>( variablesToInclude[0], 0,1 );
-<a class="jxr_linenumber" name="L842" href="#L842">842</a>                 }
-<a class="jxr_linenumber" name="L843" href="#L843">843</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[1] != 1){
-<a class="jxr_linenumber" name="L844" href="#L844">844</a>                      <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>( variablesToInclude[0], 0,1 );
-<a class="jxr_linenumber" name="L845" href="#L845">845</a>                 }
-<a class="jxr_linenumber" name="L846" href="#L846">846</a>                 <strong class="jxr_keyword">return</strong> regress();
-<a class="jxr_linenumber" name="L847" href="#L847">847</a>             }<strong class="jxr_keyword">else</strong>{
-<a class="jxr_linenumber" name="L848" href="#L848">848</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[0] != 1 &amp;&amp; variablesToInclude[0] != 0 ){
-<a class="jxr_linenumber" name="L849" href="#L849">849</a>                      <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>( variablesToInclude[0],0,1 );
-<a class="jxr_linenumber" name="L850" href="#L850">850</a>                 }
-<a class="jxr_linenumber" name="L851" href="#L851">851</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _mean = sumY * sumY / n;
-<a class="jxr_linenumber" name="L852" href="#L852">852</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _syy = sumYY + _mean;
-<a class="jxr_linenumber" name="L853" href="#L853">853</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[0] == 0 ){
-<a class="jxr_linenumber" name="L854" href="#L854">854</a>                     <em class="jxr_comment">//just the mean</em>
-<a class="jxr_linenumber" name="L855" href="#L855">855</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ sumYY/(((n-1)*n)) };
-<a class="jxr_linenumber" name="L856" href="#L856">856</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ ybar };
-<a class="jxr_linenumber" name="L857" href="#L857">857</a>                     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L858" href="#L858">858</a>                       params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
-<a class="jxr_linenumber" name="L859" href="#L859">859</a>                       sumY, _syy+_mean, sumYY,<strong class="jxr_keyword">true</strong>,false);
-<a class="jxr_linenumber" name="L860" href="#L860">860</a> 
-<a class="jxr_linenumber" name="L861" href="#L861">861</a>                 }<strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong>( variablesToInclude[0] == 1){
-<a class="jxr_linenumber" name="L862" href="#L862">862</a>                     <em class="jxr_comment">//final double _syy = sumYY + sumY * sumY / ((double) n);</em>
-<a class="jxr_linenumber" name="L863" href="#L863">863</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _sxx = sumXX + sumX * sumX / n;
-<a class="jxr_linenumber" name="L864" href="#L864">864</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _sxy = sumXY + sumX * sumY / n;
-<a class="jxr_linenumber" name="L865" href="#L865">865</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _sse = FastMath.max(0d, _syy - _sxy * _sxy / _sxx);
-<a class="jxr_linenumber" name="L866" href="#L866">866</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _mse = _sse/((n-1));
-<a class="jxr_linenumber" name="L867" href="#L867">867</a>                     <strong class="jxr_keyword">if</strong>( !Double.isNaN(_sxx) ){
-<a class="jxr_linenumber" name="L868" href="#L868">868</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ _mse / _sxx };
-<a class="jxr_linenumber" name="L869" href="#L869">869</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ _sxy/_sxx };
-<a class="jxr_linenumber" name="L870" href="#L870">870</a>                         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L871" href="#L871">871</a>                                     params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
-<a class="jxr_linenumber" name="L872" href="#L872">872</a>                                     sumY, _syy, _sse,false,false);
-<a class="jxr_linenumber" name="L873" href="#L873">873</a>                     }<strong class="jxr_keyword">else</strong>{
-<a class="jxr_linenumber" name="L874" href="#L874">874</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{Double.NaN };
-<a class="jxr_linenumber" name="L875" href="#L875">875</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ Double.NaN };
-<a class="jxr_linenumber" name="L876" href="#L876">876</a>                         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
-<a class="jxr_linenumber" name="L877" href="#L877">877</a>                                     params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
-<a class="jxr_linenumber" name="L878" href="#L878">878</a>                                     Double.NaN, Double.NaN, Double.NaN,false,false);
-<a class="jxr_linenumber" name="L879" href="#L879">879</a>                     }
-<a class="jxr_linenumber" name="L880" href="#L880">880</a>                 }
-<a class="jxr_linenumber" name="L881" href="#L881">881</a>             }
-<a class="jxr_linenumber" name="L882" href="#L882">882</a>         }<strong class="jxr_keyword">else</strong>{
-<a class="jxr_linenumber" name="L883" href="#L883">883</a>             <strong class="jxr_keyword">if</strong>( variablesToInclude[0] != 0 ){
-<a class="jxr_linenumber" name="L884" href="#L884">884</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>(variablesToInclude[0],0,0);
-<a class="jxr_linenumber" name="L885" href="#L885">885</a>             }
-<a class="jxr_linenumber" name="L886" href="#L886">886</a>             <strong class="jxr_keyword">return</strong> regress();
-<a class="jxr_linenumber" name="L887" href="#L887">887</a>         }
-<a class="jxr_linenumber" name="L888" href="#L888">888</a> 
-<a class="jxr_linenumber" name="L889" href="#L889">889</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="L890" href="#L890">890</a>     }
-<a class="jxr_linenumber" name="L891" href="#L891">891</a> }
+<a class="jxr_linenumber" name="L773" href="#L773">773</a>             <strong class="jxr_keyword">if</strong> (n &lt; 3) {
+<a class="jxr_linenumber" name="L774" href="#L774">774</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html">NoDataException</a>(LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION);
+<a class="jxr_linenumber" name="L775" href="#L775">775</a>             }
+<a class="jxr_linenumber" name="L776" href="#L776">776</a>             <strong class="jxr_keyword">if</strong> (FastMath.abs(sumXX) &gt; Precision.SAFE_MIN) {
+<a class="jxr_linenumber" name="L777" href="#L777">777</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { getIntercept(), getSlope() };
+<a class="jxr_linenumber" name="L778" href="#L778">778</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> mse = getMeanSquareError();
+<a class="jxr_linenumber" name="L779" href="#L779">779</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _syy = sumYY + sumY * sumY / n;
+<a class="jxr_linenumber" name="L780" href="#L780">780</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { mse * (xbar * xbar / sumXX + 1.0 / n), -xbar * mse / sumXX, mse / sumXX };
+<a class="jxr_linenumber" name="L781" href="#L781">781</a>                 <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] { vcv }, <strong class="jxr_keyword">true</strong>, n, 2, sumY, _syy, getSumSquaredErrors(), <strong class="jxr_keyword">true</strong>,
+<a class="jxr_linenumber" name="L782" href="#L782">782</a>                         false);
+<a class="jxr_linenumber" name="L783" href="#L783">783</a>             } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="L784" href="#L784">784</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { sumY / n, Double.NaN };
+<a class="jxr_linenumber" name="L785" href="#L785">785</a>                 <em class="jxr_comment">// final double mse = getMeanSquareError();</em>
+<a class="jxr_linenumber" name="L786" href="#L786">786</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { ybar / (n - 1.0), Double.NaN, Double.NaN };
+<a class="jxr_linenumber" name="L787" href="#L787">787</a>                 <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] { vcv }, <strong class="jxr_keyword">true</strong>, n, 1, sumY, sumYY, getSumSquaredErrors(), <strong class="jxr_keyword">true</strong>,
+<a class="jxr_linenumber" name="L788" href="#L788">788</a>                         false);
+<a class="jxr_linenumber" name="L789" href="#L789">789</a>             }
+<a class="jxr_linenumber" name="L790" href="#L790">790</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="L791" href="#L791">791</a>             <strong class="jxr_keyword">if</strong> (n &lt; 2) {
+<a class="jxr_linenumber" name="L792" href="#L792">792</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/NoDataException.html">NoDataException</a>(LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION);
+<a class="jxr_linenumber" name="L793" href="#L793">793</a>             }
+<a class="jxr_linenumber" name="L794" href="#L794">794</a>             <strong class="jxr_keyword">if</strong> (!Double.isNaN(sumXX)) {
+<a class="jxr_linenumber" name="L795" href="#L795">795</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { getMeanSquareError() / sumXX };
+<a class="jxr_linenumber" name="L796" href="#L796">796</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { sumXY / sumXX };
+<a class="jxr_linenumber" name="L797" href="#L797">797</a>                 <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] { vcv }, <strong class="jxr_keyword">true</strong>, n, 1, sumY, sumYY, getSumSquaredErrors(), false,
+<a class="jxr_linenumber" name="L798" href="#L798">798</a>                         false);
+<a class="jxr_linenumber" name="L799" href="#L799">799</a>             } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="L800" href="#L800">800</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN };
+<a class="jxr_linenumber" name="L801" href="#L801">801</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN };
+<a class="jxr_linenumber" name="L802" href="#L802">802</a>                 <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] { vcv }, <strong class="jxr_keyword">true</strong>, n, 1, Double.NaN, Double.NaN, Double.NaN, false,
+<a class="jxr_linenumber" name="L803" href="#L803">803</a>                         false);
+<a class="jxr_linenumber" name="L804" href="#L804">804</a>             }
+<a class="jxr_linenumber" name="L805" href="#L805">805</a>         }
+<a class="jxr_linenumber" name="L806" href="#L806">806</a>     }
+<a class="jxr_linenumber" name="L807" href="#L807">807</a> 
+<a class="jxr_linenumber" name="L808" href="#L808">808</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L809" href="#L809">809</a> <em class="jxr_javadoccomment">     * Performs a regression on data present in buffers including only regressors</em>
+<a class="jxr_linenumber" name="L810" href="#L810">810</a> <em class="jxr_javadoccomment">     * indexed in variablesToInclude and outputs a RegressionResults object</em>
+<a class="jxr_linenumber" name="L811" href="#L811">811</a> <em class="jxr_javadoccomment">     * @param variablesToInclude an array of indices of regressors to include</em>
+<a class="jxr_linenumber" name="L812" href="#L812">812</a> <em class="jxr_javadoccomment">     * @return RegressionResults acts as a container of regression output</em>
+<a class="jxr_linenumber" name="L813" href="#L813">813</a> <em class="jxr_javadoccomment">     * @throws MathIllegalArgumentException if the variablesToInclude array is null or zero length</em>
+<a class="jxr_linenumber" name="L814" href="#L814">814</a> <em class="jxr_javadoccomment">     * @throws OutOfRangeException if a requested variable is not present in model</em>
+<a class="jxr_linenumber" name="L815" href="#L815">815</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L816" href="#L816">816</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a> regress(<strong class="jxr_keyword">int</strong>[] variablesToInclude) <strong class="jxr_keyword">throws</strong> MathIllegalArgumentException{
+<a class="jxr_linenumber" name="L817" href="#L817">817</a>         <strong class="jxr_keyword">if</strong>( variablesToInclude == <strong class="jxr_keyword">null</strong> || variablesToInclude.length == 0){
+<a class="jxr_linenumber" name="L818" href="#L818">818</a>           <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html">MathIllegalArgumentException</a>(LocalizedFormats.ARRAY_ZERO_LENGTH_OR_NULL_NOT_ALLOWED);
+<a class="jxr_linenumber" name="L819" href="#L819">819</a>         }
+<a class="jxr_linenumber" name="L820" href="#L820">820</a>         <strong class="jxr_keyword">if</strong>( variablesToInclude.length &gt; 2 || (variablesToInclude.length &gt; 1 &amp;&amp; !hasIntercept) ){
+<a class="jxr_linenumber" name="L821" href="#L821">821</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html">ModelSpecificationException</a>(
+<a class="jxr_linenumber" name="L822" href="#L822">822</a>                     LocalizedFormats.ARRAY_SIZE_EXCEEDS_MAX_VARIABLES,
+<a class="jxr_linenumber" name="L823" href="#L823">823</a>                     (variablesToInclude.length &gt; 1 &amp;&amp; !hasIntercept) ? 1 : 2);
+<a class="jxr_linenumber" name="L824" href="#L824">824</a>         }
+<a class="jxr_linenumber" name="L825" href="#L825">825</a> 
+<a class="jxr_linenumber" name="L826" href="#L826">826</a>         <strong class="jxr_keyword">if</strong>( hasIntercept ){
+<a class="jxr_linenumber" name="L827" href="#L827">827</a>             <strong class="jxr_keyword">if</strong>( variablesToInclude.length == 2 ){
+<a class="jxr_linenumber" name="L828" href="#L828">828</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[0] == 1 ){
+<a class="jxr_linenumber" name="L829" href="#L829">829</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/ModelSpecificationException.html">ModelSpecificationException</a>(LocalizedFormats.NOT_INCREASING_SEQUENCE);
+<a class="jxr_linenumber" name="L830" href="#L830">830</a>                 }<strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong>( variablesToInclude[0] != 0 ){
+<a class="jxr_linenumber" name="L831" href="#L831">831</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>( variablesToInclude[0], 0,1 );
+<a class="jxr_linenumber" name="L832" href="#L832">832</a>                 }
+<a class="jxr_linenumber" name="L833" href="#L833">833</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[1] != 1){
+<a class="jxr_linenumber" name="L834" href="#L834">834</a>                      <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>( variablesToInclude[0], 0,1 );
+<a class="jxr_linenumber" name="L835" href="#L835">835</a>                 }
+<a class="jxr_linenumber" name="L836" href="#L836">836</a>                 <strong class="jxr_keyword">return</strong> regress();
+<a class="jxr_linenumber" name="L837" href="#L837">837</a>             }<strong class="jxr_keyword">else</strong>{
+<a class="jxr_linenumber" name="L838" href="#L838">838</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[0] != 1 &amp;&amp; variablesToInclude[0] != 0 ){
+<a class="jxr_linenumber" name="L839" href="#L839">839</a>                      <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>( variablesToInclude[0],0,1 );
+<a class="jxr_linenumber" name="L840" href="#L840">840</a>                 }
+<a class="jxr_linenumber" name="L841" href="#L841">841</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _mean = sumY * sumY / n;
+<a class="jxr_linenumber" name="L842" href="#L842">842</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _syy = sumYY + _mean;
+<a class="jxr_linenumber" name="L843" href="#L843">843</a>                 <strong class="jxr_keyword">if</strong>( variablesToInclude[0] == 0 ){
+<a class="jxr_linenumber" name="L844" href="#L844">844</a>                     <em class="jxr_comment">//just the mean</em>
+<a class="jxr_linenumber" name="L845" href="#L845">845</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ sumYY/(((n-1)*n)) };
+<a class="jxr_linenumber" name="L846" href="#L846">846</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ ybar };
+<a class="jxr_linenumber" name="L847" href="#L847">847</a>                     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
+<a class="jxr_linenumber" name="L848" href="#L848">848</a>                       params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
+<a class="jxr_linenumber" name="L849" href="#L849">849</a>                       sumY, _syy+_mean, sumYY,<strong class="jxr_keyword">true</strong>,false);
+<a class="jxr_linenumber" name="L850" href="#L850">850</a> 
+<a class="jxr_linenumber" name="L851" href="#L851">851</a>                 }<strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong>( variablesToInclude[0] == 1){
+<a class="jxr_linenumber" name="L852" href="#L852">852</a>                     <em class="jxr_comment">//final double _syy = sumYY + sumY * sumY / ((double) n);</em>
+<a class="jxr_linenumber" name="L853" href="#L853">853</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _sxx = sumXX + sumX * sumX / n;
+<a class="jxr_linenumber" name="L854" href="#L854">854</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _sxy = sumXY + sumX * sumY / n;
+<a class="jxr_linenumber" name="L855" href="#L855">855</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _sse = FastMath.max(0d, _syy - _sxy * _sxy / _sxx);
+<a class="jxr_linenumber" name="L856" href="#L856">856</a>                     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> _mse = _sse/((n-1));
+<a class="jxr_linenumber" name="L857" href="#L857">857</a>                     <strong class="jxr_keyword">if</strong>( !Double.isNaN(_sxx) ){
+<a class="jxr_linenumber" name="L858" href="#L858">858</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ _mse / _sxx };
+<a class="jxr_linenumber" name="L859" href="#L859">859</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ _sxy/_sxx };
+<a class="jxr_linenumber" name="L860" href="#L860">860</a>                         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
+<a class="jxr_linenumber" name="L861" href="#L861">861</a>                                     params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
+<a class="jxr_linenumber" name="L862" href="#L862">862</a>                                     sumY, _syy, _sse,false,false);
+<a class="jxr_linenumber" name="L863" href="#L863">863</a>                     }<strong class="jxr_keyword">else</strong>{
+<a class="jxr_linenumber" name="L864" href="#L864">864</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] vcv = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{Double.NaN };
+<a class="jxr_linenumber" name="L865" href="#L865">865</a>                         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] params = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{ Double.NaN };
+<a class="jxr_linenumber" name="L866" href="#L866">866</a>                         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/stat/regression/RegressionResults.html">RegressionResults</a>(
+<a class="jxr_linenumber" name="L867" href="#L867">867</a>                                     params, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][]{vcv}, <strong class="jxr_keyword">true</strong>, n, 1,
+<a class="jxr_linenumber" name="L868" href="#L868">868</a>                                     Double.NaN, Double.NaN, Double.NaN,false,false);
+<a class="jxr_linenumber" name="L869" href="#L869">869</a>                     }
+<a class="jxr_linenumber" name="L870" href="#L870">870</a>                 }
+<a class="jxr_linenumber" name="L871" href="#L871">871</a>             }
+<a class="jxr_linenumber" name="L872" href="#L872">872</a>         }<strong class="jxr_keyword">else</strong>{
+<a class="jxr_linenumber" name="L873" href="#L873">873</a>             <strong class="jxr_keyword">if</strong>( variablesToInclude[0] != 0 ){
+<a class="jxr_linenumber" name="L874" href="#L874">874</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>(variablesToInclude[0],0,0);
+<a class="jxr_linenumber" name="L875" href="#L875">875</a>             }
+<a class="jxr_linenumber" name="L876" href="#L876">876</a>             <strong class="jxr_keyword">return</strong> regress();
+<a class="jxr_linenumber" name="L877" href="#L877">877</a>         }
+<a class="jxr_linenumber" name="L878" href="#L878">878</a> 
+<a class="jxr_linenumber" name="L879" href="#L879">879</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="L880" href="#L880">880</a>     }
+<a class="jxr_linenumber" name="L881" href="#L881">881</a> }
 </pre>
 <hr/>
 <div id="footer">Copyright &#169; 2003&#x2013;2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</div>

Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/package-frame.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/package-frame.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/package-frame.html Fri Apr 17 19:17:13 2015
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache Commons Math 3.4.1 Reference Package org.apache.commons.math3.stat.regression</title>
+		<title>Apache Commons Math 3.5 Reference Package org.apache.commons.math3.stat.regression</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/package-summary.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/package-summary.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/regression/package-summary.html Fri Apr 17 19:17:13 2015
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache Commons Math 3.4.1 Reference Package org.apache.commons.math3.stat.regression</title>
+		<title>Apache Commons Math 3.5 Reference Package org.apache.commons.math3.stat.regression</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/transform/package-frame.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/transform/package-frame.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/transform/package-frame.html Fri Apr 17 19:17:13 2015
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache Commons Math 3.4.1 Reference Package org.apache.commons.math3.transform</title>
+		<title>Apache Commons Math 3.5 Reference Package org.apache.commons.math3.transform</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/transform/package-summary.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/transform/package-summary.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/transform/package-summary.html Fri Apr 17 19:17:13 2015
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache Commons Math 3.4.1 Reference Package org.apache.commons.math3.transform</title>
+		<title>Apache Commons Math 3.5 Reference Package org.apache.commons.math3.transform</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>



Mime
View raw message