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(104.0,107.9,113.8,113.8,123.1,125.1,137.6,134.0,140.3,152.1,150.6,167.3,153.2,142.0,154.4,158.5,180.9,181.3,172.4,192.0,199.3,215.4,214.3,201.5,190.5,196.0,215.7,209.4,214.1,237.8,239.0,237.8,251.5,248.8,215.4,201.2,203.1,214.2,188.9,203.0,213.3,228.5,228.2,240.9,258.8,248.5,269.2,289.6,323.4,317.2,322.8,340.9,368.2,388.5,441.2,474.3,483.9,417.9,365.9,263.0) > #'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.8994298 0.8999041 0.9003767 0.9008475 0.9013166 0.9017839 0.9022495 [8] 0.9027132 0.9031750 0.9036350 0.9040931 0.9045493 0.9050035 0.9054558 [15] 0.9059061 0.9063544 0.9068006 0.9072448 0.9076869 0.9081269 0.9085648 [22] 0.9090005 0.9094340 0.9098653 0.9102944 0.9107212 0.9111458 0.9115680 [29] 0.9119879 0.9124054 0.9128206 0.9132333 0.9136436 0.9140515 0.9144568 [36] 0.9148597 0.9152600 0.9156577 0.9160528 0.9164454 0.9168352 0.9172225 [43] 0.9176070 0.9179888 0.9183678 0.9187441 0.9191176 0.9194882 0.9198560 [50] 0.9202209 0.9205829 0.9209419 0.9212980 0.9216512 0.9220012 0.9223483 [57] 0.9226923 0.9230332 0.9233709 0.9237056 0.9240370 0.9243653 0.9246903 [64] 0.9250120 0.9253305 0.9256457 0.9259575 0.9262660 0.9265710 0.9268727 [71] 0.9271709 0.9274656 0.9277569 0.9280446 0.9283288 0.9286094 0.9288864 [78] 0.9291598 0.9294295 0.9296955 0.9299578 0.9302164 0.9304712 0.9307223 [85] 0.9309695 0.9312129 0.9314524 0.9316880 0.9319197 0.9321475 0.9323713 [92] 0.9325911 0.9328069 0.9330187 0.9332263 0.9334299 0.9336294 0.9338247 [99] 0.9340159 0.9342029 0.9343856 0.9345641 0.9347384 0.9349083 0.9350740 [106] 0.9352353 0.9353922 0.9355448 0.9356930 0.9358367 0.9359760 0.9361108 [113] 0.9362411 0.9363669 0.9364881 0.9366048 0.9367169 0.9368244 0.9369273 [120] 0.9370255 0.9371191 0.9372079 0.9372921 0.9373715 0.9374462 0.9375161 [127] 0.9375812 0.9376415 0.9376970 0.9377476 0.9377934 0.9378343 0.9378703 [134] 0.9379013 0.9379274 0.9379486 0.9379648 0.9379760 0.9379822 0.9379834 [141] 0.9379796 0.9379707 0.9379567 0.9379377 0.9379135 0.9378843 0.9378499 [148] 0.9378104 0.9377657 0.9377159 0.9376609 0.9376007 0.9375353 0.9374647 [155] 0.9373889 0.9373078 0.9372215 0.9371299 0.9370331 0.9369309 0.9368235 [162] 0.9367108 0.9365928 0.9364695 0.9363409 0.9362069 0.9360676 0.9359230 [169] 0.9357730 0.9356177 0.9354570 0.9352909 0.9351194 0.9349426 0.9347604 [176] 0.9345729 0.9343799 0.9341815 0.9339778 0.9337687 0.9335541 0.9333342 [183] 0.9331089 0.9328781 0.9326420 0.9324005 0.9321535 0.9319012 0.9316434 [190] 0.9313803 0.9311118 0.9308379 0.9305586 0.9302739 0.9299838 0.9296883 [197] 0.9293875 0.9290813 0.9287698 0.9284528 0.9281306 0.9278029 0.9274700 [204] 0.9271317 0.9267881 0.9264391 0.9260849 0.9257254 0.9253605 0.9249904 [211] 0.9246150 0.9242344 0.9238485 0.9234573 0.9230610 0.9226594 0.9222526 [218] 0.9218406 0.9214235 0.9210012 0.9205737 0.9201411 0.9197034 0.9192605 [225] 0.9188126 0.9183596 0.9179015 0.9174384 0.9169703 0.9164971 0.9160190 [232] 0.9155359 0.9150478 0.9145548 0.9140569 0.9135540 0.9130463 0.9125338 [239] 0.9120163 0.9114941 0.9109671 0.9104352 0.9098987 0.9093573 0.9088113 [246] 0.9082606 0.9077052 0.9071452 0.9065805 0.9060112 0.9054374 0.9048590 [253] 0.9042761 0.9036887 0.9030968 0.9025005 0.9018997 0.9012945 0.9006850 [260] 0.9000711 0.8994528 0.8988303 0.8982035 0.8975725 0.8969372 0.8962978 [267] 0.8956542 0.8950065 0.8943547 0.8936988 0.8930389 0.8923749 0.8917070 [274] 0.8910351 0.8903592 0.8896795 0.8889959 0.8883085 0.8876172 0.8869222 [281] 0.8862234 0.8855210 0.8848148 0.8841050 0.8833915 0.8826745 0.8819539 [288] 0.8812298 0.8805021 0.8797711 0.8790365 0.8782986 0.8775573 0.8768127 [295] 0.8760648 0.8753136 0.8745591 0.8738015 0.8730406 0.8722767 0.8715096 [302] 0.8707394 0.8699663 0.8691901 0.8684109 0.8676288 0.8668437 0.8660558 [309] 0.8652651 0.8644715 0.8636752 0.8628761 0.8620743 0.8612698 0.8604627 [316] 0.8596530 0.8588407 0.8580259 0.8572085 0.8563887 0.8555665 0.8547418 [323] 0.8539147 0.8530854 0.8522537 0.8514197 0.8505835 0.8497450 0.8489044 [330] 0.8480617 0.8472168 0.8463699 0.8455209 0.8446700 0.8438170 0.8429621 [337] 0.8421053 0.8412466 0.8403860 0.8395237 0.8386595 0.8377936 0.8369260 [344] 0.8360567 0.8351858 0.8343132 0.8334390 0.8325633 0.8316861 0.8308073 [351] 0.8299271 0.8290455 0.8281625 0.8272781 0.8263923 0.8255053 0.8246170 [358] 0.8237274 0.8228366 0.8219446 0.8210515 0.8201573 0.8192619 0.8183655 [365] 0.8174681 0.8165696 0.8156702 0.8147698 0.8138685 0.8129663 0.8120633 [372] 0.8111594 0.8102547 0.8093493 0.8084431 0.8075362 0.8066285 0.8057203 [379] 0.8048114 0.8039018 0.8029917 0.8020811 0.8011699 0.8002582 0.7993460 [386] 0.7984334 0.7975204 0.7966069 0.7956931 0.7947790 0.7938645 0.7929498 [393] 0.7920347 0.7911195 0.7902040 0.7892883 0.7883724 0.7874564 0.7865403 [400] 0.7856240 0.7847077 > mx [1] 0.9379834 > mxli [1] -0.61 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/14f0a1226570566.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/2hk271226570566.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/393xr1226570566.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/4e5b71226570566.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/55hmo1226570566.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/6p84y1226570566.tab") > > system("convert tmp/14f0a1226570566.ps tmp/14f0a1226570566.png") > system("convert tmp/2hk271226570566.ps tmp/2hk271226570566.png") > system("convert tmp/393xr1226570566.ps tmp/393xr1226570566.png") > system("convert tmp/4e5b71226570566.ps tmp/4e5b71226570566.png") > system("convert tmp/55hmo1226570566.ps tmp/55hmo1226570566.png") > > > proc.time() user system elapsed 1.290 0.776 2.381