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(2.97,3.04,3.12,3.21,3.34,3.45,3.74,4.02,4.24,4.87,5.62,6.02,5.98,5.89,5.76,5.58,5.39,5.19,5.16,5.2,5.25,5.26,5.21,5.18,5.13,5.03,5.01,4.87,4.86,4.82,4.69,4.65,4.61,4.47,4.37,4.29,4.2,4.19,4.09,3.88,3.87,3.74,3.61,3.43,3.29,3.18,3.07,3.02,2.97,2.98,3.01,3.06,3.12,3.16,3.19,3.21,3.27,3.36,3.45,3.52,3.58,3.62,3.5,3.43,3.41,3.48,3.63,3.76,3.8,3.72,3.67,3.58,3.47,3.43,3.55,3.65,3.7,3.7,3.93,4.15,4.24) > 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 4.05382716 0.85424657 (0.09491629) (0.06711595) > postscript(file="/var/www/html/freestat/rcomp/tmp/1ldjd1258036000.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/2cnzh1258036000.tab") > > system("convert tmp/1ldjd1258036000.ps tmp/1ldjd1258036000.png") > > > proc.time() user system elapsed 0.581 0.224 0.661