# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1328632495 18000 # Node ID 71efccec5936686eaf08af4dab302a7f921d736e # Parent de99dde50ee153653a78b102702a4d5169aba5bb * ols.m: Compute rank if needed. diff -r de99dde50ee1 -r 71efccec5936 scripts/statistics/base/ols.m --- a/scripts/statistics/base/ols.m Tue Feb 07 11:20:29 2012 -0500 +++ b/scripts/statistics/base/ols.m Tue Feb 07 11:34:55 2012 -0500 @@ -121,6 +121,14 @@ r = y - x * beta; endif if (isargout (2)) + + ## z is of full rank, avoid the SVD in rnk + if (p == 0) + rnk = columns (z); + else + rnk = rank (z); + endif + sigma = r' * r / (nr - rnk); endif