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(101,100.88,100.55,100.83,101.51,102.16,102.39,102.54,102.85,103.47,103.57,103.69,103.5,103.47,103.45,103.48,103.93,103.89,104.4,104.79,104.77,105.13,105.26,104.96,104.75,105.01,105.15,105.2,105.77,105.78,106.26,106.13,106.12,106.57,106.44,106.54,107.1,108.1,108.4,108.84,109.62,110.42,110.67,111.66,112.28,112.87,112.18,112.36,112.16,111.49,111.25,111.36,111.74,111.1,111.33,111.25,111.04,110.97,111.31,111.02) > #'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.9313828 0.9313607 0.9313386 0.9313165 0.9312943 0.9312722 0.9312500 [8] 0.9312278 0.9312055 0.9311833 0.9311610 0.9311387 0.9311164 0.9310941 [15] 0.9310718 0.9310494 0.9310270 0.9310046 0.9309822 0.9309598 0.9309373 [22] 0.9309149 0.9308924 0.9308698 0.9308473 0.9308248 0.9308022 0.9307796 [29] 0.9307570 0.9307344 0.9307117 0.9306891 0.9306664 0.9306437 0.9306209 [36] 0.9305982 0.9305754 0.9305527 0.9305299 0.9305071 0.9304842 0.9304614 [43] 0.9304385 0.9304156 0.9303927 0.9303698 0.9303468 0.9303238 0.9303009 [50] 0.9302779 0.9302548 0.9302318 0.9302087 0.9301856 0.9301625 0.9301394 [57] 0.9301163 0.9300931 0.9300700 0.9300468 0.9300236 0.9300003 0.9299771 [64] 0.9299538 0.9299305 0.9299072 0.9298839 0.9298605 0.9298372 0.9298138 [71] 0.9297904 0.9297670 0.9297436 0.9297201 0.9296966 0.9296731 0.9296496 [78] 0.9296261 0.9296026 0.9295790 0.9295554 0.9295318 0.9295082 0.9294845 [85] 0.9294609 0.9294372 0.9294135 0.9293898 0.9293661 0.9293423 0.9293185 [92] 0.9292948 0.9292710 0.9292471 0.9292233 0.9291994 0.9291755 0.9291516 [99] 0.9291277 0.9291038 0.9290798 0.9290559 0.9290319 0.9290079 0.9289838 [106] 0.9289598 0.9289357 0.9289117 0.9288876 0.9288634 0.9288393 0.9288152 [113] 0.9287910 0.9287668 0.9287426 0.9287184 0.9286941 0.9286698 0.9286456 [120] 0.9286213 0.9285969 0.9285726 0.9285482 0.9285239 0.9284995 0.9284751 [127] 0.9284506 0.9284262 0.9284017 0.9283773 0.9283528 0.9283282 0.9283037 [134] 0.9282792 0.9282546 0.9282300 0.9282054 0.9281808 0.9281561 0.9281315 [141] 0.9281068 0.9280821 0.9280574 0.9280326 0.9280079 0.9279831 0.9279583 [148] 0.9279335 0.9279087 0.9278838 0.9278590 0.9278341 0.9278092 0.9277843 [155] 0.9277594 0.9277344 0.9277095 0.9276845 0.9276595 0.9276344 0.9276094 [162] 0.9275844 0.9275593 0.9275342 0.9275091 0.9274840 0.9274588 0.9274336 [169] 0.9274085 0.9273833 0.9273581 0.9273328 0.9273076 0.9272823 0.9272570 [176] 0.9272317 0.9272064 0.9271810 0.9271557 0.9271303 0.9271049 0.9270795 [183] 0.9270541 0.9270286 0.9270032 0.9269777 0.9269522 0.9269267 0.9269012 [190] 0.9268756 0.9268500 0.9268245 0.9267988 0.9267732 0.9267476 0.9267219 [197] 0.9266963 0.9266706 0.9266449 0.9266191 0.9265934 0.9265676 0.9265419 [204] 0.9265161 0.9264903 0.9264644 0.9264386 0.9264127 0.9263868 0.9263609 [211] 0.9263350 0.9263091 0.9262831 0.9262572 0.9262312 0.9262052 0.9261791 [218] 0.9261531 0.9261271 0.9261010 0.9260749 0.9260488 0.9260227 0.9259965 [225] 0.9259704 0.9259442 0.9259180 0.9258918 0.9258656 0.9258393 0.9258131 [232] 0.9257868 0.9257605 0.9257342 0.9257078 0.9256815 0.9256551 0.9256287 [239] 0.9256023 0.9255759 0.9255495 0.9255230 0.9254966 0.9254701 0.9254436 [246] 0.9254171 0.9253905 0.9253640 0.9253374 0.9253108 0.9252842 0.9252576 [253] 0.9252310 0.9252043 0.9251777 0.9251510 0.9251243 0.9250975 0.9250708 [260] 0.9250441 0.9250173 0.9249905 0.9249637 0.9249369 0.9249100 0.9248832 [267] 0.9248563 0.9248294 0.9248025 0.9247756 0.9247486 0.9247217 0.9246947 [274] 0.9246677 0.9246407 0.9246137 0.9245866 0.9245596 0.9245325 0.9245054 [281] 0.9244783 0.9244512 0.9244241 0.9243969 0.9243697 0.9243425 0.9243153 [288] 0.9242881 0.9242609 0.9242336 0.9242063 0.9241790 0.9241517 0.9241244 [295] 0.9240971 0.9240697 0.9240423 0.9240150 0.9239876 0.9239601 0.9239327 [302] 0.9239052 0.9238778 0.9238503 0.9238228 0.9237953 0.9237677 0.9237402 [309] 0.9237126 0.9236850 0.9236574 0.9236298 0.9236021 0.9235745 0.9235468 [316] 0.9235191 0.9234914 0.9234637 0.9234360 0.9234082 0.9233805 0.9233527 [323] 0.9233249 0.9232971 0.9232692 0.9232414 0.9232135 0.9231856 0.9231578 [330] 0.9231298 0.9231019 0.9230740 0.9230460 0.9230180 0.9229900 0.9229620 [337] 0.9229340 0.9229060 0.9228779 0.9228498 0.9228217 0.9227936 0.9227655 [344] 0.9227374 0.9227092 0.9226810 0.9226529 0.9226247 0.9225964 0.9225682 [351] 0.9225399 0.9225117 0.9224834 0.9224551 0.9224268 0.9223985 0.9223701 [358] 0.9223417 0.9223134 0.9222850 0.9222566 0.9222281 0.9221997 0.9221712 [365] 0.9221428 0.9221143 0.9220858 0.9220572 0.9220287 0.9220002 0.9219716 [372] 0.9219430 0.9219144 0.9218858 0.9218571 0.9218285 0.9217998 0.9217712 [379] 0.9217425 0.9217138 0.9216850 0.9216563 0.9216275 0.9215987 0.9215700 [386] 0.9215412 0.9215123 0.9214835 0.9214546 0.9214258 0.9213969 0.9213680 [393] 0.9213391 0.9213102 0.9212812 0.9212522 0.9212233 0.9211943 0.9211653 [400] 0.9211362 0.9211072 > mx [1] 0.9313828 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1ncln1257955977.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/2omch1257955977.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/3jqcp1257955977.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/4of1g1257955978.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/55rpe1257955978.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/6kcnn1257955978.tab") > > system("convert tmp/1ncln1257955977.ps tmp/1ncln1257955977.png") > system("convert tmp/2omch1257955977.ps tmp/2omch1257955977.png") > system("convert tmp/3jqcp1257955977.ps tmp/3jqcp1257955977.png") > system("convert tmp/4of1g1257955978.ps tmp/4of1g1257955978.png") > system("convert tmp/55rpe1257955978.ps tmp/55rpe1257955978.png") > > > proc.time() user system elapsed 1.710 1.277 1.991