R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(785.8,819.3,849.4,880.4,900.1,937.2,948.9,952.6,947.3,974.2,1000.8,1032.8,1050.7,1057.3,1075.4,1118.4,1179.8,1227,1257.8,1251.5,1236.3,1170.6,1213.1,1265.5,1300.8,1348.4,1371.9,1403.3,1451.8,1474.2,1438.2,1513.6,1562.2,1546.2,1527.5,1418.7,1448.5,1492.1,1395.4,1403.7,1316.6,1274.5,1264.4,1323.9,1332.1,1250.2,1096.7,1080.8,1039.2,792,746.6,688.8,715.8,672.9,629.5,681.2,755.4,760.6,765.9,836.8,904.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.24979884 -0.24933702 -0.24887461 -0.24841162 -0.24794805 -0.24748389 [7] -0.24701917 -0.24655387 -0.24608800 -0.24562157 -0.24515457 -0.24468702 [13] -0.24421892 -0.24375026 -0.24328106 -0.24281131 -0.24234103 -0.24187021 [19] -0.24139885 -0.24092697 -0.24045456 -0.23998163 -0.23950818 -0.23903421 [25] -0.23855974 -0.23808476 -0.23760927 -0.23713329 -0.23665681 -0.23617984 [31] -0.23570238 -0.23522443 -0.23474600 -0.23426710 -0.23378772 -0.23330787 [37] -0.23282756 -0.23234679 -0.23186555 -0.23138387 -0.23090173 -0.23041915 [43] -0.22993612 -0.22945266 -0.22896876 -0.22848442 -0.22799967 -0.22751449 [49] -0.22702889 -0.22654287 -0.22605645 -0.22556961 -0.22508238 -0.22459474 [55] -0.22410671 -0.22361829 -0.22312948 -0.22264029 -0.22215072 -0.22166077 [61] -0.22117046 -0.22067977 -0.22018872 -0.21969732 -0.21920556 -0.21871345 [67] -0.21822099 -0.21772819 -0.21723506 -0.21674158 -0.21624778 -0.21575366 [73] -0.21525921 -0.21476444 -0.21426936 -0.21377397 -0.21327828 -0.21278229 [79] -0.21228600 -0.21178941 -0.21129254 -0.21079539 -0.21029796 -0.20980025 [85] -0.20930226 -0.20880402 -0.20830551 -0.20780674 -0.20730772 -0.20680844 [91] -0.20630892 -0.20580916 -0.20530917 -0.20480894 -0.20430848 -0.20380780 [97] -0.20330690 -0.20280578 -0.20230445 -0.20180291 -0.20130118 -0.20079924 [103] -0.20029711 -0.19979479 -0.19929228 -0.19878959 -0.19828673 -0.19778369 [109] -0.19728049 -0.19677712 -0.19627360 -0.19576991 -0.19526608 -0.19476210 [115] -0.19425798 -0.19375372 -0.19324933 -0.19274481 -0.19224017 -0.19173540 [121] -0.19123052 -0.19072553 -0.19022043 -0.18971523 -0.18920993 -0.18870454 [127] -0.18819906 -0.18769349 -0.18718784 -0.18668212 -0.18617632 -0.18567046 [133] -0.18516453 -0.18465854 -0.18415250 -0.18364641 -0.18314027 -0.18263410 [139] -0.18212788 -0.18162163 -0.18111536 -0.18060906 -0.18010274 -0.17959641 [145] -0.17909006 -0.17858371 -0.17807736 -0.17757100 -0.17706466 -0.17655833 [151] -0.17605201 -0.17554571 -0.17503944 -0.17453319 -0.17402698 -0.17352080 [157] -0.17301466 -0.17250858 -0.17200254 -0.17149655 -0.17099063 -0.17048476 [163] -0.16997897 -0.16947324 -0.16896759 -0.16846203 -0.16795654 -0.16745115 [169] -0.16694585 -0.16644064 -0.16593554 -0.16543054 -0.16492565 -0.16442088 [175] -0.16391623 -0.16341170 -0.16290729 -0.16240302 -0.16189888 -0.16139489 [181] -0.16089103 -0.16038733 -0.15988377 -0.15938038 -0.15887714 -0.15837407 [187] -0.15787117 -0.15736844 -0.15686589 -0.15636352 -0.15586134 -0.15535935 [193] -0.15485755 -0.15435595 -0.15385455 -0.15335335 -0.15285237 -0.15235160 [199] -0.15185105 -0.15135073 -0.15085063 -0.15035076 -0.14985112 -0.14935173 [205] -0.14885258 -0.14835367 -0.14785502 -0.14735662 -0.14685848 -0.14636060 [211] -0.14586299 -0.14536565 -0.14486858 -0.14437179 -0.14387529 -0.14337907 [217] -0.14288314 -0.14238751 -0.14189217 -0.14139714 -0.14090241 -0.14040800 [223] -0.13991389 -0.13942011 -0.13892664 -0.13843350 -0.13794069 -0.13744821 [229] -0.13695607 -0.13646427 -0.13597281 -0.13548170 -0.13499094 -0.13450054 [235] -0.13401050 -0.13352081 -0.13303150 -0.13254255 -0.13205398 -0.13156579 [241] -0.13107797 -0.13059054 -0.13010350 -0.12961685 -0.12913059 -0.12864474 [247] -0.12815928 -0.12767424 -0.12718960 -0.12670537 -0.12622156 -0.12573817 [253] -0.12525521 -0.12477267 -0.12429056 -0.12380888 -0.12332764 -0.12284685 [259] -0.12236649 -0.12188658 -0.12140713 -0.12092813 -0.12044958 -0.11997150 [265] -0.11949388 -0.11901672 -0.11854004 -0.11806383 -0.11758810 -0.11711285 [271] -0.11663808 -0.11616379 -0.11569000 -0.11521670 -0.11474390 -0.11427160 [277] -0.11379979 -0.11332850 -0.11285771 -0.11238743 -0.11191767 -0.11144843 [283] -0.11097971 -0.11051151 -0.11004384 -0.10957669 -0.10911008 -0.10864401 [289] -0.10817847 -0.10771348 -0.10724903 -0.10678513 -0.10632178 -0.10585898 [295] -0.10539674 -0.10493505 -0.10447393 -0.10401337 -0.10355338 -0.10309396 [301] -0.10263511 -0.10217684 -0.10171914 -0.10126203 -0.10080550 -0.10034955 [307] -0.09989420 -0.09943943 -0.09898526 -0.09853169 -0.09807871 -0.09762634 [313] -0.09717457 -0.09672341 -0.09627286 -0.09582292 -0.09537359 -0.09492488 [319] -0.09447679 -0.09402932 -0.09358247 -0.09313626 -0.09269067 -0.09224571 [325] -0.09180138 -0.09135770 -0.09091464 -0.09047223 -0.09003047 -0.08958934 [331] -0.08914887 -0.08870904 -0.08826987 -0.08783135 -0.08739348 -0.08695628 [337] -0.08651973 -0.08608385 -0.08564863 -0.08521408 -0.08478020 -0.08434699 [343] -0.08391445 -0.08348258 -0.08305139 -0.08262089 -0.08219106 -0.08176191 [349] -0.08133345 -0.08090568 -0.08047859 -0.08005220 -0.07962650 -0.07920149 [355] -0.07877718 -0.07835356 -0.07793065 -0.07750843 -0.07708692 -0.07666612 [361] -0.07624602 -0.07582663 -0.07540795 -0.07498998 -0.07457273 -0.07415619 [367] -0.07374036 -0.07332526 -0.07291087 -0.07249721 -0.07208427 -0.07167205 [373] -0.07126056 -0.07084980 -0.07043977 -0.07003047 -0.06962190 -0.06921406 [379] -0.06880696 -0.06840059 -0.06799497 -0.06759008 -0.06718593 -0.06678252 [385] -0.06637986 -0.06597794 -0.06557677 -0.06517635 -0.06477667 -0.06437774 [391] -0.06397956 -0.06358214 -0.06318547 -0.06278955 -0.06239439 -0.06199999 [397] -0.06160634 -0.06121345 -0.06082133 -0.06042996 -0.06003936 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1z4vt1257944673.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/2u0k21257944673.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/35ync1257944673.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/4gxnv1257944673.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/5m4wd1257944673.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/67hno1257944673.tab") > > system("convert tmp/1z4vt1257944673.ps tmp/1z4vt1257944673.png") > system("convert tmp/2u0k21257944673.ps tmp/2u0k21257944673.png") > system("convert tmp/35ync1257944673.ps tmp/35ync1257944673.png") > system("convert tmp/4gxnv1257944673.ps tmp/4gxnv1257944673.png") > system("convert tmp/5m4wd1257944673.ps tmp/5m4wd1257944673.png") > > > proc.time() user system elapsed 1.084 0.779 1.377