Thread Subject: syntax for lognpdf(X,mu,sigma)

Subject: syntax for lognpdf(X,mu,sigma)

From: Nancy Hammond

Date: 28 Aug, 2009 20:38:21

Message: 1 of 2

When x = log(X) ~ N(mu,sigma), X ~ LN(mu, sigma)

I don't find the documentation clear about the data argument in lognpdf

After fitting parameters for X~N(mu,sigma), I get
probabilities > 1 for p = lognpdf(X,mu, sigma)
probabilities < 1 for p = lognpdf((log(X)-mu)/sigma,0,1)

Thanks

nh

Subject: syntax for lognpdf(X,mu,sigma)

From: Peter Perkins

Date: 28 Aug, 2009 21:44:03

Message: 2 of 2

Nancy Hammond wrote:
> When x = log(X) ~ N(mu,sigma), X ~ LN(mu, sigma)
>
> I don't find the documentation clear about the data argument in lognpdf
>
> After fitting parameters for X~N(mu,sigma), I get
> probabilities > 1 for p = lognpdf(X,mu, sigma)
> probabilities < 1 for p = lognpdf((log(X)-mu)/sigma,0,1)

Nancy, if x (as opposed to X) is a vector of data that you've fit a normal distribution to using, say, NORMFIT, and mu and sigma are the fitted parameters, then you'd want to pass X (equivalently exp(x)) into LOGNPDF. So the first line seems like what you'd want.

Are you concerned about "probabilities > 1"? You should not be. These are probability density values, not probabilities. The LN is a continuous distribution.

It might be less confusing if you use LOGNFIT to fit the lognormal directrly to X. Then you need not worry about the parameterization or transformation.

Hope this helps.

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
fitting a logno... Nancy Hammond 28 Aug, 2009 16:39:21
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com