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(105.86,105.86,105.86,105.86,105.86,105.86,108.42,108.42,108.42,108.42,108.42,108.42,108.42,108.42,108.42,108.42,108.84,108.84,108.84,108.84,108.84,108.84,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,110.51,112.43,112.43,112.43,112.43,112.43,113.68,113.68,113.68,113.68,113.68) > #'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.9608933 0.9608987 0.9609040 0.9609094 0.9609147 0.9609200 0.9609253 [8] 0.9609306 0.9609358 0.9609411 0.9609463 0.9609515 0.9609567 0.9609619 [15] 0.9609671 0.9609723 0.9609774 0.9609825 0.9609876 0.9609928 0.9609978 [22] 0.9610029 0.9610080 0.9610130 0.9610180 0.9610231 0.9610281 0.9610330 [29] 0.9610380 0.9610430 0.9610479 0.9610528 0.9610578 0.9610627 0.9610675 [36] 0.9610724 0.9610773 0.9610821 0.9610869 0.9610918 0.9610966 0.9611013 [43] 0.9611061 0.9611109 0.9611156 0.9611203 0.9611250 0.9611297 0.9611344 [50] 0.9611391 0.9611437 0.9611484 0.9611530 0.9611576 0.9611622 0.9611668 [57] 0.9611713 0.9611759 0.9611804 0.9611850 0.9611895 0.9611940 0.9611984 [64] 0.9612029 0.9612073 0.9612118 0.9612162 0.9612206 0.9612250 0.9612294 [71] 0.9612337 0.9612381 0.9612424 0.9612467 0.9612510 0.9612553 0.9612596 [78] 0.9612639 0.9612681 0.9612723 0.9612766 0.9612808 0.9612850 0.9612891 [85] 0.9612933 0.9612974 0.9613016 0.9613057 0.9613098 0.9613139 0.9613179 [92] 0.9613220 0.9613260 0.9613301 0.9613341 0.9613381 0.9613421 0.9613460 [99] 0.9613500 0.9613539 0.9613579 0.9613618 0.9613657 0.9613696 0.9613734 [106] 0.9613773 0.9613811 0.9613849 0.9613888 0.9613926 0.9613963 0.9614001 [113] 0.9614039 0.9614076 0.9614113 0.9614150 0.9614187 0.9614224 0.9614261 [120] 0.9614297 0.9614334 0.9614370 0.9614406 0.9614442 0.9614478 0.9614513 [127] 0.9614549 0.9614584 0.9614619 0.9614654 0.9614689 0.9614724 0.9614759 [134] 0.9614793 0.9614828 0.9614862 0.9614896 0.9614930 0.9614964 0.9614997 [141] 0.9615031 0.9615064 0.9615097 0.9615130 0.9615163 0.9615196 0.9615228 [148] 0.9615261 0.9615293 0.9615325 0.9615357 0.9615389 0.9615421 0.9615453 [155] 0.9615484 0.9615515 0.9615546 0.9615577 0.9615608 0.9615639 0.9615670 [162] 0.9615700 0.9615730 0.9615760 0.9615790 0.9615820 0.9615850 0.9615880 [169] 0.9615909 0.9615938 0.9615967 0.9615996 0.9616025 0.9616054 0.9616082 [176] 0.9616111 0.9616139 0.9616167 0.9616195 0.9616223 0.9616251 0.9616278 [183] 0.9616306 0.9616333 0.9616360 0.9616387 0.9616414 0.9616440 0.9616467 [190] 0.9616493 0.9616520 0.9616546 0.9616572 0.9616597 0.9616623 0.9616649 [197] 0.9616674 0.9616699 0.9616724 0.9616749 0.9616774 0.9616799 0.9616823 [204] 0.9616847 0.9616872 0.9616896 0.9616920 0.9616943 0.9616967 0.9616991 [211] 0.9617014 0.9617037 0.9617060 0.9617083 0.9617106 0.9617128 0.9617151 [218] 0.9617173 0.9617195 0.9617217 0.9617239 0.9617261 0.9617283 0.9617304 [225] 0.9617326 0.9617347 0.9617368 0.9617389 0.9617409 0.9617430 0.9617450 [232] 0.9617471 0.9617491 0.9617511 0.9617531 0.9617551 0.9617570 0.9617590 [239] 0.9617609 0.9617628 0.9617647 0.9617666 0.9617685 0.9617703 0.9617722 [246] 0.9617740 0.9617758 0.9617776 0.9617794 0.9617812 0.9617829 0.9617847 [253] 0.9617864 0.9617881 0.9617898 0.9617915 0.9617932 0.9617948 0.9617965 [260] 0.9617981 0.9617997 0.9618013 0.9618029 0.9618044 0.9618060 0.9618075 [267] 0.9618091 0.9618106 0.9618121 0.9618136 0.9618150 0.9618165 0.9618179 [274] 0.9618193 0.9618208 0.9618222 0.9618235 0.9618249 0.9618263 0.9618276 [281] 0.9618289 0.9618302 0.9618315 0.9618328 0.9618341 0.9618353 0.9618366 [288] 0.9618378 0.9618390 0.9618402 0.9618414 0.9618425 0.9618437 0.9618448 [295] 0.9618460 0.9618471 0.9618482 0.9618492 0.9618503 0.9618514 0.9618524 [302] 0.9618534 0.9618544 0.9618554 0.9618564 0.9618574 0.9618583 0.9618592 [309] 0.9618602 0.9618611 0.9618620 0.9618628 0.9618637 0.9618646 0.9618654 [316] 0.9618662 0.9618670 0.9618678 0.9618686 0.9618694 0.9618701 0.9618708 [323] 0.9618716 0.9618723 0.9618730 0.9618736 0.9618743 0.9618750 0.9618756 [330] 0.9618762 0.9618768 0.9618774 0.9618780 0.9618785 0.9618791 0.9618796 [337] 0.9618802 0.9618807 0.9618811 0.9618816 0.9618821 0.9618825 0.9618830 [344] 0.9618834 0.9618838 0.9618842 0.9618846 0.9618849 0.9618853 0.9618856 [351] 0.9618859 0.9618862 0.9618865 0.9618868 0.9618871 0.9618873 0.9618875 [358] 0.9618878 0.9618880 0.9618882 0.9618883 0.9618885 0.9618886 0.9618888 [365] 0.9618889 0.9618890 0.9618891 0.9618892 0.9618892 0.9618893 0.9618893 [372] 0.9618893 0.9618893 0.9618893 0.9618893 0.9618893 0.9618892 0.9618891 [379] 0.9618891 0.9618890 0.9618889 0.9618887 0.9618886 0.9618884 0.9618883 [386] 0.9618881 0.9618879 0.9618877 0.9618875 0.9618872 0.9618870 0.9618867 [393] 0.9618864 0.9618861 0.9618858 0.9618855 0.9618851 0.9618848 0.9618844 [400] 0.9618840 0.9618837 > mx [1] 0.9618893 > mxli [1] 1.72 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1srwr1257933248.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/2o1pr1257933248.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/3e9tt1257933248.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/4e8pb1257933248.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/5mvp81257933248.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/6bzbh1257933248.tab") > > system("convert tmp/1srwr1257933248.ps tmp/1srwr1257933248.png") > system("convert tmp/2o1pr1257933248.ps tmp/2o1pr1257933248.png") > system("convert tmp/3e9tt1257933248.ps tmp/3e9tt1257933248.png") > system("convert tmp/4e8pb1257933248.ps tmp/4e8pb1257933248.png") > system("convert tmp/5mvp81257933248.ps tmp/5mvp81257933248.png") > > > proc.time() user system elapsed 1.719 1.274 2.191