R version 2.6.0 (2007-10-03) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(67.79,-26.91,30.99,-18.77,-26.06,39.62,36.86,-9.1,-11.24,-21.38,44.59,-11.39,21.85,-26.16,-4.99,-4.91,-1.79,-26.83,33.37,-7.89,-15.86,-7.42,-8.49,-7.75,-16.48,-6.26,-10.3,-20.38,-17.24,7.36,-14.48,-10.77,24.81,6.58,-13.52,-4.11,22.47,-3.27,-6.94,-10.17,-27.59,31.9,-12.17,-4.74,-21.27,-24.86,-12.32,9.1,-21.64,5.92,-11.46,-5.34,21.99,-11.65,-20.51,-2.17,3.76,36.9,-14.69,-17.61,17.9,-18.37,2.16,-3.95,10.15,42.98,-19.15,-20.55,-1.35,-26.35,27.92,2.7,-9.1,4.35,-23.74,-15.46,-9.79,5.27,20.22,41.01,11.28,28.8,39.47,-35.44,-11.13,7.11,22.63,8.48,-8.98,18.36,-2.96,18.63,23.67,-10.28,-20.36,36.48,-10.37,-28.24,2.67,29.94,-17.95,-23.51,56.06,21.3,-13.57,18.83,-6.87,-31.51,29.43,-22.31,12.73,-7.81,11.48,-7.23,-19.33,-5,-8.33) > par2 = '0' > par1 = '8' > ylab = 'density' > xlab = 'value of data series' > main = 'Histogram and Fitted Normal Density' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Maximum-likelihood Normal Distribution Fitting (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_fitdistrnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (available to developers only). > library(MASS) > par1 <- as.numeric(par1) > if (par2 == '0') par2 = 'Sturges' else par2 <- as.numeric(par2) > x <- as.ts(x) #otherwise the fitdistr function does not work properly > r <- fitdistr(x,'normal') > r mean sd -1.582009e-17 2.114297e+01 ( 1.954668e+00) ( 1.382159e+00) > postscript(file="/var/www/html/rcomp/tmp/1pd6u1200433545.ps",horizontal=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() null device 1 > load(file='/var/www/html/rcomp/createtable') > 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="/var/www/html/rcomp/tmp/2m6331200433545.tab") > > system("convert tmp/1pd6u1200433545.ps tmp/1pd6u1200433545.png") > > > proc.time() user system elapsed 0.633 0.156 0.727