Finding the mean in a Cumulative Distribution Function

First off, I am working with data from an excel file and trying to model this data as accurately as possible. My function for the model is:F(t)=1-exp(-t/u). Furthermore, it turns out that F(t) is just the cumulative function of f(x)=(1/u)*exp(-x/u). Secondly, F(t) is one column of data in excel file, u is the mean, while t is another column representing time. Essentially, I can plot the exact data on matlab alongside this function F(t) which appears to be a cumulative distribution function. How do I find the mean using matlab? Thank you

5 Comments

@ Oleg deleted my answer referencing expfit based upon you comment. Thanks
@ proecsm: but your answer was correct because you wrote expfit(t) % where t is from F(t), so if he has t he can still fit it.
I tested out the muhat= expfit(F(t)) where F(t) was a column of data in excel associated with certain times. My first question regarding expfit is whether expfit finds the mean distribution of a probability distribution function or a cumulative distribution function. My second problem I had with this expfit command, was that when I did a test of expfit on the probability distribution function f(t)=(1/2)exp(-t/2), I don't get the answer muhat=2, which would be the mean distribution of this probability distribution function.
My CDF is the function on this page: http://www.mathworks.com/help/toolbox/stats/expcdf.html
My data curve looks exactly like that exponential CDF so I just need a way to find the mean given my data. Thanks
Is your input data t? If yes just expfit(t).

Sign in to comment.

Answers (1)

Here is a not very robust algorithm, but might give you some ideas. Basically it finds where the CDF crosses the 63.2% (mean value for exponential distribution) and outputs the corresponding t. Sometimes it outputs an empty matrix and sometimes more than 1 value, which would have to be adjusted for your data set.
x=1:100; % simulated t
y = expcdf(x,20); % simulated F(t), mu = 20
ynorm = y./max(y); % normalize
tol = 1./(2*max(x)); % tolerance (might have to adjust)
idx = find(y>.6321-tol & y<.6321+tol);
mu = x(idx)

3 Comments

mean of exponential distribution is where it crosses 63.2% (1-1/e), not 50% like a normal
Isn't the mean the lambda^-1 or in OP's case 1/u which is exactly what he's trying to find?

Sign in to comment.

Asked:

on 18 Jul 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!