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(21,15,18,11,8,19,4,20,16,14,10,13,14,8,23,11,9,24,5,15,5,19,6,13,11,17,17,5,9,15,17,17,20,12,7,16,7,14,24,15,15,10,14,18,12,9,9,8,18,10,17,14,16,10,19,10,14,10,4,19,9,12,16,11,18,11,24,17,18,9,19,18,12,23,22,14,14,16,23,7,10,12,12,12,17,21,16,11,14,13,9,19,13,19,13,13,13,14,12,22,11,5,18,19,14,15,12,19,15,17,8,10,12,12,20,12,12,14,6,10,18,18,7,18,9,17,22,11,15,17,15,22,9,13,20,14,14,12,20,20,8,17,9,18,22,10,13,15,18,18,12,12,20,12,16,16,18,16,13,17,13,17) > #'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.19231612 0.19228883 0.19225987 0.19222924 0.19219693 0.19216292 [7] 0.19212721 0.19208978 0.19205063 0.19200973 0.19196709 0.19192270 [13] 0.19187653 0.19182858 0.19177885 0.19172732 0.19167397 0.19161881 [19] 0.19156182 0.19150298 0.19144230 0.19137976 0.19131535 0.19124907 [25] 0.19118090 0.19111083 0.19103885 0.19096496 0.19088915 0.19081141 [31] 0.19073172 0.19065009 0.19056650 0.19048094 0.19039341 0.19030390 [37] 0.19021239 0.19011889 0.19002338 0.18992586 0.18982632 0.18972475 [43] 0.18962114 0.18951550 0.18940780 0.18929805 0.18918624 0.18907236 [49] 0.18895641 0.18883837 0.18871825 0.18859604 0.18847173 0.18834532 [55] 0.18821680 0.18808616 0.18795341 0.18781854 0.18768153 0.18754240 [61] 0.18740113 0.18725772 0.18711217 0.18696447 0.18681462 0.18666262 [67] 0.18650846 0.18635214 0.18619366 0.18603301 0.18587020 0.18570522 [73] 0.18553806 0.18536874 0.18519724 0.18502356 0.18484770 0.18466967 [79] 0.18448946 0.18430708 0.18412251 0.18393576 0.18374683 0.18355573 [85] 0.18336244 0.18316698 0.18296935 0.18276953 0.18256754 0.18236338 [91] 0.18215705 0.18194855 0.18173788 0.18152505 0.18131005 0.18109290 [97] 0.18087359 0.18065213 0.18042852 0.18020276 0.17997486 0.17974482 [103] 0.17951265 0.17927834 0.17904192 0.17880337 0.17856271 0.17831994 [109] 0.17807506 0.17782809 0.17757902 0.17732786 0.17707463 0.17681932 [115] 0.17656195 0.17630251 0.17604102 0.17577748 0.17551191 0.17524430 [121] 0.17497467 0.17470303 0.17442937 0.17415372 0.17387608 0.17359646 [127] 0.17331486 0.17303130 0.17274578 0.17245832 0.17216892 0.17187760 [133] 0.17158436 0.17128922 0.17099218 0.17069325 0.17039245 0.17008978 [139] 0.16978526 0.16947890 0.16917071 0.16886070 0.16854888 0.16823526 [145] 0.16791986 0.16760269 0.16728375 0.16696307 0.16664065 0.16631650 [151] 0.16599064 0.16566309 0.16533384 0.16500293 0.16467035 0.16433613 [157] 0.16400027 0.16366279 0.16332371 0.16298303 0.16264077 0.16229694 [163] 0.16195156 0.16160465 0.16125620 0.16090625 0.16055480 0.16020187 [169] 0.15984747 0.15949162 0.15913433 0.15877562 0.15841549 0.15805397 [175] 0.15769107 0.15732681 0.15696119 0.15659424 0.15622597 0.15585639 [181] 0.15548552 0.15511338 0.15473997 0.15436532 0.15398944 0.15361235 [187] 0.15323405 0.15285457 0.15247392 0.15209212 0.15170918 0.15132512 [193] 0.15093995 0.15055368 0.15016634 0.14977794 0.14938849 0.14899802 [199] 0.14860652 0.14821403 0.14782055 0.14742610 0.14703070 0.14663436 [205] 0.14623710 0.14583893 0.14543987 0.14503993 0.14463913 0.14423748 [211] 0.14383500 0.14343170 0.14302761 0.14262272 0.14221707 0.14181066 [217] 0.14140351 0.14099563 0.14058704 0.14017776 0.13976780 0.13935716 [223] 0.13894588 0.13853396 0.13812141 0.13770826 0.13729452 0.13688019 [229] 0.13646530 0.13604986 0.13563389 0.13521739 0.13480038 0.13438288 [235] 0.13396490 0.13354646 0.13312756 0.13270822 0.13228846 0.13186829 [241] 0.13144772 0.13102676 0.13060544 0.13018376 0.12976173 0.12933938 [247] 0.12891670 0.12849372 0.12807045 0.12764690 0.12722309 0.12679901 [253] 0.12637470 0.12595016 0.12552541 0.12510045 0.12467529 0.12424996 [259] 0.12382446 0.12339881 0.12297301 0.12254708 0.12212103 0.12169487 [265] 0.12126861 0.12084227 0.12041585 0.11998937 0.11956283 0.11913626 [271] 0.11870965 0.11828303 0.11785639 0.11742976 0.11700314 0.11657655 [277] 0.11614998 0.11572346 0.11529700 0.11487059 0.11444426 0.11401802 [283] 0.11359186 0.11316581 0.11273987 0.11231406 0.11188837 0.11146283 [289] 0.11103744 0.11061220 0.11018713 0.10976224 0.10933754 0.10891303 [295] 0.10848872 0.10806462 0.10764074 0.10721710 0.10679368 0.10637052 [301] 0.10594760 0.10552495 0.10510256 0.10468045 0.10425863 0.10383709 [307] 0.10341586 0.10299493 0.10257432 0.10215402 0.10173406 0.10131443 [313] 0.10089514 0.10047620 0.10005762 0.09963940 0.09922155 0.09880407 [319] 0.09838698 0.09797028 0.09755397 0.09713806 0.09672256 0.09630747 [325] 0.09589281 0.09547856 0.09506475 0.09465138 0.09423844 0.09382596 [331] 0.09341392 0.09300235 0.09259124 0.09218060 0.09177043 0.09136074 [337] 0.09095154 0.09054283 0.09013461 0.08972689 0.08931967 0.08891296 [343] 0.08850676 0.08810108 0.08769593 0.08729129 0.08688719 0.08648363 [349] 0.08608060 0.08567811 0.08527617 0.08487478 0.08447395 0.08407367 [355] 0.08367396 0.08327481 0.08287623 0.08247823 0.08208080 0.08168395 [361] 0.08128768 0.08089200 0.08049691 0.08010241 0.07970850 0.07931520 [367] 0.07892250 0.07853040 0.07813891 0.07774803 0.07735776 0.07696811 [373] 0.07657908 0.07619067 0.07580288 0.07541572 0.07502919 0.07464329 [379] 0.07425802 0.07387339 0.07348940 0.07310604 0.07272333 0.07234127 [385] 0.07195985 0.07157907 0.07119895 0.07081948 0.07044067 0.07006251 [391] 0.06968501 0.06930816 0.06893198 0.06855646 0.06818161 0.06780742 [397] 0.06743390 0.06706105 0.06668887 0.06631735 0.06594652 > mx [1] 0.1923161 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1lycw1321808119.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/23t721321808119.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/3zxjg1321808119.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/4unxi1321808119.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/5zo761321808119.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/6fk6w1321808119.tab") > > try(system("convert tmp/1lycw1321808119.ps tmp/1lycw1321808119.png",intern=TRUE)) character(0) > try(system("convert tmp/23t721321808119.ps tmp/23t721321808119.png",intern=TRUE)) character(0) > try(system("convert tmp/3zxjg1321808119.ps tmp/3zxjg1321808119.png",intern=TRUE)) character(0) > try(system("convert tmp/4unxi1321808119.ps tmp/4unxi1321808119.png",intern=TRUE)) character(0) > try(system("convert tmp/5zo761321808119.ps tmp/5zo761321808119.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.482 0.273 1.773