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(17,17,18,21,20,28,19,22,16,18,25,17,14,11,27,20,22,22,21,23,17,24,14,17,23,24,24,8,22,23,25,21,24,15,22,21,25,16,28,23,21,21,26,22,21,18,12,25,17,24,15,13,26,16,24,21,20,14,25,25,20,22,20,26,18,22,24,17,24,20,19,20,15,23,26,22,20,24,26,21,25,13,20,22,23,28,22,20,6,21,20,18,23,20,24,22,21,18,21,23,23,15,21,24,23,21,21,20,11,22,27,25,18,20,24,10,27,21,21,18,15,24,22,14,28,18,26,17,19,22,18,24,15,18,26,11,26,21,23,23,15,22,26,16,20,18,22,16,19,20,19,23,24,25,21,21,23,27,23,18,16,16) > #'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.02933033 0.02940195 0.02947327 0.02954429 0.02961499 0.02968539 [7] 0.02975547 0.02982522 0.02989466 0.02996376 0.03003254 0.03010098 [13] 0.03016907 0.03023683 0.03030424 0.03037130 0.03043800 0.03050435 [19] 0.03057033 0.03063595 0.03070121 0.03076608 0.03083059 0.03089471 [25] 0.03095846 0.03102181 0.03108478 0.03114735 0.03120953 0.03127131 [31] 0.03133269 0.03139366 0.03145422 0.03151437 0.03157411 0.03163343 [37] 0.03169233 0.03175080 0.03180885 0.03186646 0.03192365 0.03198040 [43] 0.03203671 0.03209258 0.03214801 0.03220299 0.03225752 0.03231161 [49] 0.03236524 0.03241841 0.03247112 0.03252338 0.03257517 0.03262650 [55] 0.03267736 0.03272775 0.03277767 0.03282712 0.03287609 0.03292459 [61] 0.03297260 0.03302014 0.03306719 0.03311376 0.03315984 0.03320544 [67] 0.03325055 0.03329517 0.03333929 0.03338292 0.03342606 0.03346870 [73] 0.03351085 0.03355250 0.03359365 0.03363429 0.03367444 0.03371409 [79] 0.03375323 0.03379187 0.03383000 0.03386763 0.03390475 0.03394137 [85] 0.03397748 0.03401308 0.03404818 0.03408277 0.03411684 0.03415041 [91] 0.03418347 0.03421602 0.03424807 0.03427960 0.03431062 0.03434113 [97] 0.03437114 0.03440063 0.03442962 0.03445810 0.03448607 0.03451353 [103] 0.03454048 0.03456693 0.03459287 0.03461830 0.03464323 0.03466765 [109] 0.03469157 0.03471498 0.03473790 0.03476031 0.03478222 0.03480363 [115] 0.03482454 0.03484495 0.03486487 0.03488429 0.03490321 0.03492165 [121] 0.03493958 0.03495703 0.03497399 0.03499046 0.03500644 0.03502194 [127] 0.03503696 0.03505149 0.03506554 0.03507911 0.03509220 0.03510481 [133] 0.03511695 0.03512862 0.03513982 0.03515055 0.03516081 0.03517060 [139] 0.03517993 0.03518880 0.03519721 0.03520516 0.03521265 0.03521969 [145] 0.03522628 0.03523242 0.03523811 0.03524335 0.03524815 0.03525251 [151] 0.03525643 0.03525992 0.03526297 0.03526558 0.03526777 0.03526952 [157] 0.03527086 0.03527176 0.03527225 0.03527232 0.03527197 0.03527121 [163] 0.03527004 0.03526846 0.03526647 0.03526408 0.03526128 0.03525809 [169] 0.03525450 0.03525052 0.03524614 0.03524138 0.03523623 0.03523070 [175] 0.03522478 0.03521849 0.03521181 0.03520477 0.03519736 0.03518957 [181] 0.03518142 0.03517291 0.03516404 0.03515480 0.03514522 0.03513528 [187] 0.03512499 0.03511435 0.03510337 0.03509205 0.03508038 0.03506838 [193] 0.03505605 0.03504338 0.03503039 0.03501707 0.03500342 0.03498946 [199] 0.03497517 0.03496057 0.03494566 0.03493043 0.03491490 0.03489906 [205] 0.03488292 0.03486648 0.03484974 0.03483271 0.03481539 0.03479777 [211] 0.03477987 0.03476168 0.03474321 0.03472447 0.03470544 0.03468614 [217] 0.03466657 0.03464673 0.03462662 0.03460625 0.03458562 0.03456472 [223] 0.03454358 0.03452217 0.03450052 0.03447861 0.03445646 0.03443406 [229] 0.03441142 0.03438854 0.03436543 0.03434208 0.03431849 0.03429468 [235] 0.03427064 0.03424637 0.03422188 0.03419717 0.03417224 0.03414709 [241] 0.03412173 0.03409616 0.03407038 0.03404439 0.03401819 0.03399180 [247] 0.03396520 0.03393840 0.03391141 0.03388422 0.03385685 0.03382928 [253] 0.03380152 0.03377358 0.03374546 0.03371715 0.03368866 0.03366000 [259] 0.03363116 0.03360215 0.03357297 0.03354362 0.03351410 0.03348441 [265] 0.03345457 0.03342456 0.03339439 0.03336406 0.03333358 0.03330294 [271] 0.03327216 0.03324122 0.03321013 0.03317890 0.03314752 0.03311600 [277] 0.03308434 0.03305254 0.03302061 0.03298853 0.03295632 0.03292398 [283] 0.03289151 0.03285891 0.03282619 0.03279333 0.03276036 0.03272726 [289] 0.03269404 0.03266070 0.03262724 0.03259367 0.03255998 0.03252618 [295] 0.03249227 0.03245825 0.03242412 0.03238989 0.03235554 0.03232110 [301] 0.03228655 0.03225190 0.03221715 0.03218230 0.03214736 0.03211232 [307] 0.03207718 0.03204196 0.03200664 0.03197123 0.03193573 0.03190015 [313] 0.03186448 0.03182872 0.03179288 0.03175696 0.03172096 0.03168488 [319] 0.03164872 0.03161248 0.03157616 0.03153977 0.03150331 0.03146677 [325] 0.03143016 0.03139348 0.03135673 0.03131992 0.03128303 0.03124608 [331] 0.03120907 0.03117199 0.03113485 0.03109764 0.03106038 0.03102306 [337] 0.03098567 0.03094823 0.03091073 0.03087318 0.03083557 0.03079791 [343] 0.03076020 0.03072243 0.03068461 0.03064674 0.03060883 0.03057086 [349] 0.03053285 0.03049479 0.03045668 0.03041853 0.03038034 0.03034210 [355] 0.03030382 0.03026550 0.03022714 0.03018874 0.03015030 0.03011182 [361] 0.03007330 0.03003475 0.02999616 0.02995754 0.02991888 0.02988019 [367] 0.02984146 0.02980270 0.02976392 0.02972510 0.02968624 0.02964736 [373] 0.02960846 0.02956952 0.02953056 0.02949156 0.02945255 0.02941350 [379] 0.02937444 0.02933534 0.02929623 0.02925709 0.02921793 0.02917874 [385] 0.02913954 0.02910031 0.02906107 0.02902180 0.02898252 0.02894322 [391] 0.02890390 0.02886456 0.02882520 0.02878583 0.02874645 0.02870705 [397] 0.02866763 0.02862820 0.02858875 0.02854929 0.02850982 > mx [1] 0.03527232 > mxli [1] -0.41 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1ceoo1321808354.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/2ynj81321808354.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/3kv9f1321808354.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/4v8sk1321808354.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/5gyvs1321808354.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/66kr11321808354.tab") > > try(system("convert tmp/1ceoo1321808354.ps tmp/1ceoo1321808354.png",intern=TRUE)) character(0) > try(system("convert tmp/2ynj81321808354.ps tmp/2ynj81321808354.png",intern=TRUE)) character(0) > try(system("convert tmp/3kv9f1321808354.ps tmp/3kv9f1321808354.png",intern=TRUE)) character(0) > try(system("convert tmp/4v8sk1321808354.ps tmp/4v8sk1321808354.png",intern=TRUE)) character(0) > try(system("convert tmp/5gyvs1321808354.ps tmp/5gyvs1321808354.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.514 0.262 1.820