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(1363,1664,2179,2305,2098,2231,1407,1966,2293,2045,1532,1333,1583,1712,2641,2267,2126,2231,1517,2010,2628,2115,1829,1636,1787,2122,2620,2555,2338,2523,1798,2415,2388,2267,2134,1759,1905,2175,2341,2673,2765,2781,1998,2587,2732,2696,2461,1979,2181,2419,2980,2750,2913,2838,1884,2690,2715,2629,2373,1827,2004,2187,2485,2517,2538,2481,1865,2307,2383,2362,2081,1648,1795) > #'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.3635228 0.3634254 0.3633278 0.3632299 0.3631318 0.3630334 0.3629348 [8] 0.3628359 0.3627368 0.3626374 0.3625378 0.3624379 0.3623378 0.3622375 [15] 0.3621369 0.3620361 0.3619350 0.3618337 0.3617321 0.3616303 0.3615283 [22] 0.3614260 0.3613235 0.3612208 0.3611178 0.3610146 0.3609111 0.3608074 [29] 0.3607035 0.3605994 0.3604950 0.3603904 0.3602855 0.3601805 0.3600752 [36] 0.3599696 0.3598639 0.3597579 0.3596517 0.3595453 0.3594386 0.3593317 [43] 0.3592246 0.3591173 0.3590097 0.3589019 0.3587940 0.3586857 0.3585773 [50] 0.3584687 0.3583598 0.3582507 0.3581414 0.3580319 0.3579222 0.3578122 [57] 0.3577021 0.3575917 0.3574811 0.3573703 0.3572593 0.3571481 0.3570367 [64] 0.3569251 0.3568132 0.3567012 0.3565890 0.3564765 0.3563639 0.3562510 [71] 0.3561380 0.3560247 0.3559113 0.3557976 0.3556838 0.3555697 0.3554555 [78] 0.3553410 0.3552264 0.3551115 0.3549965 0.3548813 0.3547659 0.3546503 [85] 0.3545345 0.3544185 0.3543023 0.3541860 0.3540694 0.3539527 0.3538358 [92] 0.3537187 0.3536014 0.3534839 0.3533663 0.3532485 0.3531305 0.3530123 [99] 0.3528939 0.3527754 0.3526566 0.3525377 0.3524187 0.3522994 0.3521800 [106] 0.3520604 0.3519406 0.3518207 0.3517006 0.3515803 0.3514599 0.3513393 [113] 0.3512185 0.3510976 0.3509765 0.3508552 0.3507338 0.3506122 0.3504904 [120] 0.3503685 0.3502464 0.3501242 0.3500018 0.3498793 0.3497566 0.3496337 [127] 0.3495107 0.3493875 0.3492642 0.3491408 0.3490171 0.3488934 0.3487695 [134] 0.3486454 0.3485212 0.3483968 0.3482723 0.3481477 0.3480229 0.3478980 [141] 0.3477729 0.3476477 0.3475224 0.3473969 0.3472712 0.3471455 0.3470196 [148] 0.3468936 0.3467674 0.3466411 0.3465146 0.3463881 0.3462614 0.3461346 [155] 0.3460076 0.3458805 0.3457533 0.3456260 0.3454985 0.3453709 0.3452432 [162] 0.3451154 0.3449875 0.3448594 0.3447312 0.3446029 0.3444745 0.3443459 [169] 0.3442173 0.3440885 0.3439596 0.3438306 0.3437015 0.3435722 0.3434429 [176] 0.3433135 0.3431839 0.3430542 0.3429245 0.3427946 0.3426646 0.3425345 [183] 0.3424043 0.3422740 0.3421436 0.3420131 0.3418825 0.3417518 0.3416211 [190] 0.3414902 0.3413592 0.3412281 0.3410969 0.3409656 0.3408343 0.3407028 [197] 0.3405713 0.3404396 0.3403079 0.3401761 0.3400442 0.3399122 0.3397801 [204] 0.3396480 0.3395157 0.3393834 0.3392510 0.3391185 0.3389859 0.3388533 [211] 0.3387205 0.3385877 0.3384548 0.3383219 0.3381888 0.3380557 0.3379225 [218] 0.3377893 0.3376560 0.3375226 0.3373891 0.3372555 0.3371219 0.3369883 [225] 0.3368545 0.3367207 0.3365868 0.3364529 0.3363189 0.3361848 0.3360507 [232] 0.3359165 0.3357822 0.3356479 0.3355136 0.3353791 0.3352446 0.3351101 [239] 0.3349755 0.3348409 0.3347062 0.3345714 0.3344366 0.3343017 0.3341668 [246] 0.3340319 0.3338969 0.3337618 0.3336267 0.3334916 0.3333564 0.3332211 [253] 0.3330858 0.3329505 0.3328151 0.3326797 0.3325443 0.3324088 0.3322733 [260] 0.3321377 0.3320021 0.3318664 0.3317307 0.3315950 0.3314593 0.3313235 [267] 0.3311877 0.3310518 0.3309159 0.3307800 0.3306441 0.3305081 0.3303721 [274] 0.3302361 0.3301000 0.3299639 0.3298278 0.3296917 0.3295555 0.3294194 [281] 0.3292831 0.3291469 0.3290107 0.3288744 0.3287381 0.3286018 0.3284655 [288] 0.3283291 0.3281928 0.3280564 0.3279200 0.3277836 0.3276472 0.3275107 [295] 0.3273743 0.3272378 0.3271014 0.3269649 0.3268284 0.3266919 0.3265554 [302] 0.3264188 0.3262823 0.3261458 0.3260092 0.3258727 0.3257361 0.3255996 [309] 0.3254630 0.3253265 0.3251899 0.3250533 0.3249168 0.3247802 0.3246436 [316] 0.3245071 0.3243705 0.3242339 0.3240974 0.3239608 0.3238243 0.3236877 [323] 0.3235512 0.3234147 0.3232781 0.3231416 0.3230051 0.3228686 0.3227321 [330] 0.3225956 0.3224591 0.3223227 0.3221862 0.3220498 0.3219133 0.3217769 [337] 0.3216405 0.3215041 0.3213678 0.3212314 0.3210951 0.3209587 0.3208224 [344] 0.3206861 0.3205499 0.3204136 0.3202774 0.3201411 0.3200049 0.3198688 [351] 0.3197326 0.3195965 0.3194604 0.3193243 0.3191882 0.3190522 0.3189162 [358] 0.3187802 0.3186442 0.3185083 0.3183724 0.3182365 0.3181006 0.3179648 [365] 0.3178290 0.3176932 0.3175575 0.3174218 0.3172861 0.3171504 0.3170148 [372] 0.3168792 0.3167437 0.3166082 0.3164727 0.3163372 0.3162018 0.3160664 [379] 0.3159311 0.3157957 0.3156605 0.3155252 0.3153900 0.3152548 0.3151197 [386] 0.3149846 0.3148496 0.3147145 0.3145796 0.3144446 0.3143097 0.3141749 [393] 0.3140401 0.3139053 0.3137706 0.3136359 0.3135012 0.3133666 0.3132321 [400] 0.3130976 0.3129631 > mx [1] 0.3635228 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/106yt1261054702.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/2wvmf1261054702.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/3ynd51261054702.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/4dxcv1261054702.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/5m2we1261054702.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/6qjqt1261054702.tab") > > try(system("convert tmp/106yt1261054702.ps tmp/106yt1261054702.png",intern=TRUE)) character(0) > try(system("convert tmp/2wvmf1261054702.ps tmp/2wvmf1261054702.png",intern=TRUE)) character(0) > try(system("convert tmp/3ynd51261054702.ps tmp/3ynd51261054702.png",intern=TRUE)) character(0) > try(system("convert tmp/4dxcv1261054702.ps tmp/4dxcv1261054702.png",intern=TRUE)) character(0) > try(system("convert tmp/5m2we1261054702.ps tmp/5m2we1261054702.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.060 0.758 1.413