R version 2.7.0 (2008-04-22) 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(88827,85874,85211,87130,88620,89563,89056,88542,89504,89428,86040,96240,94423,93028,92285,91685,94260,93858,92437,92980,92099,92803,88551,98334,98329,96455,97109,97687,98512,98673,96028,98014,95580,97838,97760,99913,97588,93942,93656,93365,92881,93120,91063,90930,91946,94624,95484,95862,95530,94574,94677,93845,91533,91214,90922,89563,89945,91850,92505,92437) > #'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.3569492 0.3568553 0.3567616 0.3566699 0.3565758 0.3564822 0.3563885 [8] 0.3562946 0.3562011 0.3561086 0.3560144 0.3559214 0.3558279 0.3557342 [15] 0.3556408 0.3555474 0.3554539 0.3553602 0.3552668 0.3551733 0.3550798 [22] 0.3549860 0.3548924 0.3547988 0.3547051 0.3546116 0.3545180 0.3544242 [29] 0.3543306 0.3542369 0.3541432 0.3540494 0.3539557 0.3538619 0.3537681 [36] 0.3536744 0.3535806 0.3534868 0.3533930 0.3532991 0.3532053 0.3531114 [43] 0.3530176 0.3529237 0.3528298 0.3527359 0.3526419 0.3525480 0.3524540 [50] 0.3523601 0.3522661 0.3521721 0.3520781 0.3519841 0.3518901 0.3517960 [57] 0.3517020 0.3516079 0.3515139 0.3514198 0.3513257 0.3512315 0.3511374 [64] 0.3510433 0.3509491 0.3508550 0.3507608 0.3506666 0.3505724 0.3504782 [71] 0.3503839 0.3502897 0.3501954 0.3501012 0.3500069 0.3499126 0.3498183 [78] 0.3497240 0.3496297 0.3495353 0.3494410 0.3493466 0.3492523 0.3491579 [85] 0.3490635 0.3489691 0.3488747 0.3487802 0.3486858 0.3485913 0.3484969 [92] 0.3484024 0.3483079 0.3482134 0.3481189 0.3480243 0.3479298 0.3478353 [99] 0.3477407 0.3476461 0.3475516 0.3474570 0.3473624 0.3472677 0.3471731 [106] 0.3470785 0.3469838 0.3468892 0.3467945 0.3466998 0.3466051 0.3465104 [113] 0.3464157 0.3463210 0.3462262 0.3461315 0.3460367 0.3459419 0.3458471 [120] 0.3457524 0.3456576 0.3455627 0.3454679 0.3453731 0.3452782 0.3451834 [127] 0.3450885 0.3449936 0.3448987 0.3448038 0.3447089 0.3446140 0.3445191 [134] 0.3444241 0.3443292 0.3442342 0.3441392 0.3440443 0.3439493 0.3438543 [141] 0.3437592 0.3436642 0.3435692 0.3434741 0.3433791 0.3432840 0.3431889 [148] 0.3430939 0.3429988 0.3429037 0.3428085 0.3427134 0.3426183 0.3425231 [155] 0.3424280 0.3423328 0.3422376 0.3421425 0.3420473 0.3419521 0.3418569 [162] 0.3417616 0.3416664 0.3415712 0.3414759 0.3413806 0.3412854 0.3411901 [169] 0.3410948 0.3409995 0.3409042 0.3408089 0.3407136 0.3406182 0.3405229 [176] 0.3404275 0.3403322 0.3402368 0.3401414 0.3400460 0.3399506 0.3398552 [183] 0.3397598 0.3396644 0.3395689 0.3394735 0.3393780 0.3392826 0.3391871 [190] 0.3390916 0.3389962 0.3389007 0.3388052 0.3387096 0.3386141 0.3385186 [197] 0.3384230 0.3383275 0.3382319 0.3381364 0.3380408 0.3379452 0.3378496 [204] 0.3377540 0.3376584 0.3375628 0.3374672 0.3373716 0.3372759 0.3371803 [211] 0.3370846 0.3369890 0.3368933 0.3367976 0.3367019 0.3366062 0.3365105 [218] 0.3364148 0.3363191 0.3362234 0.3361276 0.3360319 0.3359361 0.3358404 [225] 0.3357446 0.3356488 0.3355531 0.3354573 0.3353615 0.3352657 0.3351698 [232] 0.3350740 0.3349782 0.3348824 0.3347865 0.3346907 0.3345948 0.3344990 [239] 0.3344031 0.3343072 0.3342113 0.3341154 0.3340195 0.3339236 0.3338277 [246] 0.3337318 0.3336359 0.3335399 0.3334440 0.3333480 0.3332521 0.3331561 [253] 0.3330601 0.3329642 0.3328682 0.3327722 0.3326762 0.3325802 0.3324842 [260] 0.3323882 0.3322921 0.3321961 0.3321001 0.3320040 0.3319080 0.3318119 [267] 0.3317158 0.3316198 0.3315237 0.3314276 0.3313315 0.3312354 0.3311393 [274] 0.3310432 0.3309471 0.3308510 0.3307549 0.3306587 0.3305626 0.3304664 [281] 0.3303703 0.3302741 0.3301780 0.3300818 0.3299856 0.3298894 0.3297933 [288] 0.3296971 0.3296009 0.3295047 0.3294084 0.3293122 0.3292160 0.3291198 [295] 0.3290235 0.3289273 0.3288311 0.3287348 0.3286386 0.3285423 0.3284460 [302] 0.3283498 0.3282535 0.3281572 0.3280609 0.3279646 0.3278683 0.3277720 [309] 0.3276757 0.3275794 0.3274831 0.3273867 0.3272904 0.3271941 0.3270977 [316] 0.3270014 0.3269050 0.3268087 0.3267123 0.3266160 0.3265196 0.3264232 [323] 0.3263268 0.3262305 0.3261341 0.3260377 0.3259413 0.3258449 0.3257485 [330] 0.3256521 0.3255556 0.3254592 0.3253628 0.3252664 0.3251699 0.3250735 [337] 0.3249770 0.3248806 0.3247841 0.3246877 0.3245912 0.3244947 0.3243983 [344] 0.3243018 0.3242053 0.3241088 0.3240124 0.3239159 0.3238194 0.3237229 [351] 0.3236264 0.3235299 0.3234334 0.3233368 0.3232403 0.3231438 0.3230473 [358] 0.3229507 0.3228542 0.3227577 0.3226611 0.3225646 0.3224680 0.3223715 [365] 0.3222749 0.3221784 0.3220818 0.3219852 0.3218887 0.3217921 0.3216955 [372] 0.3215989 0.3215023 0.3214058 0.3213092 0.3212126 0.3211160 0.3210194 [379] 0.3209228 0.3208262 0.3207295 0.3206329 0.3205363 0.3204397 0.3203431 [386] 0.3202465 0.3201498 0.3200532 0.3199566 0.3198599 0.3197633 0.3196666 [393] 0.3195700 0.3194733 0.3193767 0.3192800 0.3191834 0.3190867 0.3189901 [400] 0.3188934 0.3187967 > mx [1] 0.3569492 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1h5pr1229271293.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/26enb1229271293.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/3ypc51229271293.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/4pjya1229271293.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/53rwq1229271293.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/6yvpd1229271293.tab") > > system("convert tmp/1h5pr1229271293.ps tmp/1h5pr1229271293.png") > system("convert tmp/26enb1229271293.ps tmp/26enb1229271293.png") > system("convert tmp/3ypc51229271293.ps tmp/3ypc51229271293.png") > system("convert tmp/4pjya1229271293.ps tmp/4pjya1229271293.png") > system("convert tmp/53rwq1229271293.ps tmp/53rwq1229271293.png") > > > proc.time() user system elapsed 2.352 1.277 2.549