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(21,16,19,18,16,23,17,12,19,16,19,20,13,20,27,17,8,25,26,13,19,15,5,16,14,24,24,9,19,19,25,19,18,15,12,21,12,15,28,25,19,20,24,26,25,12,12,15,17,14,16,11,20,11,22,20,19,17,21,23,18,17,27,25,19,22,24,20,19,11,22,22,16,20,24,16,16,22,24,16,27,11,21,20,20,27,20,12,8,21,18,24,16,18,20,20,19,17,16,26,15,22,17,23,21,19,14,17,12,24,18,20,16,20,22,12,16,17,22,12,14,23,15,17,28,20,23,13,18,23,19,23,12,16,23,13,22,18,23,20,10,17,18,15,23,17,17,22,20,20,19,18,22,20,22,18,16,16,16,16,17,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.1076968954 0.1075836485 0.1074683355 0.1073509506 0.1072314882 [6] 0.1071099432 0.1069863107 0.1068605860 0.1067327646 0.1066028424 [11] 0.1064708155 0.1063366802 0.1062004333 0.1060620716 0.1059215924 [16] 0.1057789930 0.1056342714 0.1054874255 0.1053384536 0.1051873543 [21] 0.1050341266 0.1048787696 0.1047212827 0.1045616657 0.1043999186 [26] 0.1042360418 0.1040700359 0.1039019018 0.1037316407 0.1035592540 [31] 0.1033847436 0.1032081115 0.1030293600 0.1028484919 0.1026655101 [36] 0.1024804178 0.1022932185 0.1021039161 0.1019125146 0.1017190185 [41] 0.1015234323 0.1013257611 0.1011260102 0.1009241849 0.1007202913 [46] 0.1005143352 0.1003063232 0.1000962618 0.0998841579 0.0996700188 [51] 0.0994538519 0.0992356650 0.0990154659 0.0987932631 0.0985690649 [56] 0.0983428802 0.0981147181 0.0978845877 0.0976524987 0.0974184607 [61] 0.0971824839 0.0969445785 0.0967047551 0.0964630242 0.0962193970 [66] 0.0959738846 0.0957264984 0.0954772501 0.0952261515 0.0949732147 [71] 0.0947184520 0.0944618759 0.0942034990 0.0939433343 0.0936813948 [76] 0.0934176938 0.0931522447 0.0928850613 0.0926161572 0.0923455464 [81] 0.0920732432 0.0917992619 0.0915236168 0.0912463227 0.0909673943 [86] 0.0906868466 0.0904046946 0.0901209535 0.0898356387 0.0895487657 [91] 0.0892603500 0.0889704073 0.0886789535 0.0883860045 0.0880915763 [96] 0.0877956852 0.0874983473 0.0871995789 0.0868993965 0.0865978167 [101] 0.0862948558 0.0859905308 0.0856848581 0.0853778548 0.0850695375 [106] 0.0847599232 0.0844490289 0.0841368715 0.0838234682 0.0835088359 [111] 0.0831929920 0.0828759534 0.0825577373 0.0822383611 0.0819178419 [116] 0.0815961969 0.0812734434 0.0809495986 0.0806246798 0.0802987043 [121] 0.0799716893 0.0796436520 0.0793146097 0.0789845796 0.0786535789 [126] 0.0783216247 0.0779887342 0.0776549245 0.0773202126 0.0769846157 [131] 0.0766481508 0.0763108347 0.0759726843 0.0756337167 0.0752939485 [136] 0.0749533965 0.0746120774 0.0742700079 0.0739272045 0.0735836837 [141] 0.0732394619 0.0728945556 0.0725489810 0.0722027543 0.0718558916 [146] 0.0715084091 0.0711603226 0.0708116481 0.0704624014 0.0701125981 [151] 0.0697622539 0.0694113843 0.0690600047 0.0687081305 0.0683557768 [156] 0.0680029589 0.0676496917 0.0672959901 0.0669418690 0.0665873432 [161] 0.0662324271 0.0658771353 0.0655214821 0.0651654819 0.0648091488 [166] 0.0644524969 0.0640955400 0.0637382921 0.0633807667 0.0630229775 [171] 0.0626649379 0.0623066613 0.0619481610 0.0615894499 0.0612305411 [176] 0.0608714475 0.0605121817 0.0601527565 0.0597931842 0.0594334774 [181] 0.0590736481 0.0587137086 0.0583536709 0.0579935468 0.0576333480 [186] 0.0572730862 0.0569127730 0.0565524196 0.0561920373 0.0558316373 [191] 0.0554712306 0.0551108280 0.0547504403 0.0543900781 0.0540297520 [196] 0.0536694723 0.0533092494 0.0529490932 0.0525890139 0.0522290213 [201] 0.0518691253 0.0515093354 0.0511496613 0.0507901122 0.0504306976 [206] 0.0500714265 0.0497123081 0.0493533512 0.0489945647 0.0486359574 [211] 0.0482775376 0.0479193141 0.0475612950 0.0472034886 0.0468459031 [216] 0.0464885465 0.0461314267 0.0457745514 0.0454179283 0.0450615651 [221] 0.0447054691 0.0443496477 0.0439941082 0.0436388577 0.0432839032 [226] 0.0429292516 0.0425749098 0.0422208845 0.0418671823 0.0415138098 [231] 0.0411607732 0.0408080790 0.0404557333 0.0401037423 0.0397521119 [236] 0.0394008482 0.0390499569 0.0386994437 0.0383493143 0.0379995743 [241] 0.0376502290 0.0373012839 0.0369527443 0.0366046152 0.0362569018 [246] 0.0359096091 0.0355627420 0.0352163054 0.0348703040 0.0345247424 [251] 0.0341796253 0.0338349572 0.0334907424 0.0331469853 0.0328036903 [256] 0.0324608613 0.0321185027 0.0317766183 0.0314352122 0.0310942882 [261] 0.0307538501 0.0304139017 0.0300744467 0.0297354885 0.0293970308 [266] 0.0290590770 0.0287216304 0.0283846945 0.0280482723 0.0277123672 [271] 0.0273769822 0.0270421203 0.0267077847 0.0263739781 0.0260407035 [276] 0.0257079637 0.0253757614 0.0250440992 0.0247129799 0.0243824060 [281] 0.0240523799 0.0237229042 0.0233939813 0.0230656134 0.0227378030 [286] 0.0224105521 0.0220838631 0.0217577380 0.0214321789 0.0211071878 [291] 0.0207827668 0.0204589178 0.0201356426 0.0198129432 0.0194908212 [296] 0.0191692784 0.0188483165 0.0185279373 0.0182081422 0.0178889329 [301] 0.0175703109 0.0172522776 0.0169348346 0.0166179832 0.0163017247 [306] 0.0159860605 0.0156709919 0.0153565201 0.0150426463 0.0147293718 [311] 0.0144166975 0.0141046246 0.0137931542 0.0134822873 0.0131720249 [316] 0.0128623679 0.0125533173 0.0122448739 0.0119370386 0.0116298122 [321] 0.0113231956 0.0110171894 0.0107117945 0.0104070115 0.0101028410 [326] 0.0097992838 0.0094963405 0.0091940115 0.0088922976 0.0085911992 [331] 0.0082907168 0.0079908510 0.0076916021 0.0073929706 0.0070949568 [336] 0.0067975613 0.0065007843 0.0062046261 0.0059090871 0.0056141676 [341] 0.0053198677 0.0050261879 0.0047331281 0.0044406888 0.0041488700 [346] 0.0038576719 0.0035670946 0.0032771382 0.0029878029 0.0026990887 [351] 0.0024109957 0.0021235238 0.0018366732 0.0015504438 0.0012648356 [356] 0.0009798486 0.0006954827 0.0004117379 0.0001286140 -0.0001538890 [361] -0.0004357713 -0.0007170329 -0.0009976741 -0.0012776950 -0.0015570957 [366] -0.0018358766 -0.0021140377 -0.0023915793 -0.0026685016 -0.0029448049 [371] -0.0032204895 -0.0034955556 -0.0037700035 -0.0040438335 -0.0043170459 [376] -0.0045896411 -0.0048616194 -0.0051329811 -0.0054037265 -0.0056738562 [381] -0.0059433704 -0.0062122696 -0.0064805541 -0.0067482244 -0.0070152808 [386] -0.0072817239 -0.0075475541 -0.0078127718 -0.0080773775 -0.0083413717 [391] -0.0086047548 -0.0088675274 -0.0091296899 -0.0093912428 -0.0096521868 [396] -0.0099125222 -0.0101722497 -0.0104313698 -0.0106898830 -0.0109477899 [401] -0.0112050911 > mx [1] 0.1076969 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/15vxg1321808013.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/229ia1321808013.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/39f5b1321808013.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/4sb831321808013.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/5or0y1321808013.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/613de1321808013.tab") > > try(system("convert tmp/15vxg1321808013.ps tmp/15vxg1321808013.png",intern=TRUE)) character(0) > try(system("convert tmp/229ia1321808013.ps tmp/229ia1321808013.png",intern=TRUE)) character(0) > try(system("convert tmp/39f5b1321808013.ps tmp/39f5b1321808013.png",intern=TRUE)) character(0) > try(system("convert tmp/4sb831321808013.ps tmp/4sb831321808013.png",intern=TRUE)) character(0) > try(system("convert tmp/5or0y1321808013.ps tmp/5or0y1321808013.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.375 0.257 1.672