Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fit Distribution to Data

Subject: Fit Distribution to Data

From: Alex

Date: 22 Jun, 2010 15:42:06

Message: 1 of 9

Hello I have plotted two different data sets.
http://yfrog.com/0afitdistributionforblueap
Blue and Red data sets
For every different value on axis x I have taken only 10 measurements as it takes so much time for the experiment to run.
I would like to fit two distributions for these two data sets. One for each one. I do not know what function to use in matlab. If I got it right I have to
a)pick one distribution that looks that it will fit (how do you do that)
and
b) change the parameters of the distribution to fit as much with my data. How do you do that??\

I would like to thank you all for your help and contribution.
Best Regards
Alex

Subject: Fit Distribution to Data

From: Peter Perkins

Date: 22 Jun, 2010 16:36:10

Message: 2 of 9

On 6/22/2010 11:42 AM, Alex wrote:
> Hello I have plotted two different data sets.
> http://yfrog.com/0afitdistributionforblueap
> Blue and Red data sets For every different value on axis x I have taken
> only 10 measurements as it takes so much time for the experiment to run.
> I would like to fit two distributions for these two data sets.

Looking at your picture, I don't think you do. I'm guessing you need to
fit two regression curves. Take a look at this demo

<http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/cfitdfitdemo.html>

and see if it helps.

Assuming you do want to fit regression curves, this demo might be helpful:

<http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/wnlsdemo.html>

> One for
> each one. I do not know what function to use in matlab. If I got it
> right I have to
> a)pick one distribution that looks that it will fit (how do you do that)

Noone can help you with that. They're your data. There may be a
"standard method" in whatever application area you are working in.


> and
> b) change the parameters of the distribution to fit as much with my
> data. How do you do that??\

Assuming you're fitting a regression curve, the usual method is by least
squares. A function such as NLINFIT (Statistics Toolbox) or LSQCRVEFIT
(Optimization Toolbox) is probably what you're looking for.

Hope this helps.

Subject: Fit Distribution to Data

From: Alex

Date: 24 Jun, 2010 06:34:19

Message: 3 of 9


I would like to thank you for your help.
Yes you are right I would like to do regression analysis.
So regarding my two plots (red and blue) http://yfrog.com/0afitdistributionforblueap
what do I have to do? The link you gave me writes a few things about weights but I didnt get it.

Best REgards
Alex











Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <hvqopq$jmh$1@fred.mathworks.com>...
> On 6/22/2010 11:42 AM, Alex wrote:
> > Hello I have plotted two different data sets.
> > http://yfrog.com/0afitdistributionforblueap
> > Blue and Red data sets For every different value on axis x I have taken
> > only 10 measurements as it takes so much time for the experiment to run.
> > I would like to fit two distributions for these two data sets.
>
> Looking at your picture, I don't think you do. I'm guessing you need to
> fit two regression curves. Take a look at this demo
>
> <http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/cfitdfitdemo.html>
>
> and see if it helps.
>
> Assuming you do want to fit regression curves, this demo might be helpful:
>
> <http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/wnlsdemo.html>
>
> > One for
> > each one. I do not know what function to use in matlab. If I got it
> > right I have to
> > a)pick one distribution that looks that it will fit (how do you do that)
>
> Noone can help you with that. They're your data. There may be a
> "standard method" in whatever application area you are working in.
>
>
> > and
> > b) change the parameters of the distribution to fit as much with my
> > data. How do you do that??\
>
> Assuming you're fitting a regression curve, the usual method is by least
> squares. A function such as NLINFIT (Statistics Toolbox) or LSQCRVEFIT
> (Optimization Toolbox) is probably what you're looking for.
>
> Hope this helps.

Subject: Fit Distribution to Data

From: Peter Perkins

Date: 24 Jun, 2010 17:08:37

Message: 4 of 9

On 6/24/2010 2:34 AM, Alex wrote:
>
> I would like to thank you for your help.
> Yes you are right I would like to do regression analysis.
> So regarding my two plots (red and blue)
> http://yfrog.com/0afitdistributionforblueap
> what do I have to do? The link you gave me writes a few things about
> weights but I didnt get it.

It appears that you have multiple y values measured at each x value.
One way to fit that kind of data is to just list out all the separate
observations. Another way is to take the mean at each x value, and use
weights equal to the numer of observations at each x value. The second
of the two links I posted demonstrates this.

A function such as NLINFIT (Statistics Toolbox) or LSQCRVEFIT
(Optimization Toolbox) is probably what you're looking for. But as I
said, you are entirely on your own when picking a specific nonlinear
model to fit to the data.

Subject: Fit Distribution to Data

From: Alex

Date: 27 Jun, 2010 17:51:05

Message: 5 of 9

I would like to thank you again for the time you spend for me.
It seems that I managed to do the regression analysis successfully
http://yfrog.com/5cfittedpointsoftheexperip

