source('/home/pw/wessanet/cretab') myrfcuid = '' x <- c(147.2,149.5,149.9,151.1,151.1,152.0,152.0,152.4,152.4,152.4,152.4,153.4,154.4,154.5,154.9,154.9,155.0,155.0,155.8,156.0,156.0,156.0,156.2,156.2,156.5,157.0,157.0,157.5,157.5,157.5,157.5,157.5,157.5,157.5,157.5,158.0,158.2,158.8,158.8,159.0,159.0,159.1,159.2,159.4,159.4,159.5,159.5,159.5,159.8,159.8,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.0,160.2,160.2,160.7,160.7,160.7,160.9,161.0,161.0,161.2,161.2,161.2,161.3,161.3,161.3,161.3,161.3,161.3,161.3,161.4,162.0,162.0,162.1,162.1,162.2,162.5,162.5,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.6,162.8,162.8,162.9,163.0,163.0,163.2,163.2,163.2,163.2,163.5,163.5,163.8,163.8,163.8,164.0,164.0,164.1,164.3,164.4,164.5,164.5,164.5,165.0,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.1,165.5,165.7,166.0,166.0,166.2,166.4,166.4,166.4,166.8,166.8,167.0,167.1,167.5,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.6,167.8,168.2,168.2,168.3,168.5,168.9,168.9,168.9,168.9,168.9,168.9,168.9,168.9,169.0,169.0,169.4,169.5,169.5,169.5,170.0,170.0,170.0,170.0,170.0,170.0,170.2,170.2,170.2,170.2,170.2,170.2,170.2,170.2,170.2,170.2,170.3,170.5,170.5,170.9,171.4,171.8,172.1,172.5,172.7,172.7,172.7,172.7,172.7,172.7,172.7,172.9,173.0,173.2,173.2,173.4,174.0,174.0,174.0,174.0,174.0,174.0,175.0,175.0,175.2,175.2,175.2,175.3,175.3,175.3,175.3,175.3,176.2,176.2,176.5,176.5,176.5,176.5,177.8,178.0,179.8,179.9,180.3,182.9) par2 = '0' par1 = '8' ylab = 'density' xlab = 'value of data series' main = 'Histogram Female Heights' par2 <- '0' par1 <- '8' #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Tue, 05 Jan 2021 15:34:21 +0100) #Author: root #To cite this work: Wessa P., (2021), Maximum-likelihood Normal Distribution Fitting and QQ Plot (v1.0.9) in Free Statistics Software (v$_version), Office for Research Development and Education, URL https://www.wessa.net/rwasp_fitdistrnorm.wasp/ #Source of accompanying publication: Office for Research, Development, and Education # library(MASS) library(car) par1 <- as.numeric(par1) if (par2 == '0') par2 = 'Sturges' else par2 <- as.numeric(par2) x <- na.omit(x) x <- as.ts(x) #otherwise the fitdistr function does not work properly r <- fitdistr(x,'normal') print(r) postscript(file="/home/pw/wessanet/rcomp/tmp/18owh1612646143.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) myhist<-hist(x,col=par1,breaks=par2,main=main,ylab=ylab,xlab=xlab,freq=F) curve(1/(r$estimate[2]*sqrt(2*pi))*exp(-1/2*((x-r$estimate[1])/r$estimate[2])^2),min(x),max(x),add=T) dev.off() postscript(file="/home/pw/wessanet/rcomp/tmp/2pljm1612646143.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) qqPlot(x,dist='norm',main='QQ plot (Normal) with confidence intervals') grid() dev.off() a<-table.start() a<-table.row.start(a) a<-table.element(a,'Parameter',1,TRUE) a<-table.element(a,'Estimated Value',1,TRUE) a<-table.element(a,'Standard Deviation',1,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'mean',header=TRUE) a<-table.element(a,r$estimate[1]) a<-table.element(a,r$sd[1]) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'standard deviation',header=TRUE) a<-table.element(a,r$estimate[2]) a<-table.element(a,r$sd[2]) a<-table.row.end(a) a<-table.end(a) table.save(a,file="/home/pw/wessanet/rcomp/tmp/3udyy1612646143.tab") try(system("convert /home/pw/wessanet/rcomp/tmp/18owh1612646143.ps /home/pw/wessanet/rcomp/tmp/18owh1612646143.png",intern=TRUE)) try(system("convert /home/pw/wessanet/rcomp/tmp/2pljm1612646143.ps /home/pw/wessanet/rcomp/tmp/2pljm1612646143.png",intern=TRUE))