Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Linear fit forcing zerointercept: How to compute confidence
Date: Fri, 13 Nov 2009 00:07:01 +0000 (UTC)
Organization: University of Arizona
Lines: 31
Message-ID: <hdi7v5$o1j$1@fred.mathworks.com>
References: <hdi0oi$1tj$1@fred.mathworks.com> <fd920462-481c-4e9e-9c7a-201a5a209cf7@u36g2000prn.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1258070821 24627 172.30.248.37 (13 Nov 2009 00:07:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 13 Nov 2009 00:07:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1426877
Xref: news.mathworks.com comp.soft-sys.matlab:584736


Hi,

Thanks for your reply, but I don't think this will actually solve my problem. As I said, I can compute the slope Y = aX by doing "slope = X\Y". That only works when forcing intercept to be (0,0) (my case). Perhaps for intercept different fro (0,0), the link seems to be very helpful. What I would like to do is how to compute the confidence interval that I used to do with polyfit/polyconf functions when I did not have the constraint of zero intercept.

From help polyfit:
...
[p,S] = polyfit(x,y,n)
...
structure S for use with polyval to obtain error estimates or predictions. Structure S contains fields R, df, and normr, for the triangular factor from a QR decomposition of the Vandermonde matrix of X, the degrees of freedom, and the norm of the residuals, respectively...

[y,delta] = polyval(p,x,S)

Thank you,




jrenfree <jrenfree@gmail.com> wrote in message <fd920462-481c-4e9e-9c7a-201a5a209cf7@u36g2000prn.googlegroups.com>...
> On Nov 12, 2:04?pm, "Rafael " <roso...@gmail.com> wrote:
> > Hi,
> >
> > I was using polyfit to fit a line in my data. The nice thing about doing that is that I can actually get the 95% confidence interval as well when I use the polyconf function.
> >
> > [p,S] = polyfit(x,y,1);
> > [Y,DELTA] = polyconf(p,x,S);
> >
> > Now, I need to fit a line but force the intercept to be zero. My understanding is that polyfit cannot be used, and I heard in some of the posts that a simple equation like X\Y will give me the slope. polyconf needs the S variable calculated in polyfit to generate the confidence interval DELTA. Is there any way I can generate this same variable for the new linear fit X\Y or perhaps another way to compute confidence intervals in this case?
> >
> > Thank you,
> 
> http://www.mathworks.com/support/solutions/en/data/1-12BBUC/index.html?product=OP&solution=1-12BBUC