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(23,20,20,21,24,22,23,20,25,23,27,27,22,24,25,22,28,28,27,25,16,28,21,24,27,14,14,27,20,21,22,21,12,20,24,19,28,23,27,22,27,26,22,21,19,24,19,26,22,28,21,23,28,10,24,21,21,24,24,25,25,23,21,16,17,25,24,23,25,23,28,26,22,19,26,18,18,25,27,12,15,21,23,22,21,24,27,22,28,26,10,19,22,21,24,25,21,20,21,24,23,18,24,24,19,20,18,20,27,23,26,23,17,21,25,23,27,24,20,27,21,24,21,15,25,25,22,24,21,22,23,22,20,23,25,23,22,25,26,22,24,24,25,20,26,21,26,21,22,16,26,28,18,25,23,21,20,25,22,21,16,18) > #'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.005261549 -0.005434520 -0.005607843 -0.005781515 -0.005955532 [6] -0.006129893 -0.006304594 -0.006479633 -0.006655007 -0.006830714 [11] -0.007006751 -0.007183115 -0.007359803 -0.007536812 -0.007714140 [16] -0.007891784 -0.008069741 -0.008248009 -0.008426584 -0.008605463 [21] -0.008784644 -0.008964123 -0.009143899 -0.009323967 -0.009504325 [26] -0.009684970 -0.009865899 -0.010047110 -0.010228598 -0.010410361 [31] -0.010592396 -0.010774701 -0.010957271 -0.011140104 -0.011323197 [36] -0.011506546 -0.011690149 -0.011874003 -0.012058104 -0.012242450 [41] -0.012427037 -0.012611861 -0.012796921 -0.012982212 -0.013167732 [46] -0.013353477 -0.013539444 -0.013725631 -0.013912033 -0.014098648 [51] -0.014285472 -0.014472502 -0.014659735 -0.014847168 -0.015034797 [56] -0.015222619 -0.015410631 -0.015598830 -0.015787212 -0.015975774 [61] -0.016164513 -0.016353425 -0.016542507 -0.016731757 -0.016921170 [66] -0.017110743 -0.017300473 -0.017490357 -0.017680391 -0.017870572 [71] -0.018060897 -0.018251362 -0.018441964 -0.018632700 -0.018823566 [76] -0.019014560 -0.019205677 -0.019396914 -0.019588268 -0.019779736 [81] -0.019971315 -0.020163000 -0.020354789 -0.020546678 -0.020738665 [86] -0.020930745 -0.021122915 -0.021315172 -0.021507513 -0.021699935 [91] -0.021892433 -0.022085005 -0.022277647 -0.022470357 -0.022663130 [96] -0.022855964 -0.023048854 -0.023241799 -0.023434794 -0.023627836 [101] -0.023820922 -0.024014049 -0.024207214 -0.024400412 -0.024593641 [106] -0.024786898 -0.024980179 -0.025173481 -0.025366801 -0.025560135 [111] -0.025753481 -0.025946835 -0.026140194 -0.026333554 -0.026526914 [116] -0.026720268 -0.026913614 -0.027106950 -0.027300271 -0.027493575 [121] -0.027686858 -0.027880118 -0.028073351 -0.028266554 -0.028459724 [126] -0.028652858 -0.028845953 -0.029039005 -0.029232012 -0.029424971 [131] -0.029617878 -0.029810731 -0.030003527 -0.030196261 -0.030388933 [136] -0.030581537 -0.030774073 -0.030966536 -0.031158923 -0.031351232 [141] -0.031543460 -0.031735604 -0.031927660 -0.032119627 -0.032311501 [146] -0.032503279 -0.032694959 -0.032886538 -0.033078012 -0.033269379 [151] -0.033460637 -0.033651782 -0.033842811 -0.034033723 -0.034224514 [156] -0.034415181 -0.034605723 -0.034796135 -0.034986416 -0.035176563 [161] -0.035366573 -0.035556443 -0.035746172 -0.035935756 -0.036125193 [166] -0.036314480 -0.036503614 -0.036692594 -0.036881417 -0.037070079 [171] -0.037258580 -0.037446915 -0.037635084 -0.037823083 -0.038010910 [176] -0.038198562 -0.038386038 -0.038573335 -0.038760450 -0.038947381 [181] -0.039134127 -0.039320683 -0.039507050 -0.039693223 -0.039879201 [186] -0.040064982 -0.040250564 -0.040435944 -0.040621119 -0.040806089 [191] -0.040990851 -0.041175403 -0.041359742 -0.041543867 -0.041727775 [196] -0.041911465 -0.042094934 -0.042278181 -0.042461203 -0.042643999 [201] -0.042826567 -0.043008904 -0.043191010 -0.043372881 -0.043554516 [206] -0.043735913 -0.043917071 -0.044097987 -0.044278660 -0.044459088 [211] -0.044639270 -0.044819202 -0.044998885 -0.045178316 -0.045357493 [216] -0.045536414 -0.045715079 -0.045893486 -0.046071632 -0.046249516 [221] -0.046427138 -0.046604494 -0.046781584 -0.046958406 -0.047134958 [226] -0.047311240 -0.047487250 -0.047662985 -0.047838446 -0.048013629 [231] -0.048188535 -0.048363162 -0.048537507 -0.048711571 -0.048885351 [236] -0.049058847 -0.049232056 -0.049404979 -0.049577613 -0.049749957 [241] -0.049922010 -0.050093772 -0.050265240 -0.050436413 -0.050607291 [246] -0.050777873 -0.050948157 -0.051118141 -0.051287826 -0.051457210 [251] -0.051626292 -0.051795071 -0.051963546 -0.052131716 -0.052299579 [256] -0.052467136 -0.052634386 -0.052801326 -0.052967957 -0.053134277 [261] -0.053300286 -0.053465982 -0.053631366 -0.053796435 -0.053961190 [266] -0.054125629 -0.054289752 -0.054453558 -0.054617047 -0.054780217 [271] -0.054943068 -0.055105598 -0.055267809 -0.055429698 -0.055591266 [276] -0.055752511 -0.055913433 -0.056074031 -0.056234305 -0.056394254 [281] -0.056553878 -0.056713177 -0.056872148 -0.057030793 -0.057189111 [286] -0.057347100 -0.057504761 -0.057662094 -0.057819097 -0.057975771 [291] -0.058132115 -0.058288128 -0.058443810 -0.058599162 -0.058754182 [296] -0.058908870 -0.059063225 -0.059217249 -0.059370939 -0.059524297 [301] -0.059677321 -0.059830012 -0.059982369 -0.060134391 -0.060286080 [306] -0.060437434 -0.060588453 -0.060739138 -0.060889487 -0.061039502 [311] -0.061189181 -0.061338524 -0.061487532 -0.061636205 -0.061784541 [316] -0.061932542 -0.062080207 -0.062227536 -0.062374529 -0.062521186 [321] -0.062667506 -0.062813491 -0.062959139 -0.063104452 -0.063249428 [326] -0.063394068 -0.063538372 -0.063682341 -0.063825973 -0.063969269 [331] -0.064112230 -0.064254855 -0.064397145 -0.064539099 -0.064680717 [336] -0.064822001 -0.064962949 -0.065103562 -0.065243841 -0.065383785 [341] -0.065523395 -0.065662670 -0.065801612 -0.065940219 -0.066078493 [346] -0.066216434 -0.066354041 -0.066491316 -0.066628258 -0.066764867 [351] -0.066901144 -0.067037090 -0.067172703 -0.067307986 -0.067442937 [356] -0.067577558 -0.067711848 -0.067845809 -0.067979439 -0.068112740 [361] -0.068245713 -0.068378356 -0.068510671 -0.068642658 -0.068774318 [366] -0.068905650 -0.069036655 -0.069167334 -0.069297687 -0.069427714 [371] -0.069557416 -0.069686794 -0.069815847 -0.069944576 -0.070072981 [376] -0.070201064 -0.070328823 -0.070456261 -0.070583377 -0.070710172 [381] -0.070836646 -0.070962800 -0.071088634 -0.071214149 -0.071339345 [386] -0.071464223 -0.071588783 -0.071713026 -0.071836952 -0.071960562 [391] -0.072083856 -0.072206836 -0.072329500 -0.072451851 -0.072573888 [396] -0.072695612 -0.072817024 -0.072938124 -0.073058913 -0.073179391 [401] -0.073299559 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1kpcr1321808447.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/2jcyo1321808447.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/3hy2e1321808447.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/4kwqo1321808447.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/59wxf1321808447.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/6f9591321808447.tab") > > try(system("convert tmp/1kpcr1321808447.ps tmp/1kpcr1321808447.png",intern=TRUE)) character(0) > try(system("convert tmp/2jcyo1321808447.ps tmp/2jcyo1321808447.png",intern=TRUE)) character(0) > try(system("convert tmp/3hy2e1321808447.ps tmp/3hy2e1321808447.png",intern=TRUE)) character(0) > try(system("convert tmp/4kwqo1321808447.ps tmp/4kwqo1321808447.png",intern=TRUE)) character(0) > try(system("convert tmp/59wxf1321808447.ps tmp/59wxf1321808447.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.407 0.235 1.650