R version 2.7.2 (2008-08-25) 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(45,24,18,20,22,39,55,35,38,47,1,57,50,33,19,2,7,15,56,53,24,48,2,49,46,32,37,10,8,16,55,46,46,45,6,45,52,44,35,15,44,51,58,23,44,43,6,51,53,47,19,18,38,43,23,43,18,43,6,31,49) > #'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.14195342 0.14196243 0.14196988 0.14197574 0.14197996 0.14198254 [7] 0.14198343 0.14198260 0.14198003 0.14197568 0.14196953 0.14196153 [13] 0.14195167 0.14193991 0.14192622 0.14191056 0.14189290 0.14187321 [19] 0.14185146 0.14182761 0.14180163 0.14177349 0.14174314 0.14171057 [25] 0.14167573 0.14163859 0.14159911 0.14155725 0.14151300 0.14146629 [31] 0.14141712 0.14136542 0.14131118 0.14125434 0.14119489 0.14113277 [37] 0.14106796 0.14100042 0.14093010 0.14085698 0.14078101 0.14070215 [43] 0.14062038 0.14053565 0.14044792 0.14035716 0.14026333 0.14016639 [49] 0.14006630 0.13996303 0.13985653 0.13974677 0.13963372 0.13951733 [55] 0.13939756 0.13927439 0.13914776 0.13901765 0.13888401 0.13874682 [61] 0.13860602 0.13846159 0.13831349 0.13816168 0.13800613 0.13784680 [67] 0.13768365 0.13751665 0.13734577 0.13717097 0.13699222 0.13680947 [73] 0.13662271 0.13643190 0.13623700 0.13603799 0.13583483 0.13562749 [79] 0.13541595 0.13520017 0.13498013 0.13475579 0.13452714 0.13429414 [85] 0.13405678 0.13381502 0.13356884 0.13331823 0.13306316 0.13280361 [91] 0.13253956 0.13227100 0.13199790 0.13172026 0.13143805 0.13115128 [97] 0.13085991 0.13056396 0.13026340 0.12995823 0.12964844 0.12933404 [103] 0.12901502 0.12869138 0.12836312 0.12803025 0.12769277 0.12735069 [109] 0.12700402 0.12665276 0.12629695 0.12593658 0.12557168 0.12520226 [115] 0.12482836 0.12444999 0.12406719 0.12367997 0.12328838 0.12289245 [121] 0.12249222 0.12208772 0.12167899 0.12126609 0.12084907 0.12042796 [127] 0.12000282 0.11957372 0.11914070 0.11870383 0.11826317 0.11781879 [133] 0.11737076 0.11691915 0.11646404 0.11600550 0.11554362 0.11507848 [139] 0.11461016 0.11413875 0.11366434 0.11318704 0.11270692 0.11222410 [145] 0.11173868 0.11125076 0.11076044 0.11026783 0.10977305 0.10927621 [151] 0.10877742 0.10827680 0.10777447 0.10727055 0.10676516 0.10625843 [157] 0.10575048 0.10524144 0.10473143 0.10422059 0.10370905 0.10319694 [163] 0.10268438 0.10217152 0.10165848 0.10114540 0.10063242 0.10011966 [169] 0.09960726 0.09909536 0.09858408 0.09807357 0.09756394 0.09705535 [175] 0.09654790 0.09604174 0.09553700 0.09503380 0.09453226 0.09403251 [181] 0.09353468 0.09303888 0.09254523 0.09205386 0.09156487 0.09107838 [187] 0.09059449 0.09011333 0.08963498 0.08915955 0.08868715 0.08821787 [193] 0.08775181 0.08728905 0.08682968 0.08637380 0.08592147 0.08547279 [199] 0.08502782 0.08458664 0.08414932 0.08371592 0.08328650 0.08286114 [205] 0.08243987 0.08202276 0.08160985 0.08120119 0.08079683 0.08039679 [211] 0.08000112 0.07960985 0.07922301 0.07884063 0.07846272 0.07808931 [217] 0.07772042 0.07735606 0.07699623 0.07664096 0.07629024 0.07594407 [223] 0.07560247 0.07526541 0.07493290 0.07460492 0.07428148 0.07396254 [229] 0.07364811 0.07333815 0.07303266 0.07273160 0.07243496 0.07214271 [235] 0.07185481 0.07157124 0.07129197 0.07101697 0.07074619 0.07047960 [241] 0.07021717 0.06995885 0.06970461 0.06945439 0.06920816 0.06896588 [247] 0.06872749 0.06849296 0.06826223 0.06803525 0.06781198 0.06759237 [253] 0.06737636 0.06716391 0.06695495 0.06674945 0.06654735 0.06634859 [259] 0.06615313 0.06596090 0.06577186 0.06558594 0.06540310 0.06522328 [265] 0.06504643 0.06487249 0.06470141 0.06453313 0.06436759 0.06420475 [271] 0.06404455 0.06388694 0.06373186 0.06357926 0.06342908 0.06328127 [277] 0.06313579 0.06299257 0.06285156 0.06271272 0.06257599 0.06244133 [283] 0.06230867 0.06217798 0.06204920 0.06192228 0.06179718 0.06167384 [289] 0.06155222 0.06143228 0.06131396 0.06119723 0.06108203 0.06096832 [295] 0.06085606 0.06074520 0.06063570 0.06052752 0.06042062 0.06031496 [301] 0.06021049 0.06010718 0.06000499 0.05990387 0.05980380 0.05970473 [307] 0.05960662 0.05950945 0.05941317 0.05931775 0.05922316 0.05912936 [313] 0.05903631 0.05894400 0.05885238 0.05876143 0.05867110 0.05858139 [319] 0.05849224 0.05840364 0.05831556 0.05822796 0.05814083 0.05805413 [325] 0.05796784 0.05788193 0.05779638 0.05771117 0.05762626 0.05754164 [331] 0.05745729 0.05737317 0.05728928 0.05720558 0.05712206 0.05703870 [337] 0.05695547 0.05687236 0.05678935 0.05670642 0.05662355 0.05654072 [343] 0.05645793 0.05637514 0.05629234 0.05620953 0.05612667 0.05604377 [349] 0.05596079 0.05587774 0.05579459 0.05571133 0.05562795 0.05554443 [355] 0.05546077 0.05537695 0.05529296 0.05520878 0.05512441 0.05503984 [361] 0.05495506 0.05487005 0.05478480 0.05469931 0.05461357 0.05452757 [367] 0.05444130 0.05435475 0.05426792 0.05418079 0.05409336 0.05400562 [373] 0.05391757 0.05382920 0.05374049 0.05365146 0.05356208 0.05347236 [379] 0.05338228 0.05329185 0.05320106 0.05310990 0.05301837 0.05292647 [385] 0.05283418 0.05274151 0.05264846 0.05255501 0.05246117 0.05236694 [391] 0.05227230 0.05217726 0.05208181 0.05198596 0.05188969 0.05179301 [397] 0.05169592 0.05159840 0.05150047 0.05140212 0.05130335 > mx [1] 0.1419834 > mxli [1] -1.94 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ub4k1226569627.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/rcomp/tmp/252of1226569627.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/rcomp/tmp/36cmo1226569627.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/rcomp/tmp/4cek81226569627.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/rcomp/tmp/5zo1b1226569627.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/62cq01226569627.tab") > > system("convert tmp/1ub4k1226569627.ps tmp/1ub4k1226569627.png") > system("convert tmp/252of1226569627.ps tmp/252of1226569627.png") > system("convert tmp/36cmo1226569627.ps tmp/36cmo1226569627.png") > system("convert tmp/4cek81226569627.ps tmp/4cek81226569627.png") > system("convert tmp/5zo1b1226569627.ps tmp/5zo1b1226569627.png") > > > proc.time() user system elapsed 1.307 0.799 1.542