R version 2.7.0 (2008-04-22) 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(604.4,883.9,527.9,756.2,812.9,655.6,707.6,612.6,659.2,833.4,727.8,797.2,753,762,613.7,759.2,816.4,736.8,680.1,736.5,637.2,801.9,772.3,897.3,792.1,826.8,666.8,906.6,871.4,891,739.2,833.6,715.6,871.6,751.6,1005.5,681.2,837.3,674.7,806.3,860.2,689.8,691.6,682.6,800.1,1023.7,733.5,875.3,770.2,1005.7,982.3,742.9,974.2,822.3,773.2,750.9,708,690,652.8,620.7,461.9) > #'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.0040532767 -0.0036955738 -0.0033381263 -0.0029809365 -0.0026240065 [6] -0.0022673385 -0.0019109348 -0.0015547974 -0.0011989285 -0.0008433304 [11] -0.0004880051 -0.0001329548 0.0002218184 0.0005763124 0.0009305250 [16] 0.0012844541 0.0016380977 0.0019914537 0.0023445199 0.0026972943 [21] 0.0030497749 0.0034019595 0.0037538462 0.0041054330 0.0044567177 [26] 0.0048076984 0.0051583731 0.0055087398 0.0058587965 0.0062085412 [31] 0.0065579719 0.0069070868 0.0072558838 0.0076043611 0.0079525166 [36] 0.0083003485 0.0086478549 0.0089950339 0.0093418835 0.0096884020 [41] 0.0100345874 0.0103804379 0.0107259516 0.0110711268 0.0114159615 [46] 0.0117604541 0.0121046026 0.0124484052 0.0127918603 0.0131349660 [51] 0.0134777206 0.0138201223 0.0141621694 0.0145038601 0.0148451928 [56] 0.0151861657 0.0155267771 0.0158670254 0.0162069088 0.0165464258 [61] 0.0168855746 0.0172243537 0.0175627614 0.0179007960 0.0182384560 [66] 0.0185757398 0.0189126458 0.0192491725 0.0195853182 0.0199210814 [71] 0.0202564605 0.0205914542 0.0209260607 0.0212602787 0.0215941067 [76] 0.0219275431 0.0222605865 0.0225932354 0.0229254885 0.0232573441 [81] 0.0235888011 0.0239198578 0.0242505130 0.0245807652 0.0249106130 [86] 0.0252400552 0.0255690903 0.0258977170 0.0262259340 0.0265537399 [91] 0.0268811335 0.0272081135 0.0275346785 0.0278608274 0.0281865588 [96] 0.0285118715 0.0288367643 0.0291612360 0.0294852852 0.0298089110 [101] 0.0301321120 0.0304548870 0.0307772350 0.0310991548 0.0314206452 [106] 0.0317417050 0.0320623333 0.0323825289 0.0327022906 0.0330216175 [111] 0.0333405083 0.0336589622 0.0339769781 0.0342945548 0.0346116914 [116] 0.0349283869 0.0352446403 0.0355604506 0.0358758168 0.0361907380 [121] 0.0365052132 0.0368192415 0.0371328219 0.0374459535 0.0377586355 [126] 0.0380708669 0.0383826469 0.0386939746 0.0390048491 0.0393152696 [131] 0.0396252353 0.0399347453 0.0402437988 0.0405523951 0.0408605333 [136] 0.0411682127 0.0414754325 0.0417821920 0.0420884903 0.0423943269 [141] 0.0426997009 0.0430046117 0.0433090585 0.0436130408 0.0439165577 [146] 0.0442196087 0.0445221931 0.0448243103 0.0451259596 0.0454271404 [151] 0.0457278521 0.0460280942 0.0463278660 0.0466271670 0.0469259965 [156] 0.0472243542 0.0475222394 0.0478196515 0.0481165902 0.0484130548 [161] 0.0487090449 0.0490045600 0.0492995996 0.0495941632 0.0498882505 [166] 0.0501818610 0.0504749942 0.0507676497 0.0510598271 0.0513515260 [171] 0.0516427460 0.0519334868 0.0522237480 0.0525135292 0.0528028301 [176] 0.0530916503 0.0533799895 0.0536678474 0.0539552237 0.0542421182 [181] 0.0545285304 0.0548144601 0.0550999072 0.0553848712 0.0556693521 [186] 0.0559533494 0.0562368631 0.0565198929 0.0568024386 0.0570845000 [191] 0.0573660768 0.0576471691 0.0579277764 0.0582078988 0.0584875361 [196] 0.0587666880 0.0590453546 0.0593235356 0.0596012310 0.0598784407 [201] 0.0601551645 0.0604314024 0.0607071544 0.0609824202 0.0612572000 [206] 0.0615314936 0.0618053010 0.0620786222 0.0623514572 0.0626238059 [211] 0.0628956683 0.0631670445 0.0634379345 0.0637083382 0.0639782558 [216] 0.0642476872 0.0645166326 0.0647850919 0.0650530652 0.0653205527 [221] 0.0655875543 0.0658540702 0.0661201005 0.0663856453 0.0666507047 [226] 0.0669152788 0.0671793677 0.0674429716 0.0677060907 0.0679687251 [231] 0.0682308749 0.0684925403 0.0687537215 0.0690144187 0.0692746321 [236] 0.0695343619 0.0697936082 0.0700523713 0.0703106514 0.0705684488 [241] 0.0708257637 0.0710825963 0.0713389468 0.0715948156 0.0718502029 [246] 0.0721051089 0.0723595340 0.0726134784 0.0728669424 0.0731199264 [251] 0.0733724305 0.0736244552 0.0738760008 0.0741270675 0.0743776558 [256] 0.0746277658 0.0748773981 0.0751265529 0.0753752306 0.0756234316 [261] 0.0758711562 0.0761184048 0.0763651778 0.0766114756 0.0768572985 [266] 0.0771026470 0.0773475214 0.0775919223 0.0778358499 0.0780793047 [271] 0.0783222872 0.0785647978 0.0788068369 0.0790484049 0.0792895024 [276] 0.0795301297 0.0797702874 0.0800099758 0.0802491955 0.0804879469 [281] 0.0807262306 0.0809640470 0.0812013965 0.0814382798 0.0816746972 [286] 0.0819106494 0.0821461368 0.0823811598 0.0826157192 0.0828498153 [291] 0.0830834487 0.0833166200 0.0835493296 0.0837815781 0.0840133661 [296] 0.0842446942 0.0844755628 0.0847059725 0.0849359240 0.0851654177 [301] 0.0853944542 0.0856230342 0.0858511582 0.0860788267 0.0863060405 [306] 0.0865328000 0.0867591059 0.0869849587 0.0872103591 0.0874353077 [311] 0.0876598051 0.0878838520 0.0881074488 0.0883305963 0.0885532951 [316] 0.0887755457 0.0889973489 0.0892187053 0.0894396156 0.0896600802 [321] 0.0898801000 0.0900996756 0.0903188075 0.0905374965 0.0907557433 [326] 0.0909735484 0.0911909126 0.0914078365 0.0916243208 0.0918403662 [331] 0.0920559733 0.0922711428 0.0924858754 0.0927001718 0.0929140327 [336] 0.0931274587 0.0933404506 0.0935530090 0.0937651347 0.0939768284 [341] 0.0941880906 0.0943989223 0.0946093240 0.0948192964 0.0950288403 [346] 0.0952379565 0.0954466455 0.0956549082 0.0958627452 0.0960701572 [351] 0.0962771451 0.0964837095 0.0966898511 0.0968955706 0.0971008689 [356] 0.0973057467 0.0975102046 0.0977142434 0.0979178638 0.0981210666 [361] 0.0983238526 0.0985262224 0.0987281768 0.0989297166 0.0991308426 [366] 0.0993315553 0.0995318557 0.0997317444 0.0999312223 0.1001302900 [371] 0.1003289483 0.1005271980 0.1007250399 0.1009224746 0.1011195030 [376] 0.1013161258 0.1015123438 0.1017081578 0.1019035685 0.1020985766 [381] 0.1022931830 0.1024873884 0.1026811935 0.1028745993 0.1030676063 [386] 0.1032602154 0.1034524274 0.1036442431 0.1038356631 0.1040266883 [391] 0.1042173195 0.1044075574 0.1045974028 0.1047868565 0.1049759193 [396] 0.1051645919 0.1053528751 0.1055407697 0.1057282765 0.1059153963 [401] 0.1061021297 > mx [1] 0.1061021 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1k9m11226408521.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/2uneb1226408521.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/32pou1226408521.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/4bmy91226408521.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/5koda1226408521.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/68xfb1226408521.tab") > > system("convert tmp/1k9m11226408521.ps tmp/1k9m11226408521.png") > system("convert tmp/2uneb1226408521.ps tmp/2uneb1226408521.png") > system("convert tmp/32pou1226408521.ps tmp/32pou1226408521.png") > system("convert tmp/4bmy91226408521.ps tmp/4bmy91226408521.png") > system("convert tmp/5koda1226408521.ps tmp/5koda1226408521.png") > > > proc.time() user system elapsed 2.397 1.320 2.582