R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(54,59,49,65,68,71,48,50,46,40,37,47,32,42,31,60,36,54,46,42,21,20,7,45,51,47,33,8,46,28,34,33,46,56,58,51,32,24,29,45,54,41,41,39,38,57,51,51,61,40,39,37,43,29,34,46,43,51,30,45,63,69,58,54,55,41,32,61,61,52,46,58,67,69,43,25,31,39,53,43,48,58,59,14,12,33,39,52,28,13,18,34,44,54,37,40,45,41,55,39,38,52,31,38,40,38,44,63,54,39,50,41,37,30,44,51,14,-7,10,34,58,36,31,42,31,23,27,51,46,41,51,46,59,74,67,71,53,58,51,32,59,55,55,33,54,71,36,48,35,44,51,63,60,41,21,44,48,48,28,36,45,39,47,36,49,55,33,34,52,11,42,29,37,49,60,23,13,12,19,17,35,34,43,57,42,49,41,55,34,17,36,54,50,60,73,64,71,39,73,62,58,72,31,41,45,35,27,36,57,57,62,62,43,60,76,75,48,54,67,48,60,71,62,36,54,57,58,63,29,32,48,31,33,34,49,36,46,34,40,48,46,28,34,35,28,35,33,25,26,43,50,33,38,35,39,39,46,40,9,5,27,35,19,38,30,32,30,43,26,43,32,47,50,67,42,33,30,28,39,42,42,47,46,45,49,43,40,29,41,46,54,54,36,69,64,57,48,43,74,66) > 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: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > 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 43.4066667 14.4858997 ( 0.8363438) ( 0.5913844) > postscript(file="/var/www/html/freestat/rcomp/tmp/16gtn1234226562.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 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/2ud641234226562.tab") > > system("convert tmp/16gtn1234226562.ps tmp/16gtn1234226562.png") > > > proc.time() user system elapsed 0.592 0.229 0.647