R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(274452,267700,257841,255124,247377,247823,276919,294271,281758,270434,258848,256674,258882,255060,247698,244779,240901,239933,270247,283893,282348,273570,254756,254354,255843,254490,251995,246339,244019,245953,279806,283111,281097,275964,270694,271901,274412,272433,268361,268586,264768,269974,304744,309365,308347,298427,289231,291975,294912,293488,290555,284736,281818,287854,316263,325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,301631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257) > #'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.3199146 0.3199043 0.3198871 0.3198758 0.3198590 0.3198468 0.3198340 [8] 0.3198182 0.3198074 0.3197919 0.3197774 0.3197641 0.3197484 0.3197348 [15] 0.3197204 0.3197065 0.3196921 0.3196770 0.3196626 0.3196481 0.3196329 [22] 0.3196183 0.3196031 0.3195886 0.3195728 0.3195580 0.3195426 0.3195275 [29] 0.3195120 0.3194964 0.3194809 0.3194652 0.3194495 0.3194337 0.3194179 [36] 0.3194020 0.3193860 0.3193698 0.3193537 0.3193375 0.3193211 0.3193047 [43] 0.3192883 0.3192717 0.3192551 0.3192384 0.3192216 0.3192048 0.3191878 [50] 0.3191709 0.3191538 0.3191366 0.3191194 0.3191021 0.3190847 0.3190672 [57] 0.3190497 0.3190321 0.3190144 0.3189966 0.3189788 0.3189609 0.3189429 [64] 0.3189248 0.3189067 0.3188885 0.3188702 0.3188518 0.3188334 0.3188148 [71] 0.3187962 0.3187776 0.3187588 0.3187400 0.3187211 0.3187021 0.3186831 [78] 0.3186639 0.3186447 0.3186254 0.3186061 0.3185866 0.3185671 0.3185475 [85] 0.3185279 0.3185081 0.3184883 0.3184684 0.3184484 0.3184284 0.3184083 [92] 0.3183881 0.3183678 0.3183474 0.3183270 0.3183065 0.3182859 0.3182653 [99] 0.3182446 0.3182237 0.3182029 0.3181819 0.3181609 0.3181398 0.3181186 [106] 0.3180973 0.3180760 0.3180545 0.3180330 0.3180115 0.3179898 0.3179681 [113] 0.3179463 0.3179244 0.3179025 0.3178805 0.3178584 0.3178362 0.3178139 [120] 0.3177916 0.3177692 0.3177467 0.3177242 0.3177015 0.3176788 0.3176560 [127] 0.3176332 0.3176102 0.3175872 0.3175641 0.3175410 0.3175177 0.3174944 [134] 0.3174710 0.3174475 0.3174240 0.3174004 0.3173767 0.3173529 0.3173291 [141] 0.3173051 0.3172811 0.3172571 0.3172329 0.3172087 0.3171844 0.3171600 [148] 0.3171355 0.3171110 0.3170864 0.3170617 0.3170370 0.3170121 0.3169872 [155] 0.3169622 0.3169372 0.3169120 0.3168868 0.3168615 0.3168362 0.3168107 [162] 0.3167852 0.3167596 0.3167340 0.3167082 0.3166824 0.3166565 0.3166306 [169] 0.3166045 0.3165784 0.3165522 0.3165259 0.3164996 0.3164732 0.3164467 [176] 0.3164201 0.3163935 0.3163667 0.3163399 0.3163131 0.3162861 0.3162591 [183] 0.3162320 0.3162048 0.3161776 0.3161503 0.3161229 0.3160954 0.3160678 [190] 0.3160402 0.3160125 0.3159848 0.3159569 0.3159290 0.3159010 0.3158729 [197] 0.3158448 0.3158165 0.3157882 0.3157599 0.3157314 0.3157029 0.3156743 [204] 0.3156456 0.3156169 0.3155881 0.3155592 0.3155302 0.3155012 0.3154720 [211] 0.3154428 0.3154136 0.3153842 0.3153548 0.3153253 0.3152957 0.3152661 [218] 0.3152364 0.3152066 0.3151767 0.3151468 0.3151168 0.3150867 0.3150565 [225] 0.3150263 0.3149960 0.3149656 0.3149352 0.3149046 0.3148740 0.3148433 [232] 0.3148126 0.3147818 0.3147508 0.3147199 0.3146888 0.3146577 0.3146265 [239] 0.3145952 0.3145639 0.3145325 0.3145010 0.3144694 0.3144378 0.3144061 [246] 0.3143743 0.3143424 0.3143105 0.3142785 0.3142464 0.3142142 0.3141820 [253] 0.3141497 0.3141173 0.3140849 0.3140524 0.3140198 0.3139871 0.3139544 [260] 0.3139215 0.3138887 0.3138557 0.3138227 0.3137896 0.3137564 0.3137231 [267] 0.3136898 0.3136564 0.3136229 0.3135894 0.3135558 0.3135221 0.3134883 [274] 0.3134545 0.3134206 0.3133866 0.3133526 0.3133184 0.3132842 0.3132500 [281] 0.3132156 0.3131812 0.3131467 0.3131122 0.3130775 0.3130428 0.3130081 [288] 0.3129732 0.3129383 0.3129033 0.3128683 0.3128331 0.3127979 0.3127626 [295] 0.3127273 0.3126919 0.3126564 0.3126208 0.3125852 0.3125495 0.3125137 [302] 0.3124778 0.3124419 0.3124059 0.3123699 0.3123337 0.3122975 0.3122612 [309] 0.3122249 0.3121885 0.3121520 0.3121154 0.3120788 0.3120421 0.3120053 [316] 0.3119684 0.3119315 0.3118945 0.3118575 0.3118204 0.3117832 0.3117459 [323] 0.3117085 0.3116711 0.3116336 0.3115961 0.3115585 0.3115208 0.3114830 [330] 0.3114452 0.3114073 0.3113693 0.3113313 0.3112931 0.3112550 0.3112167 [337] 0.3111784 0.3111400 0.3111015 0.3110630 0.3110244 0.3109857 0.3109470 [344] 0.3109082 0.3108693 0.3108303 0.3107913 0.3107522 0.3107131 0.3106738 [351] 0.3106345 0.3105952 0.3105557 0.3105162 0.3104767 0.3104370 0.3103973 [358] 0.3103575 0.3103177 0.3102778 0.3102378 0.3101977 0.3101576 0.3101174 [365] 0.3100771 0.3100368 0.3099964 0.3099560 0.3099154 0.3098748 0.3098341 [372] 0.3097934 0.3097526 0.3097117 0.3096708 0.3096298 0.3095887 0.3095476 [379] 0.3095063 0.3094651 0.3094237 0.3093823 0.3093408 0.3092993 0.3092577 [386] 0.3092160 0.3091742 0.3091324 0.3090905 0.3090486 0.3090065 0.3089645 [393] 0.3089223 0.3088801 0.3088378 0.3087954 0.3087530 0.3087105 0.3086680 [400] 0.3086254 0.3085827 > mx [1] 0.3199146 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1rsah1226604117.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/freestat/rcomp/tmp/2gny11226604117.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/freestat/rcomp/tmp/3hzq01226604117.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/freestat/rcomp/tmp/4iba11226604117.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/freestat/rcomp/tmp/5x9hz1226604117.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/62vgo1226604118.tab") > system("convert tmp/1rsah1226604117.ps tmp/1rsah1226604117.png") > system("convert tmp/2gny11226604117.ps tmp/2gny11226604117.png") > system("convert tmp/3hzq01226604117.ps tmp/3hzq01226604117.png") > system("convert tmp/4iba11226604117.ps tmp/4iba11226604117.png") > system("convert tmp/5x9hz1226604117.ps tmp/5x9hz1226604117.png") > > > proc.time() user system elapsed 1.721 1.275 1.906