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.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,104.7,130.9,129.2,113.5,125.6,107.6) > #'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.3166532 0.3166065 0.3165597 0.3165128 0.3164660 0.3164190 0.3163720 [8] 0.3163250 0.3162780 0.3162309 0.3161837 0.3161365 0.3160893 0.3160420 [15] 0.3159947 0.3159473 0.3158999 0.3158524 0.3158049 0.3157574 0.3157098 [22] 0.3156622 0.3156145 0.3155668 0.3155190 0.3154712 0.3154234 0.3153755 [29] 0.3153276 0.3152796 0.3152316 0.3151836 0.3151355 0.3150873 0.3150392 [36] 0.3149909 0.3149427 0.3148944 0.3148460 0.3147977 0.3147492 0.3147008 [43] 0.3146523 0.3146037 0.3145551 0.3145065 0.3144578 0.3144091 0.3143604 [50] 0.3143116 0.3142628 0.3142139 0.3141650 0.3141161 0.3140671 0.3140180 [57] 0.3139690 0.3139199 0.3138707 0.3138215 0.3137723 0.3137230 0.3136737 [64] 0.3136244 0.3135750 0.3135256 0.3134761 0.3134266 0.3133771 0.3133275 [71] 0.3132779 0.3132282 0.3131786 0.3131288 0.3130791 0.3130293 0.3129794 [78] 0.3129295 0.3128796 0.3128297 0.3127797 0.3127296 0.3126796 0.3126295 [85] 0.3125793 0.3125291 0.3124789 0.3124287 0.3123784 0.3123281 0.3122777 [92] 0.3122273 0.3121769 0.3121264 0.3120759 0.3120253 0.3119748 0.3119241 [99] 0.3118735 0.3118228 0.3117721 0.3117213 0.3116705 0.3116197 0.3115688 [106] 0.3115179 0.3114670 0.3114160 0.3113650 0.3113140 0.3112629 0.3112118 [113] 0.3111606 0.3111095 0.3110582 0.3110070 0.3109557 0.3109044 0.3108530 [120] 0.3108016 0.3107502 0.3106988 0.3106473 0.3105958 0.3105442 0.3104926 [127] 0.3104410 0.3103894 0.3103377 0.3102859 0.3102342 0.3101824 0.3101306 [134] 0.3100787 0.3100268 0.3099749 0.3099230 0.3098710 0.3098190 0.3097669 [141] 0.3097149 0.3096627 0.3096106 0.3095584 0.3095062 0.3094540 0.3094017 [148] 0.3093494 0.3092971 0.3092447 0.3091923 0.3091399 0.3090874 0.3090350 [155] 0.3089824 0.3089299 0.3088773 0.3088247 0.3087721 0.3087194 0.3086667 [162] 0.3086139 0.3085612 0.3085084 0.3084556 0.3084027 0.3083498 0.3082969 [169] 0.3082440 0.3081910 0.3081380 0.3080850 0.3080319 0.3079788 0.3079257 [176] 0.3078726 0.3078194 0.3077662 0.3077130 0.3076597 0.3076064 0.3075531 [183] 0.3074998 0.3074464 0.3073930 0.3073396 0.3072861 0.3072326 0.3071791 [190] 0.3071256 0.3070720 0.3070184 0.3069648 0.3069111 0.3068574 0.3068037 [197] 0.3067500 0.3066962 0.3066425 0.3065886 0.3065348 0.3064809 0.3064270 [204] 0.3063731 0.3063192 0.3062652 0.3062112 0.3061572 0.3061031 0.3060491 [211] 0.3059950 0.3059408 0.3058867 0.3058325 0.3057783 0.3057241 0.3056698 [218] 0.3056155 0.3055612 0.3055069 0.3054525 0.3053982 0.3053438 0.3052893 [225] 0.3052349 0.3051804 0.3051259 0.3050714 0.3050168 0.3049622 0.3049076 [232] 0.3048530 0.3047984 0.3047437 0.3046890 0.3046343 0.3045795 0.3045248 [239] 0.3044700 0.3044152 0.3043603 0.3043055 0.3042506 0.3041957 0.3041408 [246] 0.3040858 0.3040309 0.3039759 0.3039209 0.3038658 0.3038108 0.3037557 [253] 0.3037006 0.3036454 0.3035903 0.3035351 0.3034799 0.3034247 0.3033695 [260] 0.3033142 0.3032589 0.3032036 0.3031483 0.3030930 0.3030376 0.3029822 [267] 0.3029268 0.3028714 0.3028160 0.3027605 0.3027050 0.3026495 0.3025940 [274] 0.3025384 0.3024829 0.3024273 0.3023717 0.3023160 0.3022604 0.3022047 [281] 0.3021490 0.3020933 0.3020376 0.3019819 0.3019261 0.3018703 0.3018145 [288] 0.3017587 0.3017029 0.3016470 0.3015911 0.3015352 0.3014793 0.3014234 [295] 0.3013674 0.3013115 0.3012555 0.3011995 0.3011434 0.3010874 0.3010313 [302] 0.3009753 0.3009192 0.3008630 0.3008069 0.3007508 0.3006946 0.3006384 [309] 0.3005822 0.3005260 0.3004698 0.3004135 0.3003573 0.3003010 0.3002447 [316] 0.3001883 0.3001320 0.3000757 0.3000193 0.2999629 0.2999065 0.2998501 [323] 0.2997937 0.2997372 0.2996808 0.2996243 0.2995678 0.2995113 0.2994548 [330] 0.2993982 0.2993417 0.2992851 0.2992285 0.2991719 0.2991153 0.2990586 [337] 0.2990020 0.2989453 0.2988887 0.2988320 0.2987753 0.2987186 0.2986618 [344] 0.2986051 0.2985483 0.2984915 0.2984348 0.2983779 0.2983211 0.2982643 [351] 0.2982075 0.2981506 0.2980937 0.2980368 0.2979799 0.2979230 0.2978661 [358] 0.2978092 0.2977522 0.2976953 0.2976383 0.2975813 0.2975243 0.2974673 [365] 0.2974103 0.2973532 0.2972962 0.2972391 0.2971820 0.2971250 0.2970679 [372] 0.2970107 0.2969536 0.2968965 0.2968393 0.2967822 0.2967250 0.2966678 [379] 0.2966107 0.2965534 0.2964962 0.2964390 0.2963818 0.2963245 0.2962673 [386] 0.2962100 0.2961527 0.2960954 0.2960381 0.2959808 0.2959235 0.2958662 [393] 0.2958088 0.2957515 0.2956941 0.2956368 0.2955794 0.2955220 0.2954646 [400] 0.2954072 0.2953498 > mx [1] 0.3166532 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/19f2w1258284374.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/2lqe71258284374.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/3w9q51258284374.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/4ikhr1258284374.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/5qqyi1258284374.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/66hm71258284374.tab") > > system("convert tmp/19f2w1258284374.ps tmp/19f2w1258284374.png") > system("convert tmp/2lqe71258284374.ps tmp/2lqe71258284374.png") > system("convert tmp/3w9q51258284374.ps tmp/3w9q51258284374.png") > system("convert tmp/4ikhr1258284374.ps tmp/4ikhr1258284374.png") > system("convert tmp/5qqyi1258284374.ps tmp/5qqyi1258284374.png") > > > proc.time() user system elapsed 1.068 0.755 1.332