From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Best fit line with constrained coefficients
Date: Tue, 11 May 2010 14:50:19 +0000 (UTC)
Organization: Xoran Technologies
Lines: 7
Message-ID: <hsbqrb$22n$>
References: <hs9pck$618$> <hs9r4t$2ko$> <hsa4fg$7fv$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1273589419 2135 (11 May 2010 14:50:19 GMT)
NNTP-Posting-Date: Tue, 11 May 2010 14:50:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:634612

"Nathan " <> wrote in message <hsa4fg$7fv$>...
> I should have been more specific.  While m and b are important, I'd also like to get the MSE, p, and r values for the fit.  Ideally, I was looking for a model option for regstats that let me add constraints to the coefficients.  Something like regstats(X,Y,[>0]).

Well, once you have m and b, you can certainly calculate residuals, their norm, and any other function based on the residuals that you like. If you have simulated ground truth values, then you can also compute MSE and the like by numerical simulation.

The reason that you're not going to find a turn-the-crank method/code for doing error analysis is that, with the slope constrained positive, the parameter estimator is no longer linear/unbiased. The statistical distribution of the estimate is therefore much harder to calculate analytically.