R version 2.13.0 (2011-04-13) Copyright (C) 2011 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. > x <- c(299.9,339.2,374.2,393.5,389.2,381.7,375.2,369,357.4,352.1,346.5,342.9,340.3,328.3,322.9,314.3,308.9,294,285.6,281.2,280.3,278.8,274.5,270.4,263.4,259.9,258,262.7,284.7,311.3,322.1,327,331.3,333.3,321.4,327,320,314.7,316.7,314.4,321.3,318.2,307.2,301.3,287.5,277.7,274.4,258.8,253.3,251,248.4,249.5,246.1,244.5,243.6,244,240.8,249.8,248,259.4,260.5,260.8,261.3,259.5,256.6,257.9,256.5,254.2,253.3,253.8,255.5,257.1,257.3,253.2,252.8,252,250.7,252.2,250,251,253.4,251.2,255.6,261.1,258.9,259.9,261.2,264.7,267.1,266.4,267.7,268.6,267.5,268.5,268.5) > #'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!) > n <- length(x) > c <- array(NA,dim=c(401)) > l <- array(NA,dim=c(401)) > mx <- 0 > mxli <- -999 > for (i in 1:401) + { + l[i] <- (i-201)/100 + if (l[i] != 0) + { + x1 <- (x^l[i] - 1) / l[i] + } else { + x1 <- log(x) + } + c[i] <- cor(qnorm(ppoints(x), mean=0, sd=1),x1) + if (mx < c[i]) + { + mx <- c[i] + mxli <- l[i] + } + } > c [1] -0.7016337 -0.7017154 -0.7017970 -0.7018783 -0.7019595 -0.7020404 [7] -0.7021211 -0.7022016 -0.7022819 -0.7023619 -0.7024418 -0.7025214 [13] -0.7026008 -0.7026801 -0.7027590 -0.7028378 -0.7029164 -0.7029947 [19] -0.7030728 -0.7031507 -0.7032284 -0.7033059 -0.7033831 -0.7034602 [25] -0.7035370 -0.7036136 -0.7036899 -0.7037661 -0.7038420 -0.7039177 [31] -0.7039932 -0.7040684 -0.7041435 -0.7042183 -0.7042929 -0.7043672 [37] -0.7044413 -0.7045153 -0.7045889 -0.7046624 -0.7047356 -0.7048086 [43] -0.7048814 -0.7049540 -0.7050263 -0.7050984 -0.7051702 -0.7052419 [49] -0.7053133 -0.7053845 -0.7054554 -0.7055261 -0.7055966 -0.7056669 [55] -0.7057369 -0.7058067 -0.7058762 -0.7059455 -0.7060146 -0.7060835 [61] -0.7061521 -0.7062205 -0.7062886 -0.7063566 -0.7064242 -0.7064917 [67] -0.7065589 -0.7066258 -0.7066926 -0.7067591 -0.7068253 -0.7068913 [73] -0.7069571 -0.7070226 -0.7070879 -0.7071530 -0.7072178 -0.7072824 [79] -0.7073467 -0.7074108 -0.7074746 -0.7075382 -0.7076016 -0.7076647 [85] -0.7077276 -0.7077902 -0.7078526 -0.7079147 -0.7079766 -0.7080383 [91] -0.7080997 -0.7081608 -0.7082217 -0.7082824 -0.7083428 -0.7084030 [97] -0.7084629 -0.7085225 -0.7085820 -0.7086411 -0.7087000 -0.7087587 [103] -0.7088171 -0.7088753 -0.7089332 -0.7089908 -0.7090482 -0.7091054 [109] -0.7091623 -0.7092189 -0.7092753 -0.7093314 -0.7093873 -0.7094429 [115] -0.7094983 -0.7095534 -0.7096082 -0.7096628 -0.7097172 -0.7097713 [121] -0.7098251 -0.7098786 -0.7099319 -0.7099850 -0.7100378 -0.7100903 [127] -0.7101425 -0.7101945 -0.7102463 -0.7102978 -0.7103490 -0.7103999 [133] -0.7104506 -0.7105010 -0.7105512 -0.7106011 -0.7106507 -0.7107001 [139] -0.7107492 -0.7107980 -0.7108466 -0.7108949 -0.7109429 -0.7109907 [145] -0.7110382 -0.7110854 -0.7111324 -0.7111791 -0.7112255 -0.7112717 [151] -0.7113176 -0.7113632 -0.7114085 -0.7114536 -0.7114984 -0.7115429 [157] -0.7115872 -0.7116312 -0.7116749 -0.7117183 -0.7117615 -0.7118044 [163] -0.7118470 -0.7118893 -0.7119314 -0.7119732 -0.7120147 -0.7120560 [169] -0.7120969 -0.7121376 -0.7121780 -0.7122181 -0.7122580 -0.7122975 [175] -0.7123368 -0.7123758 -0.7124146 -0.7124530 -0.7124912 -0.7125291 [181] -0.7125667 -0.7126040 -0.7126411 -0.7126778 -0.7127143 -0.7127505 [187] -0.7127864 -0.7128220 -0.7128574 -0.7128924 -0.7129272 -0.7129617 [193] -0.7129959 -0.7130298 -0.7130635 -0.7130968 -0.7131299 -0.7131626 [199] -0.7131951 -0.7132273 -0.7132592 -0.7132908 -0.7133221 -0.7133532 [205] -0.7133839 -0.7134144 -0.7134445 -0.7134744 -0.7135040 -0.7135333 [211] -0.7135623 -0.7135910 -0.7136194 -0.7136475 -0.7136753 -0.7137029 [217] -0.7137301 -0.7137571 -0.7137837 -0.7138101 -0.7138361 -0.7138619 [223] -0.7138873 -0.7139125 -0.7139374 -0.7139620 -0.7139862 -0.7140102 [229] -0.7140339 -0.7140573 -0.7140804 -0.7141031 -0.7141256 -0.7141478 [235] -0.7141697 -0.7141913 -0.7142126 -0.7142335 -0.7142542 -0.7142746 [241] -0.7142947 -0.7143145 -0.7143339 -0.7143531 -0.7143720 -0.7143905 [247] -0.7144088 -0.7144267 -0.7144444 -0.7144617 -0.7144787 -0.7144955 [253] -0.7145119 -0.7145280 -0.7145438 -0.7145593 -0.7145745 -0.7145894 [259] -0.7146040 -0.7146183 -0.7146322 -0.7146459 -0.7146592 -0.7146723 [265] -0.7146850 -0.7146974 -0.7147095 -0.7147213 -0.7147328 -0.7147440 [271] -0.7147549 -0.7147654 -0.7147757 -0.7147856 -0.7147952 -0.7148045 [277] -0.7148135 -0.7148222 -0.7148305 -0.7148386 -0.7148463 -0.7148537 [283] -0.7148608 -0.7148676 -0.7148741 -0.7148803 -0.7148861 -0.7148916 [289] -0.7148968 -0.7149017 -0.7149063 -0.7149106 -0.7149145 -0.7149181 [295] -0.7149214 -0.7149244 -0.7149271 -0.7149294 -0.7149315 -0.7149332 [301] -0.7149346 -0.7149357 -0.7149364 -0.7149368 -0.7149369 -0.7149367 [307] -0.7149362 -0.7149354 -0.7149342 -0.7149327 -0.7149309 -0.7149287 [313] -0.7149263 -0.7149235 -0.7149204 -0.7149169 -0.7149132 -0.7149091 [319] -0.7149047 -0.7149000 -0.7148949 -0.7148895 -0.7148838 -0.7148778 [325] -0.7148715 -0.7148648 -0.7148578 -0.7148505 -0.7148428 -0.7148348 [331] -0.7148265 -0.7148179 -0.7148089 -0.7147996 -0.7147900 -0.7147801 [337] -0.7147698 -0.7147592 -0.7147483 -0.7147370 -0.7147255 -0.7147135 [343] -0.7147013 -0.7146887 -0.7146758 -0.7146626 -0.7146490 -0.7146351 [349] -0.7146209 -0.7146064 -0.7145915 -0.7145763 -0.7145607 -0.7145449 [355] -0.7145287 -0.7145121 -0.7144953 -0.7144781 -0.7144605 -0.7144427 [361] -0.7144245 -0.7144060 -0.7143871 -0.7143679 -0.7143484 -0.7143285 [367] -0.7143083 -0.7142878 -0.7142670 -0.7142458 -0.7142242 -0.7142024 [373] -0.7141802 -0.7141577 -0.7141348 -0.7141116 -0.7140881 -0.7140642 [379] -0.7140400 -0.7140155 -0.7139906 -0.7139654 -0.7139399 -0.7139140 [385] -0.7138878 -0.7138612 -0.7138344 -0.7138071 -0.7137796 -0.7137517 [391] -0.7137235 -0.7136949 -0.7136660 -0.7136368 -0.7136072 -0.7135773 [397] -0.7135470 -0.7135165 -0.7134855 -0.7134543 -0.7134227 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1dbh91321538978.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Normality Plot',xlab='Lambda',ylab='correlation') > mtext(paste('Optimal Lambda =',mxli)) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/29wia1321538978.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x,main='Histogram of Original Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/349321321538978.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x1,main='Histogram of Transformed Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/4b7xf1321538978.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5nj8n1321538978.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > qqline(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Box-Cox Normality Plot',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations x',header=TRUE) > a<-table.element(a,n) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum correlation',header=TRUE) > a<-table.element(a,mx) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'optimal lambda',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/67i7i1321538978.tab") > > try(system("convert tmp/1dbh91321538978.ps tmp/1dbh91321538978.png",intern=TRUE)) character(0) > try(system("convert tmp/29wia1321538978.ps tmp/29wia1321538978.png",intern=TRUE)) character(0) > try(system("convert tmp/349321321538978.ps tmp/349321321538978.png",intern=TRUE)) character(0) > try(system("convert tmp/4b7xf1321538978.ps tmp/4b7xf1321538978.png",intern=TRUE)) character(0) > try(system("convert tmp/5nj8n1321538978.ps tmp/5nj8n1321538978.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.407 0.242 1.660