Thread Subject: retrieving upper and lower values of confidence bounds in curve fitting toolbox

Subject: retrieving upper and lower values of confidence bounds in curve fitting toolbox

From: Marco Uzielli

Date: 20 Nov, 2009 11:14:06

Message: 1 of 2

Hello,
If I use the following code to perform a nonlinear fit on data:

opts=fitoptions('Method','Nonlinear','Normalize','Off','Robust','Off','start',[1 1]);
ftype=fittype('k1*log(X)+k2','ind','X,'coeff',{'k1','k2'},'options',opts);
[fit,gof,out]=fit(X,Y,ftype)

and obtain the following ouput for "fit":

     General model:
       fit(X) = k1*log(X)+k2
     Coefficients (with 95% confidence bounds):
       k1 = 1.374 (1.372, 1.377)
       k2 = 0.6255 (0.6227, 0.6283)

1) How can I automatically extract the lower and upper bound values (1.372 and 1.377 for k1; 0.6227 and 0.6283, respectively) of the 95% confidence interval in the "fit" output?

2) How can I change the confidence interval?

3) How can I plot the lower and upper bounds of the confidence interval programmatically using the "plot" function (e.g. plot(fit,'-k')?

Thanks.

Subject: retrieving upper and lower values of confidence bounds in curve fitting toolbox

From: Steven Lord

Date: 20 Nov, 2009 14:31:22

Message: 2 of 2


"Marco Uzielli" <muz@georisk.eu> wrote in message
news:he5tlu$243$1@fred.mathworks.com...
> Hello,
> If I use the following code to perform a nonlinear fit on data:
>
> opts=fitoptions('Method','Nonlinear','Normalize','Off','Robust','Off','start',[1
> 1]);
> ftype=fittype('k1*log(X)+k2','ind','X,'coeff',{'k1','k2'},'options',opts);
> [fit,gof,out]=fit(X,Y,ftype)
>
> and obtain the following ouput for "fit":
>
> General model:
> fit(X) = k1*log(X)+k2
> Coefficients (with 95% confidence bounds):
> k1 = 1.374 (1.372, 1.377)
> k2 = 0.6255 (0.6227, 0.6283)
>
> 1) How can I automatically extract the lower and upper bound values (1.372
> and 1.377 for k1; 0.6227 and 0.6283, respectively) of the 95% confidence
> interval in the "fit" output?

Use the CONFINT method.

http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/confint.html

> 2) How can I change the confidence interval?

Either change the data you used to perform the fit, or use the second input
to the CONFINT method if you want to calculate confidence bounds at a
different level of confidence.

> 3) How can I plot the lower and upper bounds of the confidence interval
> programmatically using the "plot" function (e.g. plot(fit,'-k')?

Use the ptype input argument in your call to the fit result object's PLOT
method.

http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/plot.html

Note that these documentation links are to the documentation for the most
recent release of Curve Fitting Toolbox; if you have an older release, check
that release's documentation to make sure the method/option you want to use
is present in that release and was not added to the toolbox in a later
release.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fit Marco Uzielli 20 Nov, 2009 06:14:13
confidence inte... Marco Uzielli 20 Nov, 2009 06:14:13
plotting fit Marco Uzielli 20 Nov, 2009 06:14:13
rssFeed for this Thread

Contact us at files@mathworks.com