Solved – How to estimate parameters of a log-normal distribution

lognormal distributionmaximum likelihood

I am using income data from the Current Population Survey for a small undergrad economics paper.

In economics, there is evidence that the income of 97%–99% of the population is distributed log-normally. The distribution of higher-income individuals follows a Pareto distribution.

I have used kernel density estimation to plot the lower 99% and the graph does appear to be log-normal. But I would like to estimate mu and sigma; how do I go about this?

I have been reading about maximum likelihood estimation. But I'm just not sure how to calculate this when I have 200,000 rows of information. Do I have to write my own algorithm to sum over all of my x's? Or is there a built-in function I could use?

I would ideally like to do this in R or Stata.

Best Answer

I am not sure if this question belongs to stats.stackexchange. Anyhow you don't need to write any function! Here is how to generate a random sample from a lognormal distribution and then estimate parameters in R.

> #Generate 200,000 random sample from a lognormal distribution with mean .5 and s.d.=2 
> x=rlnorm(200000, meanlog = .5, sdlog = 2)
> #Load package MASS
> library(MASS)
> #M.L. estimate of the parameters
> fitdistr( x, densfun = "log-normal")
     meanlog        sdlog   
  0.491560746   1.999413446 
 (0.004470824) (0.003161350)
> 
Related Question