Got Questions? Get Answers.
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:
AIC for CDF fit

Subject: AIC for CDF fit

From: Xiaoxiao Mao

Date: 24 Feb, 2009 09:09:01

Message: 1 of 5

Dear all,

I am trying to use AIC to choose a best fit CDF.
from matlab help, the syntex is aic(model), i am not sure what to put as the model. maybe i put my codes as following, can anyone try to help me by telling me what to put in the place of 'model'.

% if weibull fitting is used
data = random(1:100);
weibfit = cdf('Weibull',data,parm_weib(1),parm_weib(2));
m = aic(model);

Subject: AIC for CDF fit

From: Peter Perkins

Date: 25 Feb, 2009 19:57:59

Message: 2 of 5

Xiaoxiao Mao wrote:
> Dear all,
>
> I am trying to use AIC to choose a best fit CDF.
> from matlab help, the syntex is aic(model), i am not sure what to put as the model. maybe i put my codes as following, can anyone try to help me by telling me what to put in the place of 'model'.
>
> % if weibull fitting is used
> data = random(1:100);
> weibfit = cdf('Weibull',data,parm_weib(1),parm_weib(2));
> m = aic(model);

You're generating random data, and then evaluating the CDF of a distribution, perhaps a distribution that has been estimated from (other?) data. Perhaps you are using WBLFIT from the Statistics Toolbox to estimate the distribution? (If you're using WEIBFIT as your var name indicates, you either have a very old version, or you should use WBLFIT.) If that's the case, you would compute the AIC using WBLLIKE and the number of parameters:

   aic = 2*(wbllike(params,data) + 2) % 2 * (negative log-likelihood + #params)

The AIC function you're trying to use is, I believe, a function from the System Identification Toolbox, and a function that requires you to pass in a model estimated using the functions in that toolbox.

Subject: AIC for CDF fit

From: Xiaoxiao Mao

Date: 26 Feb, 2009 02:34:01

Message: 3 of 5

Thanks a lot, Peter
yes, the wbllike can give me the likelihood for the weibull fit, so as the lognlike. i am also considering the rician, rayleigh and nakagami, but matlab did not provide such funciton for likelihood estimation except i copy from dfittool.
So i am wondering is there method i can get the likelihood by not accessing dfittool, or can i know how matlab calculate the loglikelihood for funciton lognlike and wbllike? is it simplely
log(sum(error^2)/N) % take log of MSE

Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com> wrote in message <go47s7$s23$1@fred.mathworks.com>...

> You're generating random data, and then evaluating the CDF of a distribution, perhaps a distribution that has been estimated from (other?) data. Perhaps you are using WBLFIT from the Statistics Toolbox to estimate the distribution? (If you're using WEIBFIT as your var name indicates, you either have a very old version, or you should use WBLFIT.) If that's the case, you would compute the AIC using WBLLIKE and the number of parameters:
>
> aic = 2*(wbllike(params,data) + 2) % 2 * (negative log-likelihood + #params)
>
> The AIC function you're trying to use is, I believe, a function from the System Identification Toolbox, and a function that requires you to pass in a model estimated using the functions in that toolbox.

Subject: AIC for CDF fit

From: Peter Perkins

Date: 26 Feb, 2009 14:45:09

Message: 4 of 5

Xiaoxiao Mao wrote:
> Thanks a lot, Peter
> yes, the wbllike can give me the likelihood for the weibull fit, so as the lognlike. i am also considering the rician, rayleigh and nakagami, but matlab did not provide such funciton for likelihood estimation except i copy from dfittool.
> So i am wondering is there method i can get the likelihood by not accessing dfittool, or can i know how matlab calculate the loglikelihood for funciton lognlike and wbllike? is it simplely
> log(sum(error^2)/N) % take log of MSE

"edit lognlike wbllike"

Subject: AIC for CDF fit

From: Xiaoxiao Mao

Date: 27 Feb, 2009 03:39:02

Message: 5 of 5

Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com> wrote in message <go69tl$eg1$1@fred.mathworks.com>...

> "edit lognlike wbllike"

Thanks so much, it works

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