R version 2.8.0 (2008-10-20) 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(62.2,88.5,93.3,89.2,101.3,97,102.2,100.3,78.2,105.9,119.9,108,77,93.1,109.5,100.4,99,113.9,102.1,101.6,84,110.7,111.6,110.7,73.1,87.5,109.6,99.3,92.1,109.3,94.5,91.4,82.9,103.3,96,104.8,65.8,78.7,100.3,85,94.5,97.9,91.9,87.2,84.4,99.2,105.4,110.9,69.8,86.8,106.7,88.8,96.9,108.1,93.7,94.8,79.8,95.6,107.9,104.9,61.9,85.7,92.4,86.4,99.3,95.5,97,102.1,77.8,105.5,113.2,108.8,66.9,89.3,93.6,92,99.5,98.6,94.6,96.7,75.3,102.5,115.1,104.7,71.4) > #'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.009862125 -0.009938112 -0.010014006 -0.010089806 -0.010165512 [6] -0.010241125 -0.010316643 -0.010392067 -0.010467396 -0.010542631 [11] -0.010617771 -0.010692817 -0.010767767 -0.010842622 -0.010917382 [16] -0.010992047 -0.011066616 -0.011141089 -0.011215466 -0.011289748 [21] -0.011363933 -0.011438023 -0.011512016 -0.011585912 -0.011659712 [26] -0.011733415 -0.011807021 -0.011880530 -0.011953943 -0.012027258 [31] -0.012100475 -0.012173595 -0.012246618 -0.012319543 -0.012392369 [36] -0.012465099 -0.012537729 -0.012610262 -0.012682697 -0.012755033 [41] -0.012827270 -0.012899409 -0.012971450 -0.013043391 -0.013115234 [46] -0.013186977 -0.013258621 -0.013330166 -0.013401612 -0.013472958 [51] -0.013544205 -0.013615352 -0.013686399 -0.013757347 -0.013828194 [56] -0.013898941 -0.013969589 -0.014040136 -0.014110582 -0.014180929 [61] -0.014251175 -0.014321320 -0.014391365 -0.014461308 -0.014531151 [66] -0.014600893 -0.014670535 -0.014740075 -0.014809513 -0.014878851 [71] -0.014948087 -0.015017222 -0.015086256 -0.015155188 -0.015224018 [76] -0.015292747 -0.015361374 -0.015429899 -0.015498322 -0.015566643 [81] -0.015634862 -0.015702979 -0.015770994 -0.015838907 -0.015906718 [86] -0.015974426 -0.016042032 -0.016109535 -0.016176936 -0.016244234 [91] -0.016311430 -0.016378523 -0.016445513 -0.016512401 -0.016579186 [96] -0.016645867 -0.016712446 -0.016778922 -0.016845295 -0.016911565 [101] -0.016977732 -0.017043796 -0.017109757 -0.017175614 -0.017241368 [106] -0.017307019 -0.017372567 -0.017438011 -0.017503352 -0.017568589 [111] -0.017633723 -0.017698754 -0.017763681 -0.017828504 -0.017893224 [116] -0.017957840 -0.018022353 -0.018086762 -0.018151068 -0.018215270 [121] -0.018279368 -0.018343362 -0.018407253 -0.018471040 -0.018534723 [126] -0.018598303 -0.018661778 -0.018725150 -0.018788418 -0.018851583 [131] -0.018914643 -0.018977600 -0.019040452 -0.019103201 -0.019165847 [136] -0.019228388 -0.019290825 -0.019353159 -0.019415389 -0.019477515 [141] -0.019539537 -0.019601455 -0.019663270 -0.019724980 -0.019786587 [146] -0.019848090 -0.019909490 -0.019970785 -0.020031977 -0.020093065 [151] -0.020154049 -0.020214930 -0.020275707 -0.020336380 -0.020396949 [156] -0.020457415 -0.020517777 -0.020578036 -0.020638191 -0.020698243 [161] -0.020758191 -0.020818035 -0.020877776 -0.020937414 -0.020996948 [166] -0.021056379 -0.021115706 -0.021174930 -0.021234051 -0.021293069 [171] -0.021351983 -0.021410794 -0.021469502 -0.021528107 -0.021586609 [176] -0.021645008 -0.021703304 -0.021761497 -0.021819587 -0.021877574 [181] -0.021935459 -0.021993241 -0.022050920 -0.022108496 -0.022165970 [186] -0.022223341 -0.022280610 -0.022337776 -0.022394840 -0.022451802 [191] -0.022508661 -0.022565419 -0.022622074 -0.022678627 -0.022735078 [196] -0.022791427 -0.022847674 -0.022903819 -0.022959862 -0.023015804 [201] -0.023071644 -0.023127383 -0.023183020 -0.023238556 -0.023293990 [206] -0.023349323 -0.023404555 -0.023459685 -0.023514715 -0.023569644 [211] -0.023624471 -0.023679198 -0.023733824 -0.023788350 -0.023842774 [216] -0.023897099 -0.023951323 -0.024005446 -0.024059469 -0.024113393 [221] -0.024167216 -0.024220939 -0.024274562 -0.024328085 -0.024381508 [226] -0.024434832 -0.024488056 -0.024541181 -0.024594207 -0.024647133 [231] -0.024699960 -0.024752688 -0.024805317 -0.024857847 -0.024910278 [236] -0.024962611 -0.025014845 -0.025066980 -0.025119017 -0.025170956 [241] -0.025222797 -0.025274539 -0.025326184 -0.025377730 -0.025429179 [246] -0.025480531 -0.025531784 -0.025582941 -0.025633999 -0.025684961 [251] -0.025735826 -0.025786594 -0.025837264 -0.025887838 -0.025938316 [256] -0.025988697 -0.026038981 -0.026089169 -0.026139261 -0.026189257 [261] -0.026239157 -0.026288961 -0.026338670 -0.026388282 -0.026437800 [266] -0.026487222 -0.026536549 -0.026585781 -0.026634917 -0.026683959 [271] -0.026732907 -0.026781759 -0.026830518 -0.026879182 -0.026927751 [276] -0.026976227 -0.027024609 -0.027072897 -0.027121091 -0.027169192 [281] -0.027217200 -0.027265114 -0.027312935 -0.027360663 -0.027408298 [286] -0.027455841 -0.027503290 -0.027550648 -0.027597913 -0.027645086 [291] -0.027692167 -0.027739156 -0.027786054 -0.027832860 -0.027879574 [296] -0.027926197 -0.027972729 -0.028019170 -0.028065520 -0.028111779 [301] -0.028157948 -0.028204026 -0.028250014 -0.028295912 -0.028341720 [306] -0.028387438 -0.028433066 -0.028478605 -0.028524055 -0.028569415 [311] -0.028614686 -0.028659868 -0.028704962 -0.028749966 -0.028794883 [316] -0.028839711 -0.028884451 -0.028929103 -0.028973667 -0.029018143 [321] -0.029062532 -0.029106833 -0.029151048 -0.029195175 -0.029239215 [326] -0.029283169 -0.029327036 -0.029370816 -0.029414511 -0.029458119 [331] -0.029501642 -0.029545078 -0.029588429 -0.029631695 -0.029674875 [336] -0.029717970 -0.029760980 -0.029803906 -0.029846747 -0.029889503 [341] -0.029932175 -0.029974763 -0.030017267 -0.030059688 -0.030102025 [346] -0.030144278 -0.030186448 -0.030228535 -0.030270539 -0.030312460 [351] -0.030354299 -0.030396055 -0.030437729 -0.030479321 -0.030520831 [356] -0.030562259 -0.030603606 -0.030644871 -0.030686055 -0.030727158 [361] -0.030768180 -0.030809122 -0.030849983 -0.030890763 -0.030931464 [366] -0.030972084 -0.031012625 -0.031053086 -0.031093468 -0.031133770 [371] -0.031173993 -0.031214138 -0.031254203 -0.031294190 -0.031334099 [376] -0.031373929 -0.031413681 -0.031453356 -0.031492952 -0.031532472 [381] -0.031571914 -0.031611278 -0.031650566 -0.031689777 -0.031728912 [386] -0.031767970 -0.031806952 -0.031845857 -0.031884687 -0.031923441 [391] -0.031962120 -0.032000723 -0.032039251 -0.032077705 -0.032116083 [396] -0.032154387 -0.032192616 -0.032230771 -0.032268852 -0.032306860 [401] -0.032344793 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/18i2z1226592568.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/freestat/rcomp/tmp/2dgxe1226592568.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/freestat/rcomp/tmp/3a4k91226592568.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/freestat/rcomp/tmp/4vrfj1226592568.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/freestat/rcomp/tmp/5ymi61226592568.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/69hzs1226592568.tab") > > system("convert tmp/18i2z1226592568.ps tmp/18i2z1226592568.png") > system("convert tmp/2dgxe1226592568.ps tmp/2dgxe1226592568.png") > system("convert tmp/3a4k91226592568.ps tmp/3a4k91226592568.png") > system("convert tmp/4vrfj1226592568.ps tmp/4vrfj1226592568.png") > system("convert tmp/5ymi61226592568.ps tmp/5ymi61226592568.png") > > > proc.time() user system elapsed 1.716 1.265 1.953