R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(100.00,102.83,109.50,115.91,107.94,110.86,118.89,123.38,113.33,116.38,122.04,125.47,115.62,117.91,122.40,125.05,114.18,114.74,120.63,123.68,112.84,115.64,122.32,124.59,116.33,117.45,125.64,128.38,119.87,121.22,128.98,131.35,121.35,123.72,131.06,134.55,125.93,128.90,136.19,140.34,130.48,134.68,141.05,145.44,136.21,139.85,147.13,151.44,143.62,148.55,153.54,159.79,152.55,155.84,160.38,164.22,156.40,160.05,165.60,171.15,161.90,167.21,171.34,176.83,166.27,172.30,176.71,182.99,172.07,178.17,182.20,188.49,176.88,182.13,185.32,192.86,180.27,184.92,187.82,194.94,184.36,188.80,193.42,199.76,188.78,191.49,194.87,198.28,183.24,204.87) > #'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.9408738 0.9409437 0.9410130 0.9410819 0.9411504 0.9412183 0.9412858 [8] 0.9413528 0.9414193 0.9414853 0.9415509 0.9416160 0.9416807 0.9417448 [15] 0.9418085 0.9418717 0.9419345 0.9419967 0.9420585 0.9421199 0.9421807 [22] 0.9422411 0.9423011 0.9423605 0.9424195 0.9424780 0.9425361 0.9425936 [29] 0.9426507 0.9427074 0.9427636 0.9428193 0.9428745 0.9429293 0.9429836 [36] 0.9430374 0.9430908 0.9431437 0.9431962 0.9432481 0.9432996 0.9433507 [43] 0.9434013 0.9434514 0.9435011 0.9435503 0.9435990 0.9436473 0.9436951 [50] 0.9437424 0.9437893 0.9438357 0.9438817 0.9439272 0.9439722 0.9440168 [57] 0.9440609 0.9441046 0.9441478 0.9441905 0.9442328 0.9442746 0.9443160 [64] 0.9443569 0.9443974 0.9444373 0.9444769 0.9445160 0.9445546 0.9445928 [71] 0.9446305 0.9446678 0.9447046 0.9447409 0.9447768 0.9448123 0.9448473 [78] 0.9448818 0.9449159 0.9449495 0.9449827 0.9450155 0.9450477 0.9450796 [85] 0.9451110 0.9451419 0.9451724 0.9452024 0.9452320 0.9452612 0.9452899 [92] 0.9453181 0.9453459 0.9453732 0.9454002 0.9454266 0.9454526 0.9454782 [99] 0.9455033 0.9455280 0.9455522 0.9455760 0.9455994 0.9456223 0.9456448 [106] 0.9456668 0.9456884 0.9457095 0.9457302 0.9457505 0.9457703 0.9457897 [113] 0.9458086 0.9458271 0.9458452 0.9458628 0.9458800 0.9458967 0.9459130 [120] 0.9459289 0.9459444 0.9459594 0.9459739 0.9459881 0.9460018 0.9460150 [127] 0.9460279 0.9460403 0.9460523 0.9460638 0.9460749 0.9460856 0.9460958 [134] 0.9461056 0.9461150 0.9461240 0.9461325 0.9461406 0.9461483 0.9461555 [141] 0.9461623 0.9461687 0.9461747 0.9461802 0.9461853 0.9461900 0.9461943 [148] 0.9461981 0.9462015 0.9462045 0.9462071 0.9462092 0.9462109 0.9462122 [155] 0.9462131 0.9462136 0.9462136 0.9462132 0.9462125 0.9462112 0.9462096 [162] 0.9462075 0.9462051 0.9462022 0.9461989 0.9461952 0.9461910 0.9461865 [169] 0.9461815 0.9461761 0.9461703 0.9461641 0.9461575 0.9461505 0.9461431 [176] 0.9461352 0.9461269 0.9461183 0.9461092 0.9460997 0.9460898 0.9460795 [183] 0.9460688 0.9460576 0.9460461 0.9460342 0.9460218 0.9460091 0.9459959 [190] 0.9459824 0.9459684 0.9459541 0.9459393 0.9459241 0.9459086 0.9458926 [197] 0.9458762 0.9458594 0.9458423 0.9458247 0.9458067 0.9457883 0.9457696 [204] 0.9457504 0.9457308 0.9457109 0.9456905 0.9456698 0.9456486 0.9456271 [211] 0.9456052 0.9455828 0.9455601 0.9455370 0.9455135 0.9454896 0.9454653 [218] 0.9454406 0.9454156 0.9453901 0.9453643 0.9453380 0.9453114 0.9452844 [225] 0.9452570 0.9452292 0.9452011 0.9451725 0.9451436 0.9451143 0.9450846 [232] 0.9450545 0.9450240 0.9449932 0.9449619 0.9449303 0.9448983 0.9448660 [239] 0.9448332 0.9448001 0.9447666 0.9447327 0.9446984 0.9446638 0.9446288 [246] 0.9445934 0.9445576 0.9445215 0.9444849 0.9444480 0.9444108 0.9443731 [253] 0.9443351 0.9442968 0.9442580 0.9442189 0.9441794 0.9441395 0.9440993 [260] 0.9440587 0.9440178 0.9439764 0.9439347 0.9438927 0.9438502 0.9438074 [267] 0.9437643 0.9437208 0.9436769 0.9436326 0.9435880 0.9435430 0.9434977 [274] 0.9434520 0.9434060 0.9433596 0.9433128 0.9432657 0.9432182 0.9431703 [281] 0.9431221 0.9430736 0.9430247 0.9429754 0.9429258 0.9428758 0.9428255 [288] 0.9427748 0.9427237 0.9426723 0.9426206 0.9425685 0.9425161 0.9424633 [295] 0.9424102 0.9423567 0.9423028 0.9422487 0.9421941 0.9421393 0.9420840 [302] 0.9420285 0.9419726 0.9419163 0.9418597 0.9418028 0.9417455 0.9416879 [309] 0.9416299 0.9415716 0.9415130 0.9414540 0.9413947 0.9413350 0.9412750 [316] 0.9412147 0.9411540 0.9410930 0.9410316 0.9409699 0.9409079 0.9408456 [323] 0.9407829 0.9407199 0.9406565 0.9405929 0.9405289 0.9404645 0.9403999 [330] 0.9403349 0.9402695 0.9402039 0.9401379 0.9400716 0.9400050 0.9399380 [337] 0.9398707 0.9398031 0.9397352 0.9396669 0.9395983 0.9395294 0.9394602 [344] 0.9393906 0.9393208 0.9392506 0.9391801 0.9391092 0.9390381 0.9389666 [351] 0.9388948 0.9388228 0.9387503 0.9386776 0.9386046 0.9385312 0.9384575 [358] 0.9383835 0.9383092 0.9382346 0.9381597 0.9380845 0.9380089 0.9379331 [365] 0.9378569 0.9377804 0.9377037 0.9376266 0.9375492 0.9374715 0.9373935 [372] 0.9373152 0.9372365 0.9371576 0.9370784 0.9369989 0.9369190 0.9368389 [379] 0.9367585 0.9366777 0.9365967 0.9365154 0.9364337 0.9363518 0.9362696 [386] 0.9361870 0.9361042 0.9360211 0.9359377 0.9358540 0.9357700 0.9356857 [393] 0.9356011 0.9355162 0.9354310 0.9353456 0.9352598 0.9351737 0.9350874 [400] 0.9350008 0.9349139 > mx [1] 0.9462136 > mxli [1] -0.44 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1v77p1257977113.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/271ir1257977113.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/34uz21257977113.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/4zf0a1257977113.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/5hk3y1257977113.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/6uy531257977113.tab") > > system("convert tmp/1v77p1257977113.ps tmp/1v77p1257977113.png") > system("convert tmp/271ir1257977113.ps tmp/271ir1257977113.png") > system("convert tmp/34uz21257977113.ps tmp/34uz21257977113.png") > system("convert tmp/4zf0a1257977113.ps tmp/4zf0a1257977113.png") > system("convert tmp/5hk3y1257977113.ps tmp/5hk3y1257977113.png") > > > proc.time() user system elapsed 1.123 0.815 2.050