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

Contact us at files@mathworks.com