R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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. > par8 = '' > par7 = '' > par6 = '0' > par5 = 'N' > par4 = '2' > par3 = '7' > par2 = '31' > par1 = '51' > ylab = 'density' > xlab = 'value of generated random numbers' > main = 'Histogram of Generated Random Numbers' > #'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) > library(msm) > par1 <- as.numeric(par1) > if (par1 > 10000) par1=10000 #impose restriction on number of random values > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > par4 <- as.numeric(par4) > if (par6 == '0') par6 = 'Sturges' else { + par6 <- as.numeric(par6) + if (par6 > 50) par6 = 50 #impose restriction on the number of bins + } > if (par7 == '') par7 <- -Inf else par7 <- as.numeric(par7) > if (par8 == '') par8 <- Inf else par8 <- as.numeric(par8) > x <- rtnorm(par1,par2,par3,par7,par8) > x <- as.ts(x) #otherwise the fitdistr function does not work properly > if ((par7 == -Inf) & (par8 == Inf)) (r <- fitdistr(x,'normal')) mean sd 30.0357825 6.7334136 ( 0.9428665) ( 0.6667073) > postscript(file="/var/www/rcomp/tmp/1aw041334702330.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > myhist<-hist(x,col=par4,breaks=par6,main=main,ylab=ylab,xlab=xlab,freq=F) > if ((par7 == -Inf) & (par8 == Inf)) { + 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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > if (par5 == 'Y') + { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Index',1,TRUE) + a<-table.element(a,'Value',1,TRUE) + a<-table.row.end(a) + for (i in 1:par1) + { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,x[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/27zys1334702330.tab") + } > if ((par7 == -Inf) & (par8 == Inf)) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Parameter',1,TRUE) + a<-table.element(a,'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,'# simulated values',header=TRUE) + a<-table.element(a,par1) + a<-table.element(a,'-') + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'true mean',header=TRUE) + a<-table.element(a,par2) + a<-table.element(a,'-') + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'true standard deviation',header=TRUE) + a<-table.element(a,par3) + a<-table.element(a,'-') + 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/rcomp/tmp/3vw5u1334702330.tab") + } > > try(system("convert tmp/1aw041334702330.ps tmp/1aw041334702330.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.490 0.300 0.768