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(10165,269,708,1362,2271,3516,4775,6334,6150,7794,8851,9721,9676,402,1046,1743,2711,3817,4128,5505,4921,6091,7263,8035,7828,296,500,1134,2061,2737,2959,4113,3494,4518,5470,5664,4717,606,615,1062,983,340,467,1580,804,1709,2335,2832,2582) > #'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.0702237586 0.0694796567 0.0687306915 0.0679768191 0.0672179954 [6] 0.0664541759 0.0656853157 0.0649113698 0.0641322927 0.0633480386 [11] 0.0625585617 0.0617638156 0.0609637537 0.0601583291 0.0593474947 [16] 0.0585312031 0.0577094065 0.0568820571 0.0560491066 0.0552105067 [21] 0.0543662087 0.0535161636 0.0526603224 0.0517986358 0.0509310543 [26] 0.0500575281 0.0491780074 0.0482924422 0.0474007822 0.0465029771 [31] 0.0455989764 0.0446887296 0.0437721858 0.0428492944 0.0419200044 [36] 0.0409842649 0.0400420248 0.0390932332 0.0381378391 0.0371757912 [41] 0.0362070387 0.0352315305 0.0342492156 0.0332600433 0.0322639626 [46] 0.0312609229 0.0302508737 0.0292337646 0.0282095453 0.0271781659 [51] 0.0261395764 0.0250937275 0.0240405697 0.0229800541 0.0219121321 [56] 0.0208367552 0.0197538757 0.0186634458 0.0175654185 0.0164597472 [61] 0.0153463857 0.0142252883 0.0130964101 0.0119597064 0.0108151334 [66] 0.0096626479 0.0085022073 0.0073337699 0.0061572945 0.0049727409 [71] 0.0037800696 0.0025792422 0.0013702208 0.0001529688 -0.0010725495 [76] -0.0023063689 -0.0035485230 -0.0047990444 -0.0060579645 -0.0073253135 [81] -0.0086011204 -0.0098854128 -0.0111782172 -0.0124795586 -0.0137894607 [86] -0.0151079455 -0.0164350338 -0.0177707446 -0.0191150956 -0.0204681026 [91] -0.0218297798 -0.0232001398 -0.0245791932 -0.0259669489 -0.0273634139 [96] -0.0287685934 -0.0301824904 -0.0316051061 -0.0330364395 -0.0344764877 [101] -0.0359252453 -0.0373827049 -0.0388488570 -0.0403236895 -0.0418071883 [106] -0.0432993364 -0.0448001150 -0.0463095024 -0.0478274745 -0.0493540046 [111] -0.0508890634 -0.0524326191 -0.0539846370 -0.0555450798 -0.0571139075 [116] -0.0586910770 -0.0602765428 -0.0618702561 -0.0634721654 -0.0650822163 [121] -0.0667003514 -0.0683265102 -0.0699606293 -0.0716026421 -0.0732524790 [126] -0.0749100674 -0.0765753313 -0.0782481918 -0.0799285668 -0.0816163709 [131] -0.0833115157 -0.0850139093 -0.0867234570 -0.0884400605 -0.0901636185 [136] -0.0918940265 -0.0936311765 -0.0953749576 -0.0971252555 -0.0988819528 [141] -0.1006449289 -0.1024140600 -0.1041892190 -0.1059702759 -0.1077570974 [146] -0.1095495472 -0.1113474859 -0.1131507711 -0.1149592572 -0.1167727960 [151] -0.1185912361 -0.1204144232 -0.1222422003 -0.1240744076 -0.1259108825 [156] -0.1277514598 -0.1295959714 -0.1314442471 -0.1332961137 -0.1351513960 [161] -0.1370099161 -0.1388714940 -0.1407359473 -0.1426030917 -0.1444727405 [166] -0.1463447053 -0.1482187957 -0.1500948195 -0.1519725825 -0.1538518894 [171] -0.1557325428 -0.1576143442 -0.1594970936 -0.1613805897 -0.1632646302 [176] -0.1651490115 -0.1670335294 -0.1689179784 -0.1708021526 -0.1726858453 [181] -0.1745688493 -0.1764509570 -0.1783319605 -0.1802116516 -0.1820898220 [186] -0.1839662635 -0.1858407680 -0.1877131276 -0.1895831348 -0.1914505825 [191] -0.1933152642 -0.1951769740 -0.1970355069 -0.1988906587 -0.2007422262 [196] -0.2025900074 -0.2044338014 -0.2062734087 -0.2081086311 -0.2099392720 [201] -0.2117651365 -0.2135860312 -0.2154017648 -0.2172121476 -0.2190169922 [206] -0.2208161130 -0.2226093267 -0.2243964524 -0.2261773113 -0.2279517272 [211] -0.2297195264 -0.2314805376 -0.2332345924 -0.2349815250 -0.2367211723 [216] -0.2384533743 -0.2401779737 -0.2418948163 -0.2436037507 -0.2453046290 [221] -0.2469973061 -0.2486816401 -0.2503574925 -0.2520247280 -0.2536832145 [226] -0.2553328234 -0.2569734292 -0.2586049102 -0.2602271477 -0.2618400267 [231] -0.2634434357 -0.2650372665 -0.2666214145 -0.2681957785 -0.2697602610 [236] -0.2713147679 -0.2728592086 -0.2743934959 -0.2759175465 -0.2774312802 [241] -0.2789346205 -0.2804274944 -0.2819098322 -0.2833815679 -0.2848426387 [246] -0.2862929854 -0.2877325521 -0.2891612863 -0.2905791389 -0.2919860639 [251] -0.2933820190 -0.2947669647 -0.2961408650 -0.2975036869 -0.2988554007 [256] -0.3001959798 -0.3015254005 -0.3028436423 -0.3041506876 -0.3054465217 [261] -0.3067311330 -0.3080045124 -0.3092666539 -0.3105175541 -0.3117572123 [266] -0.3129856305 -0.3142028134 -0.3154087680 -0.3166035039 -0.3177870334 [271] -0.3189593707 -0.3201205328 -0.3212705388 -0.3224094100 -0.3235371699 [276] -0.3246538442 -0.3257594605 -0.3268540488 -0.3279376405 -0.3290102695 [281] -0.3300719711 -0.3311227827 -0.3321627434 -0.3331918938 -0.3342102765 [286] -0.3352179353 -0.3362149158 -0.3372012652 -0.3381770318 -0.3391422657 [291] -0.3400970179 -0.3410413410 -0.3419752889 -0.3428989164 -0.3438122798 [296] -0.3447154362 -0.3456084439 -0.3464913623 -0.3473642516 -0.3482271730 [301] -0.3490801887 -0.3499233614 -0.3507567550 -0.3515804340 -0.3523944634 [306] -0.3531989093 -0.3539938380 -0.3547793168 -0.3555554132 -0.3563221955 [311] -0.3570797324 -0.3578280929 -0.3585673468 -0.3592975639 -0.3600188145 [316] -0.3607311692 -0.3614346991 -0.3621294752 -0.3628155690 -0.3634930521 [321] -0.3641619963 -0.3648224737 -0.3654745561 -0.3661183158 -0.3667538251 [326] -0.3673811563 -0.3680003816 -0.3686115733 -0.3692148038 -0.3698101453 [331] -0.3703976700 -0.3709774500 -0.3715495573 -0.3721140638 -0.3726710412 [336] -0.3732205611 -0.3737626950 -0.3742975139 -0.3748250890 -0.3753454911 [341] -0.3758587906 -0.3763650579 -0.3768643630 -0.3773567757 -0.3778423655 [346] -0.3783212015 -0.3787933526 -0.3792588873 -0.3797178738 -0.3801703800 [351] -0.3806164734 -0.3810562211 -0.3814896899 -0.3819169462 -0.3823380559 [356] -0.3827530848 -0.3831620979 -0.3835651601 -0.3839623357 -0.3843536888 [361] -0.3847392828 -0.3851191808 -0.3854934456 -0.3858621393 -0.3862253236 [366] -0.3865830601 -0.3869354094 -0.3872824320 -0.3876241879 -0.3879607366 [371] -0.3882921371 -0.3886184479 -0.3889397272 -0.3892560326 -0.3895674212 [376] -0.3898739497 -0.3901756742 -0.3904726506 -0.3907649341 -0.3910525793 [381] -0.3913356407 -0.3916141720 -0.3918882265 -0.3921578572 -0.3924231163 [386] -0.3926840558 -0.3929407271 -0.3931931811 -0.3934414684 -0.3936856388 [391] -0.3939257420 -0.3941618270 -0.3943939423 -0.3946221361 -0.3948464560 [396] -0.3950669492 -0.3952836623 -0.3954966417 -0.3957059332 -0.3959115820 [401] -0.3961136331 > mx [1] 0.07022376 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/11k491226615481.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/22fo31226615481.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/33cct1226615481.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/4ecmx1226615481.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/5rp3c1226615481.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/6jjuk1226615482.tab") > > system("convert tmp/11k491226615481.ps tmp/11k491226615481.png") > system("convert tmp/22fo31226615481.ps tmp/22fo31226615481.png") > system("convert tmp/33cct1226615481.ps tmp/33cct1226615481.png") > system("convert tmp/4ecmx1226615481.ps tmp/4ecmx1226615481.png") > system("convert tmp/5rp3c1226615481.ps tmp/5rp3c1226615481.png") > > > proc.time() user system elapsed 1.383 0.843 1.713