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(24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68) > #'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.8833497 0.8834924 0.8836343 0.8837755 0.8839159 0.8840556 0.8841945 [8] 0.8843326 0.8844699 0.8846065 0.8847423 0.8848773 0.8850116 0.8851450 [15] 0.8852777 0.8854095 0.8855406 0.8856709 0.8858004 0.8859291 0.8860570 [22] 0.8861840 0.8863103 0.8864357 0.8865603 0.8866841 0.8868071 0.8869293 [29] 0.8870506 0.8871711 0.8872908 0.8874096 0.8875276 0.8876447 0.8877610 [36] 0.8878764 0.8879910 0.8881047 0.8882176 0.8883296 0.8884408 0.8885511 [43] 0.8886605 0.8887690 0.8888767 0.8889834 0.8890893 0.8891944 0.8892985 [50] 0.8894017 0.8895041 0.8896055 0.8897061 0.8898057 0.8899045 0.8900023 [57] 0.8900992 0.8901952 0.8902903 0.8903845 0.8904778 0.8905701 0.8906615 [64] 0.8907520 0.8908415 0.8909301 0.8910178 0.8911045 0.8911903 0.8912752 [71] 0.8913590 0.8914420 0.8915240 0.8916050 0.8916850 0.8917641 0.8918423 [78] 0.8919194 0.8919956 0.8920708 0.8921451 0.8922183 0.8922906 0.8923619 [85] 0.8924322 0.8925015 0.8925698 0.8926372 0.8927035 0.8927688 0.8928331 [92] 0.8928965 0.8929588 0.8930201 0.8930803 0.8931396 0.8931978 0.8932551 [99] 0.8933113 0.8933664 0.8934206 0.8934737 0.8935258 0.8935768 0.8936268 [106] 0.8936758 0.8937237 0.8937705 0.8938164 0.8938611 0.8939048 0.8939475 [113] 0.8939891 0.8940296 0.8940691 0.8941075 0.8941448 0.8941811 0.8942163 [120] 0.8942504 0.8942834 0.8943154 0.8943463 0.8943761 0.8944048 0.8944324 [127] 0.8944589 0.8944844 0.8945087 0.8945319 0.8945541 0.8945751 0.8945950 [134] 0.8946138 0.8946316 0.8946482 0.8946637 0.8946780 0.8946913 0.8947034 [141] 0.8947144 0.8947243 0.8947331 0.8947407 0.8947473 0.8947526 0.8947569 [148] 0.8947600 0.8947620 0.8947628 0.8947625 0.8947611 0.8947585 0.8947547 [155] 0.8947498 0.8947438 0.8947366 0.8947283 0.8947188 0.8947081 0.8946963 [162] 0.8946833 0.8946692 0.8946539 0.8946374 0.8946198 0.8946010 0.8945810 [169] 0.8945599 0.8945375 0.8945140 0.8944894 0.8944635 0.8944365 0.8944083 [176] 0.8943789 0.8943483 0.8943165 0.8942836 0.8942494 0.8942141 0.8941776 [183] 0.8941399 0.8941010 0.8940609 0.8940196 0.8939771 0.8939334 0.8938885 [190] 0.8938424 0.8937951 0.8937466 0.8936969 0.8936459 0.8935938 0.8935405 [197] 0.8934859 0.8934302 0.8933732 0.8933151 0.8932557 0.8931951 0.8931332 [204] 0.8930702 0.8930060 0.8929405 0.8928738 0.8928059 0.8927368 0.8926664 [211] 0.8925948 0.8925220 0.8924480 0.8923728 0.8922963 0.8922186 0.8921397 [218] 0.8920595 0.8919782 0.8918956 0.8918117 0.8917267 0.8916404 0.8915528 [225] 0.8914641 0.8913741 0.8912829 0.8911904 0.8910968 0.8910018 0.8909057 [232] 0.8908083 0.8907097 0.8906098 0.8905087 0.8904064 0.8903029 0.8901981 [239] 0.8900920 0.8899848 0.8898763 0.8897665 0.8896556 0.8895433 0.8894299 [246] 0.8893152 0.8891993 0.8890821 0.8889638 0.8888441 0.8887233 0.8886012 [253] 0.8884778 0.8883532 0.8882274 0.8881004 0.8879721 0.8878426 0.8877118 [260] 0.8875799 0.8874466 0.8873122 0.8871765 0.8870396 0.8869014 0.8867620 [267] 0.8866214 0.8864796 0.8863365 0.8861922 0.8860466 0.8858999 0.8857519 [274] 0.8856026 0.8854522 0.8853005 0.8851476 0.8849934 0.8848381 0.8846815 [281] 0.8845237 0.8843646 0.8842044 0.8840429 0.8838802 0.8837163 0.8835511 [288] 0.8833848 0.8832172 0.8830484 0.8828784 0.8827072 0.8825348 0.8823611 [295] 0.8821862 0.8820102 0.8818329 0.8816544 0.8814747 0.8812938 0.8811117 [302] 0.8809284 0.8807439 0.8805582 0.8803712 0.8801831 0.8799938 0.8798033 [309] 0.8796116 0.8794187 0.8792246 0.8790293 0.8788329 0.8786352 0.8784364 [316] 0.8782363 0.8780351 0.8778327 0.8776292 0.8774244 0.8772185 0.8770114 [323] 0.8768031 0.8765936 0.8763830 0.8761712 0.8759582 0.8757441 0.8755288 [330] 0.8753123 0.8750947 0.8748759 0.8746560 0.8744349 0.8742126 0.8739892 [337] 0.8737647 0.8735390 0.8733121 0.8730842 0.8728550 0.8726247 0.8723933 [344] 0.8721608 0.8719271 0.8716923 0.8714563 0.8712193 0.8709811 0.8707417 [351] 0.8705013 0.8702597 0.8700170 0.8697732 0.8695283 0.8692823 0.8690351 [358] 0.8687869 0.8685375 0.8682871 0.8680355 0.8677829 0.8675291 0.8672743 [365] 0.8670183 0.8667613 0.8665032 0.8662440 0.8659837 0.8657224 0.8654600 [372] 0.8651964 0.8649319 0.8646662 0.8643995 0.8641317 0.8638629 0.8635930 [379] 0.8633220 0.8630500 0.8627769 0.8625028 0.8622277 0.8619515 0.8616742 [386] 0.8613959 0.8611166 0.8608362 0.8605549 0.8602724 0.8599890 0.8597045 [393] 0.8594190 0.8591325 0.8588450 0.8585565 0.8582670 0.8579764 0.8576849 [400] 0.8573923 0.8570988 > mx [1] 0.8947628 > mxli [1] -0.51 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1um9w1226442540.ps",horizontal=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/www/html/freestat/rcomp/tmp/22xry1226442540.ps",horizontal=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/www/html/freestat/rcomp/tmp/3gajo1226442540.ps",horizontal=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/www/html/freestat/rcomp/tmp/4e8su1226442540.ps",horizontal=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/www/html/freestat/rcomp/tmp/5rqkv1226442540.ps",horizontal=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/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,'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/www/html/freestat/rcomp/tmp/65f581226442540.tab") > > system("convert tmp/1um9w1226442540.ps tmp/1um9w1226442540.png") > system("convert tmp/22xry1226442540.ps tmp/22xry1226442540.png") > system("convert tmp/3gajo1226442540.ps tmp/3gajo1226442540.png") > system("convert tmp/4e8su1226442540.ps tmp/4e8su1226442540.png") > system("convert tmp/5rqkv1226442540.ps tmp/5rqkv1226442540.png") > > > proc.time() user system elapsed 1.699 1.254 1.967