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(118.9,108.8,115.6,95.0,92.8,108.9,109.8,106.1,102.8,98.4,85.7,114.6,129.4,117.7,126.6,103.8,101.5,118.7,119.6,114.8,109.9,106.3,95.0,124.5,140.4,128.8,137.5,113.3,110.3,129.1,128.4,120.3,113.6,96.9,124.7,126.4,131.9,122.5,113.1,99.8,116.0,115.0,114.0,111.0,91.7,90.6,103.3,106.7,111.2,102.9,126.5,115.1,110.2,110.1,103.3,107.7,103.9,114.0,117.2,117.0,116.5) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = '' > par2 = '' > par1 = '' > ylab = '' > xlab = '' > main = '' > #'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.09505137 0.09495340 0.09485535 0.09475721 0.09465900 0.09456070 [7] 0.09446232 0.09436386 0.09426532 0.09416669 0.09406799 0.09396920 [13] 0.09387034 0.09377139 0.09367236 0.09357326 0.09347407 0.09337481 [19] 0.09327546 0.09317604 0.09307653 0.09297695 0.09287729 0.09277755 [25] 0.09267774 0.09257784 0.09247787 0.09237782 0.09227770 0.09217749 [31] 0.09207721 0.09197685 0.09187642 0.09177591 0.09167532 0.09157466 [37] 0.09147393 0.09137311 0.09127223 0.09117126 0.09107023 0.09096911 [43] 0.09086793 0.09076667 0.09066533 0.09056393 0.09046245 0.09036089 [49] 0.09025926 0.09015756 0.09005579 0.08995395 0.08985203 0.08975004 [55] 0.08964798 0.08954585 0.08944365 0.08934137 0.08923903 0.08913661 [61] 0.08903413 0.08893157 0.08882895 0.08872625 0.08862349 0.08852065 [67] 0.08841775 0.08831478 0.08821174 0.08810863 0.08800545 0.08790221 [73] 0.08779890 0.08769552 0.08759207 0.08748856 0.08738498 0.08728133 [79] 0.08717762 0.08707384 0.08697000 0.08686609 0.08676211 0.08665807 [85] 0.08655397 0.08644980 0.08634556 0.08624127 0.08613690 0.08603248 [91] 0.08592799 0.08582344 0.08571882 0.08561414 0.08550940 0.08540460 [97] 0.08529973 0.08519481 0.08508982 0.08498477 0.08487966 0.08477449 [103] 0.08466925 0.08456396 0.08445861 0.08435320 0.08424772 0.08414219 [109] 0.08403660 0.08393095 0.08382524 0.08371948 0.08361365 0.08350777 [115] 0.08340183 0.08329583 0.08318978 0.08308366 0.08297749 0.08287127 [121] 0.08276499 0.08265865 0.08255226 0.08244581 0.08233930 0.08223274 [127] 0.08212613 0.08201946 0.08191274 0.08180596 0.08169913 0.08159225 [133] 0.08148531 0.08137832 0.08127127 0.08116418 0.08105703 0.08094983 [139] 0.08084258 0.08073528 0.08062792 0.08052051 0.08041306 0.08030555 [145] 0.08019799 0.08009039 0.07998273 0.07987502 0.07976726 0.07965946 [151] 0.07955161 0.07944370 0.07933575 0.07922775 0.07911971 0.07901161 [157] 0.07890347 0.07879528 0.07868705 0.07857876 0.07847044 0.07836206 [163] 0.07825364 0.07814518 0.07803667 0.07792811 0.07781951 0.07771087 [169] 0.07760218 0.07749345 0.07738467 0.07727585 0.07716699 0.07705808 [175] 0.07694913 0.07684014 0.07673111 0.07662203 0.07651292 0.07640376 [181] 0.07629456 0.07618532 0.07607604 0.07596672 0.07585736 0.07574795 [187] 0.07563851 0.07552903 0.07541952 0.07530996 0.07520036 0.07509073 [193] 0.07498105 0.07487134 0.07476160 0.07465181 0.07454199 0.07443213 [199] 0.07432224 0.07421231 0.07410234 0.07399234 0.07388230 0.07377223 [205] 0.07366212 0.07355197 0.07344180 0.07333159 0.07322134 0.07311106 [211] 0.07300075 0.07289041 0.07278003 0.07266962 0.07255918 0.07244870 [217] 0.07233820 0.07222766 0.07211709 0.07200649 0.07189586 0.07178520 [223] 0.07167451 0.07156379 0.07145304 0.07134226 0.07123145 0.07112061 [229] 0.07100975 0.07089886 0.07078793 0.07067698 0.07056601 0.07045500 [235] 0.07034397 0.07023291 0.07012183 0.07001072 0.06989958 0.06978842 [241] 0.06967723 0.06956602 0.06945478 0.06934352 0.06923223 0.06912092 [247] 0.06900959 0.06889823 0.06878685 0.06867544 0.06856402 0.06845257 [253] 0.06834110 0.06822960 0.06811809 0.06800655 0.06789499 0.06778341 [259] 0.06767182 0.06756020 0.06744856 0.06733690 0.06722522 0.06711352 [265] 0.06700181 0.06689007 0.06677832 0.06666654 0.06655475 0.06644295 [271] 0.06633112 0.06621928 0.06610742 0.06599554 0.06588365 0.06577174 [277] 0.06565982 0.06554788 0.06543592 0.06532395 0.06521197 0.06509997 [283] 0.06498796 0.06487593 0.06476389 0.06465184 0.06453977 0.06442769 [289] 0.06431559 0.06420349 0.06409137 0.06397924 0.06386710 0.06375495 [295] 0.06364279 0.06353061 0.06341843 0.06330623 0.06319403 0.06308181 [301] 0.06296959 0.06285736 0.06274511 0.06263286 0.06252061 0.06240834 [307] 0.06229606 0.06218378 0.06207149 0.06195919 0.06184689 0.06173458 [313] 0.06162226 0.06150994 0.06139761 0.06128528 0.06117294 0.06106059 [319] 0.06094824 0.06083589 0.06072353 0.06061117 0.06049881 0.06038644 [325] 0.06027407 0.06016169 0.06004931 0.05993694 0.05982455 0.05971217 [331] 0.05959978 0.05948740 0.05937501 0.05926262 0.05915023 0.05903784 [337] 0.05892546 0.05881307 0.05870068 0.05858829 0.05847590 0.05836352 [343] 0.05825114 0.05813875 0.05802637 0.05791400 0.05780162 0.05768925 [349] 0.05757688 0.05746451 0.05735215 0.05723979 0.05712744 0.05701509 [355] 0.05690275 0.05679041 0.05667807 0.05656574 0.05645342 0.05634110 [361] 0.05622879 0.05611648 0.05600418 0.05589189 0.05577961 0.05566733 [367] 0.05555506 0.05544280 0.05533054 0.05521830 0.05510606 0.05499384 [373] 0.05488162 0.05476941 0.05465721 0.05454502 0.05443284 0.05432068 [379] 0.05420852 0.05409637 0.05398424 0.05387211 0.05376000 0.05364790 [385] 0.05353581 0.05342374 0.05331168 0.05319963 0.05308759 0.05297557 [391] 0.05286356 0.05275157 0.05263959 0.05252762 0.05241567 0.05230373 [397] 0.05219181 0.05207991 0.05196802 0.05185614 0.05174428 > mx [1] 0.09505137 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/12xrh1226356375.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/2yeg71226356375.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/3cyut1226356375.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/4it8x1226356375.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/5xmjv1226356375.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/6ric91226356375.tab") > > system("convert tmp/12xrh1226356375.ps tmp/12xrh1226356375.png") > system("convert tmp/2yeg71226356375.ps tmp/2yeg71226356375.png") > system("convert tmp/3cyut1226356375.ps tmp/3cyut1226356375.png") > system("convert tmp/4it8x1226356375.ps tmp/4it8x1226356375.png") > system("convert tmp/5xmjv1226356375.ps tmp/5xmjv1226356375.png") > > > proc.time() user system elapsed 1.310 0.804 1.993