R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(23,24,22,20,24,27,28,27,24,23,24,27,27,28,27,23,24,28,27,25,19,24,20,28,26,23,23,20,11,24,25,23,18,20,20,24,23,25,28,26,26,23,22,24,21,20,22,20,25,20,22,23,25,23,23,22,24,25,21,12,17,20,23,23,20,28,24,24,24,24,28,25,21,25,25,18,17,26,28,21,27,22,21,25,22,23,26,19,25,21,13,24,25,26,25,25,22,21,23,25,24,21,21,25,22,20,20,23,28,23,28,24,18,20,28,21,21,25,19,18,21,22,24,15,28,26,23,26,20,22,20,23,22,24,23,22,26,23,27,23,21,26,23,21,27,19,23,25,23,22,22,25,25,28,28,20,25,19,25,22,18,20) > #'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.03781299 -0.03809307 -0.03837308 -0.03865302 -0.03893288 -0.03921267 [7] -0.03949236 -0.03977196 -0.04005147 -0.04033087 -0.04061017 -0.04088936 [13] -0.04116844 -0.04144739 -0.04172622 -0.04200492 -0.04228348 -0.04256191 [19] -0.04284019 -0.04311832 -0.04339630 -0.04367412 -0.04395178 -0.04422927 [25] -0.04450659 -0.04478373 -0.04506069 -0.04533747 -0.04561405 -0.04589043 [31] -0.04616662 -0.04644260 -0.04671837 -0.04699393 -0.04726926 -0.04754437 [37] -0.04781926 -0.04809391 -0.04836832 -0.04864249 -0.04891642 -0.04919009 [43] -0.04946351 -0.04973666 -0.05000955 -0.05028218 -0.05055452 -0.05082659 [49] -0.05109838 -0.05136988 -0.05164108 -0.05191199 -0.05218260 -0.05245290 [55] -0.05272290 -0.05299258 -0.05326194 -0.05353098 -0.05379969 -0.05406807 [61] -0.05433612 -0.05460382 -0.05487118 -0.05513820 -0.05540486 -0.05567116 [67] -0.05593710 -0.05620268 -0.05646789 -0.05673273 -0.05699719 -0.05726126 [73] -0.05752495 -0.05778826 -0.05805116 -0.05831368 -0.05857579 -0.05883749 [79] -0.05909879 -0.05935967 -0.05962014 -0.05988018 -0.06013980 -0.06039899 [85] -0.06065775 -0.06091608 -0.06117396 -0.06143140 -0.06168840 -0.06194494 [91] -0.06220103 -0.06245666 -0.06271183 -0.06296654 -0.06322077 -0.06347454 [97] -0.06372783 -0.06398064 -0.06423297 -0.06448481 -0.06473617 -0.06498703 [103] -0.06523740 -0.06548727 -0.06573663 -0.06598549 -0.06623385 -0.06648169 [109] -0.06672901 -0.06697582 -0.06722211 -0.06746787 -0.06771311 -0.06795782 [115] -0.06820199 -0.06844563 -0.06868873 -0.06893129 -0.06917330 -0.06941477 [121] -0.06965569 -0.06989605 -0.07013586 -0.07037512 -0.07061381 -0.07085193 [127] -0.07108950 -0.07132649 -0.07156291 -0.07179876 -0.07203403 -0.07226873 [133] -0.07250284 -0.07273637 -0.07296932 -0.07320168 -0.07343344 -0.07366462 [139] -0.07389520 -0.07412518 -0.07435457 -0.07458335 -0.07481153 -0.07503911 [145] -0.07526607 -0.07549243 -0.07571818 -0.07594331 -0.07616783 -0.07639173 [151] -0.07661502 -0.07683768 -0.07705972 -0.07728114 -0.07750192 -0.07772209 [157] -0.07794162 -0.07816052 -0.07837879 -0.07859642 -0.07881342 -0.07902978 [163] -0.07924551 -0.07946059 -0.07967503 -0.07988883 -0.08010198 -0.08031449 [169] -0.08052635 -0.08073756 -0.08094812 -0.08115804 -0.08136729 -0.08157590 [175] -0.08178385 -0.08199115 -0.08219779 -0.08240377 -0.08260910 -0.08281376 [181] -0.08301776 -0.08322111 -0.08342379 -0.08362580 -0.08382716 -0.08402784 [187] -0.08422787 -0.08442722 -0.08462591 -0.08482393 -0.08502128 -0.08521796 [193] -0.08541398 -0.08560932 -0.08580399 -0.08599799 -0.08619132 -0.08638397 [199] -0.08657595 -0.08676726 -0.08695789 -0.08714785 -0.08733714 -0.08752575 [205] -0.08771368 -0.08790094 -0.08808753 -0.08827343 -0.08845866 -0.08864322 [211] -0.08882709 -0.08901029 -0.08919282 -0.08937466 -0.08955583 -0.08973632 [217] -0.08991614 -0.09009528 -0.09027374 -0.09045152 -0.09062863 -0.09080506 [223] -0.09098081 -0.09115588 -0.09133028 -0.09150401 -0.09167705 -0.09184942 [229] -0.09202112 -0.09219214 -0.09236248 -0.09253215 -0.09270115 -0.09286947 [235] -0.09303712 -0.09320409 -0.09337039 -0.09353602 -0.09370098 -0.09386526 [241] -0.09402887 -0.09419182 -0.09435409 -0.09451569 -0.09467663 -0.09483689 [247] -0.09499649 -0.09515542 -0.09531369 -0.09547129 -0.09562822 -0.09578449 [253] -0.09594010 -0.09609504 -0.09624932 -0.09640294 -0.09655589 -0.09670819 [259] -0.09685983 -0.09701081 -0.09716113 -0.09731080 -0.09745981 -0.09760816 [265] -0.09775586 -0.09790291 -0.09804931 -0.09819505 -0.09834014 -0.09848459 [271] -0.09862839 -0.09877153 -0.09891404 -0.09905589 -0.09919711 -0.09933768 [277] -0.09947760 -0.09961689 -0.09975554 -0.09989355 -0.10003091 -0.10016765 [283] -0.10030375 -0.10043921 -0.10057404 -0.10070824 -0.10084180 -0.10097474 [289] -0.10110705 -0.10123873 -0.10136979 -0.10150022 -0.10163003 -0.10175921 [295] -0.10188778 -0.10201572 -0.10214305 -0.10226976 -0.10239585 -0.10252133 [301] -0.10264619 -0.10277045 -0.10289409 -0.10301712 -0.10313955 -0.10326137 [307] -0.10338258 -0.10350319 -0.10362320 -0.10374261 -0.10386142 -0.10397963 [313] -0.10409724 -0.10421426 -0.10433068 -0.10444651 -0.10456175 -0.10467641 [319] -0.10479047 -0.10490395 -0.10501684 -0.10512914 -0.10524087 -0.10535202 [325] -0.10546258 -0.10557257 -0.10568198 -0.10579082 -0.10589908 -0.10600678 [331] -0.10611390 -0.10622045 -0.10632644 -0.10643186 -0.10653672 -0.10664101 [337] -0.10674475 -0.10684792 -0.10695054 -0.10705260 -0.10715411 -0.10725506 [343] -0.10735546 -0.10745532 -0.10755462 -0.10765338 -0.10775159 -0.10784926 [349] -0.10794639 -0.10804297 -0.10813902 -0.10823453 -0.10832950 -0.10842395 [355] -0.10851785 -0.10861123 -0.10870408 -0.10879640 -0.10888820 -0.10897947 [361] -0.10907022 -0.10916044 -0.10925015 -0.10933934 -0.10942801 -0.10951617 [367] -0.10960382 -0.10969095 -0.10977758 -0.10986370 -0.10994931 -0.11003441 [373] -0.11011902 -0.11020312 -0.11028672 -0.11036982 -0.11045243 -0.11053454 [379] -0.11061616 -0.11069728 -0.11077792 -0.11085807 -0.11093773 -0.11101690 [385] -0.11109559 -0.11117380 -0.11125153 -0.11132878 -0.11140555 -0.11148185 [391] -0.11155768 -0.11163303 -0.11170791 -0.11178232 -0.11185626 -0.11192974 [397] -0.11200276 -0.11207531 -0.11214740 -0.11221903 -0.11229021 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1rfnc1321808272.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2ylaw1321808272.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/369mu1321808272.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4q5or1321808272.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/506vn1321808272.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/6123v1321808272.tab") > > try(system("convert tmp/1rfnc1321808272.ps tmp/1rfnc1321808272.png",intern=TRUE)) character(0) > try(system("convert tmp/2ylaw1321808272.ps tmp/2ylaw1321808272.png",intern=TRUE)) character(0) > try(system("convert tmp/369mu1321808272.ps tmp/369mu1321808272.png",intern=TRUE)) character(0) > try(system("convert tmp/4q5or1321808272.ps tmp/4q5or1321808272.png",intern=TRUE)) character(0) > try(system("convert tmp/506vn1321808272.ps tmp/506vn1321808272.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.425 0.289 1.746