R version 2.7.2 (2008-08-25) 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(1946.81,1765.9,1635.25,1833.42,1910.43,1959.67,1969.6,2061.41,2093.48,2120.88,2174.56,2196.72,2350.44,2440.25,2408.64,2472.81,2407.6,2454.62,2448.05,2497.84,2645.64,2756.76,2849.27,2921.44,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3733.22,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.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.9005229 0.9008575 0.9011909 0.9015231 0.9018541 0.9021838 0.9025124 [8] 0.9028397 0.9031658 0.9034906 0.9038143 0.9041366 0.9044578 0.9047777 [15] 0.9050963 0.9054137 0.9057298 0.9060447 0.9063583 0.9066706 0.9069817 [22] 0.9072914 0.9075999 0.9079072 0.9082131 0.9085177 0.9088211 0.9091231 [29] 0.9094239 0.9097233 0.9100214 0.9103183 0.9106138 0.9109080 0.9112008 [36] 0.9114924 0.9117826 0.9120715 0.9123591 0.9126453 0.9129302 0.9132137 [43] 0.9134959 0.9137767 0.9140562 0.9143343 0.9146111 0.9148865 0.9151605 [50] 0.9154332 0.9157045 0.9159744 0.9162430 0.9165102 0.9167759 0.9170403 [57] 0.9173033 0.9175650 0.9178252 0.9180840 0.9183414 0.9185975 0.9188521 [64] 0.9191053 0.9193571 0.9196075 0.9198565 0.9201040 0.9203501 0.9205948 [71] 0.9208381 0.9210800 0.9213204 0.9215594 0.9217969 0.9220330 0.9222677 [78] 0.9225009 0.9227327 0.9229630 0.9231919 0.9234194 0.9236453 0.9238699 [85] 0.9240929 0.9243145 0.9245347 0.9247533 0.9249705 0.9251863 0.9254005 [92] 0.9256133 0.9258246 0.9260345 0.9262428 0.9264497 0.9266551 0.9268590 [99] 0.9270614 0.9272624 0.9274618 0.9276598 0.9278562 0.9280512 0.9282447 [106] 0.9284367 0.9286271 0.9288161 0.9290036 0.9291895 0.9293740 0.9295570 [113] 0.9297384 0.9299183 0.9300968 0.9302737 0.9304491 0.9306230 0.9307953 [120] 0.9309662 0.9311355 0.9313034 0.9314697 0.9316344 0.9317977 0.9319594 [127] 0.9321196 0.9322783 0.9324355 0.9325911 0.9327452 0.9328978 0.9330488 [134] 0.9331983 0.9333463 0.9334927 0.9336377 0.9337810 0.9339229 0.9340632 [141] 0.9342020 0.9343392 0.9344750 0.9346091 0.9347418 0.9348729 0.9350024 [148] 0.9351305 0.9352570 0.9353819 0.9355053 0.9356272 0.9357475 0.9358663 [155] 0.9359836 0.9360993 0.9362135 0.9363262 0.9364373 0.9365468 0.9366549 [162] 0.9367613 0.9368663 0.9369697 0.9370716 0.9371719 0.9372707 0.9373680 [169] 0.9374637 0.9375579 0.9376505 0.9377416 0.9378312 0.9379193 0.9380058 [176] 0.9380907 0.9381742 0.9382561 0.9383365 0.9384153 0.9384926 0.9385684 [183] 0.9386427 0.9387154 0.9387866 0.9388562 0.9389244 0.9389910 0.9390561 [190] 0.9391197 0.9391817 0.9392422 0.9393012 0.9393587 0.9394147 0.9394691 [197] 0.9395220 0.9395735 0.9396234 0.9396717 0.9397186 0.9397640 0.9398078 [204] 0.9398502 0.9398910 0.9399304 0.9399682 0.9400046 0.9400394 0.9400727 [211] 0.9401046 0.9401349 0.9401637 0.9401911 0.9402170 0.9402413 0.9402642 [218] 0.9402856 0.9403055 0.9403240 0.9403409 0.9403564 0.9403704 0.9403829 [225] 0.9403940 0.9404036 0.9404117 0.9404183 0.9404235 0.9404272 0.9404294 [232] 0.9404302 0.9404296 0.9404275 0.9404239 0.9404189 0.9404124 0.9404045 [239] 0.9403951 0.9403843 0.9403721 0.9403584 0.9403433 0.9403267 0.9403088 [246] 0.9402894 0.9402685 0.9402463 0.9402226 0.9401975 0.9401710 0.9401431 [253] 0.9401138 0.9400831 0.9400509 0.9400174 0.9399825 0.9399461 0.9399084 [260] 0.9398693 0.9398288 0.9397869 0.9397436 0.9396990 0.9396529 0.9396055 [267] 0.9395568 0.9395066 0.9394551 0.9394022 0.9393480 0.9392924 0.9392355 [274] 0.9391772 0.9391175 0.9390565 0.9389942 0.9389306 0.9388656 0.9387992 [281] 0.9387316 0.9386626 0.9385923 0.9385206 0.9384477 0.9383734 0.9382978 [288] 0.9382210 0.9381428 0.9380633 0.9379825 0.9379005 0.9378171 0.9377325 [295] 0.9376465 0.9375593 0.9374708 0.9373811 0.9372900 0.9371977 0.9371042 [302] 0.9370094 0.9369133 0.9368159 0.9367174 0.9366175 0.9365165 0.9364142 [309] 0.9363106 0.9362059 0.9360999 0.9359927 0.9358842 0.9357746 0.9356637 [316] 0.9355516 0.9354383 0.9353238 0.9352082 0.9350913 0.9349732 0.9348539 [323] 0.9347335 0.9346119 0.9344891 0.9343651 0.9342400 0.9341137 0.9339862 [330] 0.9338576 0.9337278 0.9335969 0.9334648 0.9333316 0.9331972 0.9330618 [337] 0.9329251 0.9327874 0.9326485 0.9325086 0.9323675 0.9322253 0.9320819 [344] 0.9319375 0.9317920 0.9316454 0.9314977 0.9313489 0.9311990 0.9310481 [351] 0.9308960 0.9307429 0.9305888 0.9304335 0.9302772 0.9301199 0.9299615 [358] 0.9298020 0.9296416 0.9294800 0.9293175 0.9291539 0.9289892 0.9288236 [365] 0.9286569 0.9284892 0.9283205 0.9281508 0.9279801 0.9278084 0.9276357 [372] 0.9274620 0.9272874 0.9271117 0.9269351 0.9267574 0.9265788 0.9263993 [379] 0.9262188 0.9260373 0.9258549 0.9256715 0.9254872 0.9253019 0.9251157 [386] 0.9249285 0.9247404 0.9245514 0.9243615 0.9241707 0.9239789 0.9237863 [393] 0.9235927 0.9233982 0.9232028 0.9230066 0.9228094 0.9226114 0.9224124 [400] 0.9222126 0.9220120 > mx [1] 0.9404302 > mxli [1] 0.31 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1vx3q1226318147.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/rcomp/tmp/2qomm1226318147.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/rcomp/tmp/3xqvr1226318147.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/rcomp/tmp/467gd1226318147.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/rcomp/tmp/5yflb1226318147.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/60ya21226318147.tab") > > system("convert tmp/1vx3q1226318147.ps tmp/1vx3q1226318147.png") > system("convert tmp/2qomm1226318147.ps tmp/2qomm1226318147.png") > system("convert tmp/3xqvr1226318147.ps tmp/3xqvr1226318147.png") > system("convert tmp/467gd1226318147.ps tmp/467gd1226318147.png") > system("convert tmp/5yflb1226318147.ps tmp/5yflb1226318147.png") > > > proc.time() user system elapsed 1.352 0.838 1.967