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(-5.97140410767898 + ,-3.6691753651635 + ,3.22573243778312 + ,8.46994742622872 + ,2.36104613837392 + ,2.27810301334516 + ,-1.89643356409454 + ,-5.57048190071753 + ,1.59306810529995 + ,-1.15395525058041 + ,-6.72929075561101 + ,5.66399576285171 + ,0.880403851972294 + ,0.0619490573441767 + ,8.08456537817682 + ,-6.2448790022095 + ,-2.24567792980042 + ,2.59166701507407 + ,0.601813487319091 + ,4.8272769098794 + ,5.09668174354169 + ,-3.33658622020570 + ,5.34417316066118 + ,1.99609666699276 + ,0.415333303125725 + ,-0.900878021038933 + ,-3.09016502696032 + ,-1.53443811684522 + ,5.61627406480226 + ,-0.498380340378351 + ,-0.443356334553083 + ,-2.97096557941350 + ,0.937268288719855 + ,0.471804866159551 + ,-0.0743614606905861 + ,-6.83970786794111 + ,-0.673055658412168 + ,2.52156302681157 + ,-8.65114003996448 + ,-3.54390202061101 + ,-4.50157864426839 + ,-3.61584164436451 + ,-1.48647635742622 + ,1.68874294472572 + ,-6.24526584517324 + ,3.14185515887046 + ,0.155104567902546 + ,-4.48946146647238 + ,1.49426292301859 + ,1.98654130204668 + ,0.431007250964857 + ,2.85327171343702 + ,-1.23006362910736 + ,-0.75554804367637 + ,3.22445276875476 + ,2.02542762552591 + ,-1.38175229238826 + ,0.876881445756102 + ,1.30437448773787 + ,3.669076904569 + ,3.85445968797453) > 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 -2.371381e-16 3.700135e+00 ( 4.737538e-01) ( 3.349945e-01) > postscript(file="/var/www/html/rcomp/tmp/1v0v31200065365.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/2drgg1200065365.tab") > > system("convert tmp/1v0v31200065365.ps tmp/1v0v31200065365.png") > > > proc.time() user system elapsed 0.702 0.180 0.790