R version 2.12.1 (2010-12-16) Copyright (C) 2010 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(1.262,1.743,1.964,3.258,4.966,4.944,5.907,5.561,5.321,3.582,1.757,1.894,1.442,2.238,2.179,3.218,5.139,4.990,4.914,6.084,5.672,3.548,1.793,2.086,1.376,2.202,2.683,3.303,5.202,5.231,4.880,7.998,4.977,3.531,2.025,2.205,1.504,2.090,2.702,2.939,4.500,6.208,6.415,5.657,5.964,3.163,1.997,2.422,1.507,1.992,2.487,3.490,4.647,5.594,5.611,5.788,6.204,3.013,1.931,2.549,1.580,2.111,2.192,3.601,4.665,4.876,5.813,5.589,5.331,3.075,2.002,2.306,1.594,2.467,2.222,3.607,4.685,4.962,5.770,5.480,5.000,3.228,1.993,2.288,1.351,2.218,2.461,3.028,4.784,4.975,4.607,6.249,4.809,3.157,1.910,2.228,1.169,2.154,2.249,2.687,4.359,5.382,4.459,6.398,4.596,3.024,1.887,2.070,1.511,2.059,2.635,2.867,4.403,5.720,4.502,5.749,5.627,2.846,1.762,2.429,1.579,2.146,2.462,3.695,4.831,5.134,6.250,5.760,6.249,2.917,1.741,2.359) > #'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.080078706 0.079882576 0.079685725 0.079488156 0.079289875 0.079090886 [7] 0.078891195 0.078690806 0.078489723 0.078287953 0.078085501 0.077882370 [13] 0.077678567 0.077474097 0.077268965 0.077063176 0.076856736 0.076649650 [19] 0.076441924 0.076233563 0.076024573 0.075814960 0.075604729 0.075393886 [25] 0.075182437 0.074970387 0.074757743 0.074544511 0.074330696 0.074116305 [31] 0.073901343 0.073685818 0.073469734 0.073253099 0.073035918 0.072818198 [37] 0.072599945 0.072381166 0.072161867 0.071942055 0.071721736 0.071500917 [43] 0.071279604 0.071057804 0.070835524 0.070612770 0.070389549 0.070165869 [49] 0.069941735 0.069717156 0.069492136 0.069266685 0.069040808 0.068814513 [55] 0.068587807 0.068360696 0.068133188 0.067905291 0.067677010 0.067448354 [61] 0.067219330 0.066989944 0.066760205 0.066530119 0.066299694 0.066068938 [67] 0.065837857 0.065606458 0.065374751 0.065142741 0.064910436 0.064677844 [73] 0.064444973 0.064211829 0.063978421 0.063744756 0.063510841 0.063276684 [79] 0.063042292 0.062807675 0.062572837 0.062337789 0.062102536 0.061867088 [85] 0.061631450 0.061395632 0.061159641 0.060923484 0.060687169 0.060450704 [91] 0.060214097 0.059977354 0.059740485 0.059503496 0.059266395 0.059029191 [97] 0.058791890 0.058554500 0.058317029 0.058079485 0.057841875 0.057604207 [103] 0.057366489 0.057128728 0.056890932 0.056653109 0.056415266 0.056177411 [109] 0.055939551 0.055701693 0.055463847 0.055226018 0.054988216 0.054750446 [115] 0.054512717 0.054275036 0.054037410 0.053799848 0.053562356 0.053324942 [121] 0.053087613 0.052850377 0.052613241 0.052376211 0.052139297 0.051902504 [127] 0.051665840 0.051429313 0.051192928 0.050956695 0.050720619 0.050484707 [133] 0.050248968 0.050013407 0.049778032 0.049542850 0.049307867 0.049073091 [139] 0.048838529 0.048604187 0.048370072 0.048136190 0.047902549 0.047669156 [145] 0.047436016 0.047203136 0.046970523 0.046738184 0.046506124 0.046274351 [151] 0.046042871 0.045811690 0.045580814 0.045350249 0.045120003 0.044890080 [157] 0.044660487 0.044431231 0.044202316 0.043973750 0.043745538 0.043517686 [163] 0.043290199 0.043063085 0.042836347 0.042609992 0.042384026 0.042158454 [169] 0.041933282 0.041708515 0.041484159 0.041260218 0.041036699 0.040813606 [175] 0.040590946 0.040368722 0.040146940 0.039925605 0.039704723 0.039484297 [181] 0.039264333 0.039044836 0.038825811 0.038607262 0.038389194 0.038171611 [187] 0.037954518 0.037737920 0.037521821 0.037306225 0.037091137 0.036876561 [193] 0.036662502 0.036448962 0.036235947 0.036023461 0.035811506 0.035600089 [199] 0.035389211 0.035178878 0.034969092 0.034759858 0.034551178 0.034343058 [205] 0.034135499 0.033928506 0.033722082 0.033516231 0.033310955 0.033106258 [211] 0.032902142 0.032698612 0.032495670 0.032293319 0.032091562 0.031890402 [217] 0.031689842 0.031489884 0.031290531 0.031091785 0.030893650 0.030696128 [223] 0.030499221 0.030302932 0.030107262 0.029912215 0.029717793 0.029523997 [229] 0.029330829 0.029138293 0.028946389 0.028755120 0.028564488 0.028374494 [235] 0.028185141 0.027996429 0.027808361 0.027620938 0.027434161 0.027248033 [241] 0.027062555 0.026877727 0.026693552 0.026510030 0.026327164 0.026144953 [247] 0.025963399 0.025782504 0.025602267 0.025422691 0.025243775 0.025065522 [253] 0.024887931 0.024711003 0.024534740 0.024359141 0.024184208 0.024009940 [259] 0.023836339 0.023663404 0.023491136 0.023319536 0.023148604 0.022978340 [265] 0.022808744 0.022639816 0.022471557 0.022303966 0.022137043 0.021970789 [271] 0.021805204 0.021640287 0.021476037 0.021312456 0.021149542 0.020987295 [277] 0.020825715 0.020664802 0.020504555 0.020344973 0.020186056 0.020027804 [283] 0.019870216 0.019713290 0.019557027 0.019401426 0.019246486 0.019092206 [289] 0.018938585 0.018785623 0.018633318 0.018481670 0.018330677 0.018180338 [295] 0.018030653 0.017881620 0.017733238 0.017585506 0.017438422 0.017291986 [301] 0.017146196 0.017001051 0.016856549 0.016712689 0.016569469 0.016426889 [307] 0.016284946 0.016143639 0.016002966 0.015862927 0.015723518 0.015584740 [313] 0.015446589 0.015309064 0.015172163 0.015035886 0.014900229 0.014765191 [319] 0.014630770 0.014496965 0.014363773 0.014231192 0.014099221 0.013967857 [325] 0.013837098 0.013706943 0.013577389 0.013448435 0.013320077 0.013192315 [331] 0.013065145 0.012938566 0.012812576 0.012687171 0.012562351 0.012438112 [337] 0.012314452 0.012191370 0.012068862 0.011946927 0.011825562 0.011704764 [343] 0.011584531 0.011464861 0.011345752 0.011227200 0.011109204 0.010991760 [349] 0.010874867 0.010758522 0.010642722 0.010527465 0.010412748 0.010298568 [355] 0.010184923 0.010071811 0.009959228 0.009847172 0.009735641 0.009624631 [361] 0.009514140 0.009404166 0.009294705 0.009185755 0.009077313 0.008969376 [367] 0.008861942 0.008755008 0.008648571 0.008542628 0.008437177 0.008332215 [373] 0.008227738 0.008123744 0.008020231 0.007917195 0.007814633 0.007712544 [379] 0.007610923 0.007509768 0.007409076 0.007308844 0.007209069 0.007109750 [385] 0.007010881 0.006912461 0.006814487 0.006716956 0.006619865 0.006523211 [391] 0.006426990 0.006331201 0.006235840 0.006140905 0.006046392 0.005952298 [397] 0.005858621 0.005765357 0.005672504 0.005580058 0.005488018 > mx [1] 0.0800787 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1mofg1323875424.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/www/rcomp/tmp/2dngg1323875424.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/www/rcomp/tmp/3p9c81323875424.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/www/rcomp/tmp/4ymys1323875424.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/www/rcomp/tmp/53maa1323875424.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6edg11323875424.tab") > > try(system("convert tmp/1mofg1323875424.ps tmp/1mofg1323875424.png",intern=TRUE)) character(0) > try(system("convert tmp/2dngg1323875424.ps tmp/2dngg1323875424.png",intern=TRUE)) character(0) > try(system("convert tmp/3p9c81323875424.ps tmp/3p9c81323875424.png",intern=TRUE)) character(0) > try(system("convert tmp/4ymys1323875424.ps tmp/4ymys1323875424.png",intern=TRUE)) character(0) > try(system("convert tmp/53maa1323875424.ps tmp/53maa1323875424.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.696 0.352 2.132