There are two points that seem to strange at 1.4 and 1.6 one for each line.
I used the function (1+(1+exp(x-b(1)/b(2)))
and matlab created a nice plot for me. :)
I would like to ask you
a) where there are these two strange points in my figure?
b) is it possible to know exactly what are the values of b(1) and b(2)?. So to write down that the function is
c) Is it possible to have two legends in my figure? As you can see there is only one :(

I would like to thank you in advance for your help and cooperation
Best Regards
Alex.


Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <i003el$23j$1@fred.mathworks.com>...
> On 6/24/2010 2:34 AM, Alex wrote:
> >
> > I would like to thank you for your help.
> > Yes you are right I would like to do regression analysis.
> > So regarding my two plots (red and blue)
> > http://yfrog.com/0afitdistributionforblueap
> > what do I have to do? The link you gave me writes a few things about
> > weights but I didnt get it.
>
> It appears that you have multiple y values measured at each x value.
> One way to fit that kind of data is to just list out all the separate
> observations. Another way is to take the mean at each x value, and use
> weights equal to the numer of observations at each x value. The second
> of the two links I posted demonstrates this.
>
> A function such as NLINFIT (Statistics Toolbox) or LSQCRVEFIT
> (Optimization Toolbox) is probably what you're looking for. But as I
> said, you are entirely on your own when picking a specific nonlinear
> model to fit to the data.

Subject: Fit Distribution to Data

From: Alex

Date: 2 Jul, 2010 15:16:04

Message: 6 of 9


 I would like to thank you again for the time you spend for me.
 It seems that I managed to do the regression analysis successfully
 http://yfrog.com/5cfittedpointsoftheexperip
 
 There are two points that seem to strange at 1.4 and 1.6 one for each line.
 I used the function (1+(1+exp(x-b(1)/b(2)))
 and matlab created a nice plot for me. :)
 I would like to ask you
 a) where there are these two strange points in my figure?
 b) is it possible to know exactly what are the values of b(1) and b(2)?. So to write down that the function is
 c) Is it possible to have two legends in my figure? As you can see there is only one :(
 
 I would like to thank you in advance for your help and cooperation
 Best Regards
 Alex.

Subject: Fit Distribution to Data

From: Alex

Date: 5 Jul, 2010 07:54:03

Message: 7 of 9


 I would like to thank you again for the time you spend for me.
 It seems that I managed to do the regression analysis successfully
 http://yfrog.com/5cfittedpointsoftheexperip
 
 There are two points that seem to strange at 1.4 and 1.6 one for each line.
 I used the function (1+(1+exp(x-b(1)/b(2)))
 and matlab created a nice plot for me. :)
 I would like to ask you
 a) where there are these two strange points in my figure?
 b) is it possible to know exactly what are the values of b(1) and b(2)?. So to write down that the function is
 c) Is it possible to have two legends in my figure? As you can see there is only one :(
 
 I would like to thank you in advance for your help and cooperation
 Best Regards
 Alex.

Subject: Fit Distribution to Data

From: us

Date: 5 Jul, 2010 09:13:06

Message: 8 of 9

"Alex " <alaios@yahoo.com> wrote in message <i0s32r$gmc$1@fred.mathworks.com>...
>
> I would like to thank you again for the time you spend for me.
> It seems that I managed to do the regression analysis successfully
> http://yfrog.com/5cfittedpointsoftheexperip
>
> There are two points that seem to strange at 1.4 and 1.6 one for each line.
> I used the function (1+(1+exp(x-b(1)/b(2)))
> and matlab created a nice plot for me. :)
> I would like to ask you
> a) where there are these two strange points in my figure?
> b) is it possible to know exactly what are the values of b(1) and b(2)?. So to write down that the function is
> c) Is it possible to have two legends in my figure? As you can see there is only one :(
>
> I would like to thank you in advance for your help and cooperation
> Best Regards
> Alex.

hmm... are you ...really... happy with your fits(?)...

us

Subject: Fit Distribution to Data

From: Alex

Date: 5 Jul, 2010 09:24:04

Message: 9 of 9

They seem pretty ok to me? Are not they?
Best Regards Alex

"Alex " <alaios@yahoo.com> wrote in message <i0kvrk$hst$1@fred.mathworks.com>...
>
> I would like to thank you again for the time you spend for me.
> It seems that I managed to do the regression analysis successfully
> http://yfrog.com/5cfittedpointsoftheexperip
>
> There are two points that seem to strange at 1.4 and 1.6 one for each line.
> I used the function (1+(1+exp(x-b(1)/b(2)))
> and matlab created a nice plot for me. :)
> I would like to ask you
> a) where there are these two strange points in my figure?
> b) is it possible to know exactly what are the values of b(1) and b(2)?. So to write down that the function is
> c) Is it possible to have two legends in my figure? As you can see there is only one :(
>
> I would like to thank you in advance for your help and cooperation
> Best Regards
> Alex.

Tags for this Thread

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.

Contact us