R version 2.8.1 (2008-12-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(46,50,49,48,50,47,50,49,51,52,48,55,56,43,44,50,49,47,46,50,49,53,54,56,56,58,53,51,52,53,56,54,54,56,59,62,62,73,76,80,77,81,80,80,81,80,77,71,71,64,64,47,41,35,34,33,23,16,16,8,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.4762179810 -0.4765430066 -0.4768659343 -0.4771867016 -0.4775052453 [6] -0.4778215012 -0.4781354044 -0.4784468891 -0.4787558886 -0.4790623356 [11] -0.4793661616 -0.4796672977 -0.4799656737 -0.4802612188 -0.4805538613 [16] -0.4808435288 -0.4811301477 -0.4814136438 -0.4816939420 -0.4819709664 [21] -0.4822446402 -0.4825148856 -0.4827816242 -0.4830447766 -0.4833042626 [26] -0.4835600010 -0.4838119100 -0.4840599069 -0.4843039079 -0.4845438287 [31] -0.4847795840 -0.4850110876 -0.4852382526 -0.4854609913 -0.4856792151 [36] -0.4858928344 -0.4861017592 -0.4863058984 -0.4865051602 -0.4866994519 [41] -0.4868886803 -0.4870727510 -0.4872515692 -0.4874250391 -0.4875930643 [46] -0.4877555476 -0.4879123911 -0.4880634961 -0.4882087633 -0.4883480925 [51] -0.4884813831 -0.4886085335 -0.4887294418 -0.4888440051 -0.4889521200 [56] -0.4890536826 -0.4891485883 -0.4892367317 -0.4893180072 -0.4893923084 [61] -0.4894595284 -0.4895195598 -0.4895722946 -0.4896176245 -0.4896554406 [66] -0.4896856335 -0.4897080934 -0.4897227103 -0.4897293735 -0.4897279722 [71] -0.4897183950 -0.4897005305 -0.4896742667 -0.4896394915 -0.4895960925 [76] -0.4895439572 -0.4894829727 -0.4894130260 -0.4893340043 -0.4892457941 [81] -0.4891482823 -0.4890413556 -0.4889249006 -0.4887988040 -0.4886629525 [86] -0.4885172330 -0.4883615324 -0.4881957377 -0.4880197361 -0.4878334152 [91] -0.4876366626 -0.4874293663 -0.4872114147 -0.4869826963 -0.4867431002 [96] -0.4864925160 -0.4862308335 -0.4859579432 -0.4856737362 -0.4853781041 [101] -0.4850709390 -0.4847521339 -0.4844215824 -0.4840791788 -0.4837248183 [106] -0.4833583969 -0.4829798115 -0.4825889599 -0.4821857408 -0.4817700539 [111] -0.4813418003 -0.4809008816 -0.4804472011 -0.4799806630 -0.4795011728 [116] -0.4790086372 -0.4785029644 -0.4779840638 -0.4774518464 -0.4769062243 [121] -0.4763471116 -0.4757744236 -0.4751880773 -0.4745879914 -0.4739740862 [126] -0.4733462838 -0.4727045081 -0.4720486847 -0.4713787412 -0.4706946071 [131] -0.4699962137 -0.4692834947 -0.4685563854 -0.4678148234 -0.4670587485 [136] -0.4662881025 -0.4655028296 -0.4647028761 -0.4638881908 -0.4630587247 [141] -0.4622144312 -0.4613552660 -0.4604811876 -0.4595921567 -0.4586881367 [146] -0.4577690934 -0.4568349954 -0.4558858138 -0.4549215224 -0.4539420979 [151] -0.4529475194 -0.4519377690 -0.4509128315 -0.4498726947 -0.4488173490 [156] -0.4477467878 -0.4466610075 -0.4455600073 -0.4444437894 -0.4433123589 [161] -0.4421657239 -0.4410038957 -0.4398268884 -0.4386347192 -0.4374274085 [166] -0.4362049795 -0.4349674587 -0.4337148755 -0.4324472627 -0.4311646559 [171] -0.4298670939 -0.4285546186 -0.4272272751 -0.4258851116 -0.4245281793 [176] -0.4231565326 -0.4217702290 -0.4203693290 -0.4189538962 -0.4175239976 [181] -0.4160797028 -0.4146210847 -0.4131482192 -0.4116611853 -0.4101600648 [186] -0.4086449428 -0.4071159071 -0.4055730486 -0.4040164609 -0.4024462407 [191] -0.4008624877 -0.3992653040 -0.3976547948 -0.3960310681 -0.3943942346 [196] -0.3927444075 -0.3910817030 -0.3894062396 -0.3877181388 -0.3860175241 [201] -0.3843045221 -0.3825792613 -0.3808418731 -0.3790924910 -0.3773312508 [206] -0.3755582909 -0.3737737514 -0.3719777751 -0.3701705065 -0.3683520926 [211] -0.3665226820 -0.3646824255 -0.3628314757 -0.3609699873 -0.3590981164 [216] -0.3572160212 -0.3553238613 -0.3534217981 -0.3515099944 -0.3495886148 [221] -0.3476578250 -0.3457177922 -0.3437686849 -0.3418106730 -0.3398439274 [226] -0.3378686202 -0.3358849246 -0.3338930148 -0.3318930657 -0.3298852535 [231] -0.3278697549 -0.3258467475 -0.3238164094 -0.3217789195 -0.3197344572 [236] -0.3176832025 -0.3156253356 -0.3135610373 -0.3114904886 -0.3094138706 [241] -0.3073313650 -0.3052431533 -0.3031494171 -0.3010503380 -0.2989460977 [246] -0.2968368776 -0.2947228591 -0.2926042233 -0.2904811510 -0.2883538226 [251] -0.2862224182 -0.2840871176 -0.2819480997 -0.2798055433 -0.2776596262 [256] -0.2755105259 -0.2733584189 -0.2712034811 -0.2690458877 -0.2668858127 [261] -0.2647234297 -0.2625589109 -0.2603924278 -0.2582241508 -0.2560542493 [266] -0.2538828914 -0.2517102443 -0.2495364739 -0.2473617448 -0.2451862206 [271] -0.2430100633 -0.2408334338 -0.2386564915 -0.2364793945 -0.2343022996 [276] -0.2321253618 -0.2299487351 -0.2277725715 -0.2255970219 -0.2234222353 [281] -0.2212483595 -0.2190755403 -0.2169039222 -0.2147336480 -0.2125648585 [286] -0.2103976934 -0.2082322903 -0.2060687852 -0.2039073124 -0.2017480044 [291] -0.1995909921 -0.1974364044 -0.1952843686 -0.1931350103 -0.1909884530 [296] -0.1888448187 -0.1867042275 -0.1845667976 -0.1824326455 -0.1803018858 [301] -0.1781746314 -0.1760509932 -0.1739310803 -0.1718150002 -0.1697028583 [306] -0.1675947582 -0.1654908018 -0.1633910891 -0.1612957183 -0.1592047858 [311] -0.1571183862 -0.1550366121 -0.1529595546 -0.1508873028 -0.1488199440 [316] -0.1467575639 -0.1447002461 -0.1426480729 -0.1406011244 -0.1385594792 [321] -0.1365232141 -0.1344924041 -0.1324671226 -0.1304474412 -0.1284334300 [326] -0.1264251571 -0.1244226893 -0.1224260913 -0.1204354267 -0.1184507570 [331] -0.1164721423 -0.1144996412 -0.1125333104 -0.1105732054 -0.1086193798 [336] -0.1066718860 -0.1047307747 -0.1027960950 -0.1008678947 -0.0989462200 [341] -0.0970311157 -0.0951226252 -0.0932207904 -0.0913256517 -0.0894372483 [346] -0.0875556180 -0.0856807972 -0.0838128209 -0.0819517228 -0.0800975354 [351] -0.0782502899 -0.0764100160 -0.0745767425 -0.0727504967 -0.0709313049 [356] -0.0691191919 -0.0673141817 -0.0655162967 -0.0637255586 -0.0619419876 [361] -0.0601656031 -0.0583964232 -0.0566344650 -0.0548797445 -0.0531322766 [366] -0.0513920754 -0.0496591538 -0.0479335237 -0.0462151962 -0.0445041813 [371] -0.0428004881 -0.0411041247 -0.0394150984 -0.0377334156 -0.0360590818 [376] -0.0343921017 -0.0327324789 -0.0310802166 -0.0294353168 -0.0277977810 [381] -0.0261676098 -0.0245448028 -0.0229293594 -0.0213212777 -0.0197205555 [386] -0.0181271895 -0.0165411762 -0.0149625110 -0.0133911889 -0.0118272040 [391] -0.0102705501 -0.0087212200 -0.0071792063 -0.0056445007 -0.0041170944 [396] -0.0025969782 -0.0010841420 0.0004214245 0.0019197322 0.0034107927 [401] 0.0048946180 > mx [1] 0.004894618 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1p7j91258053034.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/rcomp/tmp/25bbi1258053034.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/rcomp/tmp/3cxsh1258053034.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/rcomp/tmp/46zdi1258053034.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/rcomp/tmp/5knxa1258053034.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6xj7n1258053034.tab") > > system("convert tmp/1p7j91258053034.ps tmp/1p7j91258053034.png") > system("convert tmp/25bbi1258053034.ps tmp/25bbi1258053034.png") > system("convert tmp/3cxsh1258053034.ps tmp/3cxsh1258053034.png") > system("convert tmp/46zdi1258053034.ps tmp/46zdi1258053034.png") > system("convert tmp/5knxa1258053034.ps tmp/5knxa1258053034.png") > > > proc.time() user system elapsed 1.370 1.200 1.995