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,87.14054095,112.0054296,112.312101,109.474134,104.9746116,100.4926851,104.2154743,120.1768388,112.1028355,108.1481575,116.802197,102.1699512,95.15358705,120.6707808,111.5234277,119.9669448,113.3697401,110.0717661,111.5567342,132.424212,107.900558,122.1626615,124.3992258,110.4450505,101.5874013,122.3203962,125.2582826,125.4411543,108.9902468,118.9243879,116.7242723,134.1724901,116.8530994,124.5732995,130.9914031,123.4239103,111.4536725,124.5135991,139.2589613,129.8596099,112.3460359,131.381655,133.0004776,134.3220552,144.2379719,134.1278719,150.1891559,140.722563,114.8389975,143.1973003,140.2738676,112.1248303,102.8951536,100.5090242,103.3513901,111.4134533,104.5887587,101.7840983,114.7007441,108.7426474) > #'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.3114926 0.3114812 0.3114697 0.3114582 0.3114468 0.3114353 0.3114239 [8] 0.3114124 0.3114010 0.3113896 0.3113781 0.3113667 0.3113553 0.3113439 [15] 0.3113324 0.3113210 0.3113096 0.3112982 0.3112868 0.3112754 0.3112640 [22] 0.3112527 0.3112413 0.3112299 0.3112185 0.3112072 0.3111958 0.3111845 [29] 0.3111731 0.3111618 0.3111504 0.3111391 0.3111278 0.3111165 0.3111051 [36] 0.3110938 0.3110825 0.3110712 0.3110600 0.3110487 0.3110374 0.3110261 [43] 0.3110149 0.3110036 0.3109924 0.3109811 0.3109699 0.3109587 0.3109475 [50] 0.3109363 0.3109251 0.3109139 0.3109027 0.3108915 0.3108803 0.3108692 [57] 0.3108580 0.3108469 0.3108357 0.3108246 0.3108135 0.3108024 0.3107913 [64] 0.3107802 0.3107691 0.3107580 0.3107469 0.3107359 0.3107248 0.3107138 [71] 0.3107027 0.3106917 0.3106807 0.3106697 0.3106587 0.3106477 0.3106367 [78] 0.3106257 0.3106148 0.3106038 0.3105929 0.3105820 0.3105710 0.3105601 [85] 0.3105492 0.3105383 0.3105275 0.3105166 0.3105057 0.3104949 0.3104840 [92] 0.3104732 0.3104624 0.3104516 0.3104408 0.3104300 0.3104192 0.3104084 [99] 0.3103977 0.3103869 0.3103762 0.3103655 0.3103547 0.3103440 0.3103333 [106] 0.3103227 0.3103120 0.3103013 0.3102907 0.3102800 0.3102694 0.3102588 [113] 0.3102482 0.3102376 0.3102270 0.3102164 0.3102059 0.3101953 0.3101848 [120] 0.3101743 0.3101638 0.3101533 0.3101428 0.3101323 0.3101218 0.3101114 [127] 0.3101009 0.3100905 0.3100801 0.3100697 0.3100593 0.3100489 0.3100385 [134] 0.3100282 0.3100178 0.3100075 0.3099972 0.3099868 0.3099765 0.3099663 [141] 0.3099560 0.3099457 0.3099355 0.3099252 0.3099150 0.3099048 0.3098946 [148] 0.3098844 0.3098742 0.3098640 0.3098539 0.3098438 0.3098336 0.3098235 [155] 0.3098134 0.3098033 0.3097932 0.3097832 0.3097731 0.3097631 0.3097530 [162] 0.3097430 0.3097330 0.3097230 0.3097130 0.3097031 0.3096931 0.3096832 [169] 0.3096733 0.3096633 0.3096534 0.3096435 0.3096337 0.3096238 0.3096139 [176] 0.3096041 0.3095943 0.3095844 0.3095746 0.3095649 0.3095551 0.3095453 [183] 0.3095356 0.3095258 0.3095161 0.3095064 0.3094967 0.3094870 0.3094773 [190] 0.3094676 0.3094580 0.3094483 0.3094387 0.3094291 0.3094195 0.3094099 [197] 0.3094003 0.3093907 0.3093812 0.3093716 0.3093621 0.3093526 0.3093431 [204] 0.3093336 0.3093241 0.3093146 0.3093052 0.3092957 0.3092863 0.3092768 [211] 0.3092674 0.3092580 0.3092487 0.3092393 0.3092299 0.3092206 0.3092112 [218] 0.3092019 0.3091926 0.3091833 0.3091740 0.3091647 0.3091555 0.3091462 [225] 0.3091370 0.3091277 0.3091185 0.3091093 0.3091001 0.3090909 0.3090817 [232] 0.3090726 0.3090634 0.3090543 0.3090452 0.3090360 0.3090269 0.3090178 [239] 0.3090088 0.3089997 0.3089906 0.3089816 0.3089726 0.3089635 0.3089545 [246] 0.3089455 0.3089365 0.3089275 0.3089186 0.3089096 0.3089006 0.3088917 [253] 0.3088828 0.3088739 0.3088650 0.3088561 0.3088472 0.3088383 0.3088294 [260] 0.3088206 0.3088117 0.3088029 0.3087941 0.3087853 0.3087765 0.3087677 [267] 0.3087589 0.3087501 0.3087413 0.3087326 0.3087238 0.3087151 0.3087064 [274] 0.3086977 0.3086890 0.3086803 0.3086716 0.3086629 0.3086542 0.3086456 [281] 0.3086369 0.3086283 0.3086197 0.3086110 0.3086024 0.3085938 0.3085852 [288] 0.3085767 0.3085681 0.3085595 0.3085510 0.3085424 0.3085339 0.3085253 [295] 0.3085168 0.3085083 0.3084998 0.3084913 0.3084828 0.3084743 0.3084658 [302] 0.3084574 0.3084489 0.3084404 0.3084320 0.3084236 0.3084151 0.3084067 [309] 0.3083983 0.3083899 0.3083815 0.3083731 0.3083647 0.3083563 0.3083480 [316] 0.3083396 0.3083312 0.3083229 0.3083145 0.3083062 0.3082979 0.3082895 [323] 0.3082812 0.3082729 0.3082646 0.3082563 0.3082480 0.3082397 0.3082315 [330] 0.3082232 0.3082149 0.3082066 0.3081984 0.3081901 0.3081819 0.3081736 [337] 0.3081654 0.3081572 0.3081490 0.3081407 0.3081325 0.3081243 0.3081161 [344] 0.3081079 0.3080997 0.3080915 0.3080833 0.3080751 0.3080670 0.3080588 [351] 0.3080506 0.3080424 0.3080343 0.3080261 0.3080180 0.3080098 0.3080017 [358] 0.3079935 0.3079854 0.3079772 0.3079691 0.3079610 0.3079529 0.3079447 [365] 0.3079366 0.3079285 0.3079204 0.3079123 0.3079041 0.3078960 0.3078879 [372] 0.3078798 0.3078717 0.3078636 0.3078555 0.3078474 0.3078393 0.3078312 [379] 0.3078231 0.3078151 0.3078070 0.3077989 0.3077908 0.3077827 0.3077746 [386] 0.3077665 0.3077585 0.3077504 0.3077423 0.3077342 0.3077261 0.3077181 [393] 0.3077100 0.3077019 0.3076938 0.3076857 0.3076777 0.3076696 0.3076615 [400] 0.3076534 0.3076453 > mx [1] 0.3114926 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1a1tq1257957399.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/25fj41257957399.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/38l611257957399.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/4jlmf1257957399.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/5p5wd1257957399.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/6rrlx1257957399.tab") > system("convert tmp/1a1tq1257957399.ps tmp/1a1tq1257957399.png") > system("convert tmp/25fj41257957399.ps tmp/25fj41257957399.png") > system("convert tmp/38l611257957399.ps tmp/38l611257957399.png") > system("convert tmp/4jlmf1257957399.ps tmp/4jlmf1257957399.png") > system("convert tmp/5p5wd1257957399.ps tmp/5p5wd1257957399.png") > > > proc.time() user system elapsed 1.082 0.787 1.317