Path: news.mathworks.com!not-for-mail
From: Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: syntax for lognpdf(X,mu,sigma)
Date: Fri, 28 Aug 2009 17:44:03 -0400
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <h79j34$fuj$1@fred.mathworks.com>
References: <h79f7t$4t8$1@fred.mathworks.com>
NNTP-Posting-Host: perkinsp.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1251495844 16339 172.31.57.88 (28 Aug 2009 21:44:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 28 Aug 2009 21:44:04 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <h79f7t$4t8$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:566879


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.