# ::Free Statistics and Forecasting Software::

v1.1.23-r7
Secure website (SSL) | Donate to wessa.net

### :: Random Number Generator - Log-Normal Distribution - Free Statistics Software (Calculator) ::

All rights reserved. The non-commercial (academic) use of this software is free of charge. The only thing that is asked in return is to cite this software when results are used in publications.

This free online software (calculator) generates a specified number of random series for the Log-Normal distribution. The parameters allow you to specify the length of the dataseries to be generated, the mean of the distribution, and the standard error of the distribution.

The generated random numbers are listed in a table (if possible). In addition a histogram is shown of the estimated mean and standard deviation (over all simulated series)

This R module is an illustration of the central limit theorem.

 Send output to: Browser Blue - Charts White Browser Black/White CSV MS Excel MS Word Number of values (?) Mean (?) S.D. (?) Color code (?) List Random Numbers in table? (?) Number of bins (?) Number of series (?) Chart options Width: Height:

 Source code of R module library(MASS) par1 <- as.numeric(par1) par2 <- as.numeric(par2) par2 <- round(par2,2) #rounded (we want to be able to display 10 columns) par3 <- as.numeric(par3) par3 <- round(par3,2) #rounded (we want to be able to display 10 columns) par4 <- as.numeric(par4) if (par6 == "0") par6 = "Sturges" else par6 <- as.numeric(par6) par7 <- as.numeric(par7) x <- array(NA,dim=c(par7,par1)) rest.mean <- array(NA,dim=c(par7)) rest.sd <- array(NA,dim=c(par7)) rsd.mean <- array(NA,dim=c(par7)) rsd.sd <- array(NA,dim=c(par7)) for (i in 1:par7) { x[i,] <- rlnorm(par1,par2,par3) x[i,] <- as.ts(x[i,]) #otherwise the fitdistr function does not work properly dum <- fitdistr(x[i,],"log-normal") rest.mean[i] <- dum\$estimate[1] rest.sd[i] <- dum\$estimate[2] rsd.mean[i] <- dum\$sd[1] rsd.sd[i] <- dum\$sd[2] } nc <- par7 if (nc > 10) nc = 10 if (par5 == "Y") { load(file="createtable") a<-table.start() a<-table.row.start(a) a<-table.element(a,"Index",1,TRUE) for (j in 1:nc) { a<-table.element(a,paste("X",j),1,TRUE) } a<-table.row.end(a) if (nc < par7) { a<-table.row.start(a) a<-table.element(a,"Note: only the first 10 series are displayed",nc+1,TRUE) a<-table.row.end(a) } for (i in 1:par1) { a<-table.row.start(a) a<-table.element(a,i,header=TRUE) for (j in 1:nc) { a<-table.element(a,round(x[j,i],2)) } a<-table.row.end(a) } a<-table.end(a) table.save(a,file="mytable1.tab") } load(file="createtable") a<-table.start() a<-table.row.start(a) a<-table.element(a,"Parameter",1,TRUE) for (j in 1:nc) { a<-table.element(a,paste("X",j,sep=""),1,TRUE) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a," ",1,TRUE) for (j in 1:nc) { a<-table.element(a,"(SD)",1,TRUE) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"# simulated values",header=TRUE) for (j in 1:nc) { a<-table.element(a,par1) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"true mean",header=TRUE) for (j in 1:nc) { a<-table.element(a,par2) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"true standard deviation",header=TRUE) for (j in 1:nc) { a<-table.element(a,par3) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"mean",header=TRUE) for (j in 1:nc) { a<-table.element(a,round(rest.mean[j],2)) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a," ",header=TRUE) for (j in 1:nc) { a<-table.element(a,round(rsd.mean[j],2)) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"standard deviation",header=TRUE) for (j in 1:nc) { a<-table.element(a,round(rest.sd[j],2)) } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a," ",header=TRUE) for (j in 1:nc) { a<-table.element(a,round(rsd.sd[j],2)) } a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab") bitmap(file="test0.png") myhist<-hist(x[1,],col=par4,breaks=par6,main="Histogram of 1st simulated series",ylab="density",xlab="simulated values",freq=F) dev.off() bitmap(file="test1.png") myhist<-hist(rest.mean[],col=par4,breaks=par6,main="Histogram of Estimated Means",ylab="density",xlab="estimated means",freq=F) x <- rest.mean[] dummean <- mean(x) dumsd <- sd(x) curve(1/(dumsd*sqrt(2*pi))*exp(-1/2*((x-dummean)/dumsd)^2),min(x),max(x),add=T) dev.off() bitmap(file="test2.png") myhist<-hist(rest.sd[],col=par4,breaks=par6,main="Histogram of Estimated SDs",ylab="density",xlab="estimated standard deviations",freq=F) x <- rest.sd[] dummean <- mean(x) dumsd <- sd(x) curve(1/(dumsd*sqrt(2*pi))*exp(-1/2*((x-dummean)/dumsd)^2),min(x),max(x),add=T) dev.off()
 Top | Output | Charts | References | History | Feedback

 Cite this software as: Wessa P., (2008), Random Number Generator for the Log-Normal Distribution (v1.0.4) in Free Statistics Software (v1.1.23-r7), Office for Research Development and Education, URL http://www.wessa.net/rwasp_rnglnorm.wasp/ The R code is based on : Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988), The New S Language, Wadsworth & Brooks/Cole.
 Top | Output | Charts | References | History | Feedback
 Top | Output | Charts | References | History | Feedback
 To cite Wessa.net in publications use:Wessa, P. (2013), Free Statistics Software, Office for Research Development and Education, version 1.1.23-r7, URL http://www.wessa.net/ © All rights reserved. Academic license for non-commercial use only. The free use of the scientific content, services, and applications in this website is granted for non commercial use only. In any case, the source (url) should always be clearly displayed. Under no circumstances are you allowed to reproduce, copy or redistribute the design, layout, or any content of this website (for commercial use) including any materials contained herein without the express written permission. Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. We make no warranties or representations as to the accuracy or completeness of such information (or software), and it assumes no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site. Software Version : 1.1.23-r7Algorithms & Software : Patrick Wessa, PhDServer : www.wessa.net

 [Select module] Main Menu Equation Plotter   Scientific Forecasting   Descriptive Statistics -Central Tendency -Variability -Skewness/Kurtosis -Quartiles -Percentiles -Stem and Leaf -Histogram -Kernel Density -Harrell-Davis -Univariate EDA -Bootstrap -Blocked Bootstrap -Mean Plot -SD Plot -(P)ACF -Spectrum -SD Mean-Plot -Variance Reduction -Correlation -Kendall Rank Corr. -Simple Regression -Bivariate KDE -Box-Cox Linearity -Regression Validation -Back-Back Histo. -Partial Correlation -Trivariate Scatter -Kendall tau Matrix -Notched Boxplots -Star Plot   Distributions -Normal ML Fit -Beta ML Fit -Cauchy ML Fit -Exponential ML Fit -Gamma ML Fit -Lognormal ML Fit -Logistic ML Fit -Neg. Binom. ML Fit -Poisson ML Fit -Weibull ML Fit -Tukey lambda PPCC -Box-Cox Normality   Hypothesis Tests -Mean -Skewness/Kurtosis   Multiple Regression -Estimate Equation   About this server

 Home Page Equation Plotter Time Series Analysis Multiple Regression Descriptive Statistics Statistical Distributions Hypothesis Testing Simon Fraser University Aston University Academic citations Computations Archive Search Computations R Project FAQ About Wessa.net Powered by Linux Server status page Any R Server'Herman Ole Andreas Wold''Gwilym Jenkins''Sir Ronald Aylmer Fisher''George Udny Yule''Gertrude Mary Cox''Sir Maurice George Kendall'Installed PackagesHistory list Edit R Code