# # Smoothed Histogram of Pseudo-Random Sample from # normal distribution using the Box-Muller method. # Output from writedata_ols_erf.c -- uses just the first # 10,000 lines # # Remove all objects just to be safe # rm(list=ls(all=TRUE)) # # Reads in output from old Scaling Program and produces # Simple Graphs # # rc.file <- "c:/docs_c_summer_course/data_normal.txt" # # Standard fields and their widths for *.ORD files # rc.fields <- c("number","randnorm1","randnorm2") # # rc.fieldWidths <- c(10,13,13) # # Read the Legislator Coordinates # T <- read.fwf(file=rc.file,widths=rc.fieldWidths,as.is=TRUE,col.names=rc.fields) dim(T) random.normal1 <- T[,2] random.normal2 <- T[,3] # # gvdens <- density(random.normal1) hvdens <- density(random.normal2) # ymax1 <- max(gvdens$y) ymax2 <- max(hvdens$y) ymax <- 1.1*max(ymax1,ymax2) # plot(gvdens,xlab="",ylab="", main="", xlim=c(-3.0,3.0),ylim=c(0,ymax),font=2) lines(gvdens,lwd=3,col="red") lines(hvdens,lwd=3,col="blue") # # # Main title mtext("Pseudo-Random Normal Distribution Numbers from C Program",side=3,line=1.50,cex=1.2,font=2) # x-axis title mtext(" X ",side=1,line=2.75,cex=1.2) # y-axis title mtext("Density",side=2,line=2.5,cex=1.2) #