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(286602,283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710,295881) > #'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.3808385 -0.3808392 -0.3808487 -0.3808419 -0.3808514 -0.3808539 [7] -0.3808599 -0.3808594 -0.3808634 -0.3808655 -0.3808687 -0.3808728 [13] -0.3808739 -0.3808758 -0.3808786 -0.3808802 -0.3808825 -0.3808838 [19] -0.3808844 -0.3808861 -0.3808882 -0.3808891 -0.3808909 -0.3808915 [25] -0.3808926 -0.3808939 -0.3808947 -0.3808957 -0.3808961 -0.3808966 [31] -0.3808970 -0.3808974 -0.3808976 -0.3808977 -0.3808977 -0.3808976 [37] -0.3808973 -0.3808969 -0.3808966 -0.3808962 -0.3808955 -0.3808947 [43] -0.3808939 -0.3808930 -0.3808919 -0.3808907 -0.3808895 -0.3808881 [49] -0.3808867 -0.3808851 -0.3808835 -0.3808817 -0.3808798 -0.3808778 [55] -0.3808757 -0.3808735 -0.3808712 -0.3808688 -0.3808663 -0.3808637 [61] -0.3808610 -0.3808582 -0.3808552 -0.3808522 -0.3808491 -0.3808458 [67] -0.3808425 -0.3808390 -0.3808355 -0.3808318 -0.3808280 -0.3808242 [73] -0.3808202 -0.3808161 -0.3808119 -0.3808076 -0.3808033 -0.3807988 [79] -0.3807941 -0.3807894 -0.3807846 -0.3807797 -0.3807747 -0.3807696 [85] -0.3807643 -0.3807590 -0.3807536 -0.3807480 -0.3807424 -0.3807366 [91] -0.3807307 -0.3807248 -0.3807187 -0.3807125 -0.3807063 -0.3806999 [97] -0.3806934 -0.3806868 -0.3806801 -0.3806733 -0.3806664 -0.3806594 [103] -0.3806523 -0.3806450 -0.3806377 -0.3806303 -0.3806228 -0.3806151 [109] -0.3806074 -0.3805995 -0.3805916 -0.3805835 -0.3805754 -0.3805671 [115] -0.3805587 -0.3805502 -0.3805417 -0.3805330 -0.3805242 -0.3805153 [121] -0.3805063 -0.3804972 -0.3804880 -0.3804787 -0.3804692 -0.3804597 [127] -0.3804501 -0.3804404 -0.3804305 -0.3804206 -0.3804105 -0.3804004 [133] -0.3803901 -0.3803798 -0.3803693 -0.3803588 -0.3803481 -0.3803373 [139] -0.3803264 -0.3803154 -0.3803043 -0.3802932 -0.3802819 -0.3802705 [145] -0.3802589 -0.3802473 -0.3802356 -0.3802238 -0.3802119 -0.3801998 [151] -0.3801877 -0.3801755 -0.3801631 -0.3801507 -0.3801381 -0.3801255 [157] -0.3801127 -0.3800998 -0.3800869 -0.3800738 -0.3800606 -0.3800473 [163] -0.3800340 -0.3800205 -0.3800069 -0.3799932 -0.3799794 -0.3799655 [169] -0.3799515 -0.3799373 -0.3799231 -0.3799088 -0.3798944 -0.3798798 [175] -0.3798652 -0.3798505 -0.3798356 -0.3798207 -0.3798056 -0.3797905 [181] -0.3797752 -0.3797598 -0.3797444 -0.3797288 -0.3797131 -0.3796973 [187] -0.3796815 -0.3796655 -0.3796494 -0.3796332 -0.3796169 -0.3796005 [193] -0.3795840 -0.3795674 -0.3795506 -0.3795338 -0.3795169 -0.3794999 [199] -0.3794827 -0.3794655 -0.3794482 -0.3794307 -0.3794132 -0.3793955 [205] -0.3793778 -0.3793599 -0.3793420 -0.3793239 -0.3793057 -0.3792875 [211] -0.3792691 -0.3792506 -0.3792320 -0.3792133 -0.3791945 -0.3791756 [217] -0.3791567 -0.3791376 -0.3791183 -0.3790990 -0.3790796 -0.3790601 [223] -0.3790405 -0.3790208 -0.3790010 -0.3789810 -0.3789610 -0.3789409 [229] -0.3789206 -0.3789003 -0.3788798 -0.3788593 -0.3788387 -0.3788179 [235] -0.3787970 -0.3787761 -0.3787550 -0.3787339 -0.3787126 -0.3786912 [241] -0.3786697 -0.3786482 -0.3786265 -0.3786047 -0.3785828 -0.3785608 [247] -0.3785387 -0.3785165 -0.3784942 -0.3784718 -0.3784493 -0.3784267 [253] -0.3784040 -0.3783812 -0.3783583 -0.3783353 -0.3783122 -0.3782889 [259] -0.3782656 -0.3782422 -0.3782187 -0.3781950 -0.3781713 -0.3781474 [265] -0.3781235 -0.3780995 -0.3780753 -0.3780511 -0.3780267 -0.3780023 [271] -0.3779777 -0.3779531 -0.3779283 -0.3779034 -0.3778785 -0.3778534 [277] -0.3778282 -0.3778030 -0.3777776 -0.3777521 -0.3777265 -0.3777009 [283] -0.3776751 -0.3776492 -0.3776232 -0.3775971 -0.3775709 -0.3775446 [289] -0.3775182 -0.3774917 -0.3774651 -0.3774385 -0.3774116 -0.3773847 [295] -0.3773577 -0.3773306 -0.3773034 -0.3772761 -0.3772487 -0.3772212 [301] -0.3771936 -0.3771659 -0.3771380 -0.3771101 -0.3770821 -0.3770540 [307] -0.3770258 -0.3769974 -0.3769690 -0.3769405 -0.3769119 -0.3768831 [313] -0.3768543 -0.3768254 -0.3767963 -0.3767672 -0.3767380 -0.3767086 [319] -0.3766792 -0.3766496 -0.3766200 -0.3765903 -0.3765604 -0.3765305 [325] -0.3765004 -0.3764703 -0.3764400 -0.3764097 -0.3763793 -0.3763487 [331] -0.3763181 -0.3762873 -0.3762565 -0.3762255 -0.3761945 -0.3761633 [337] -0.3761320 -0.3761007 -0.3760692 -0.3760377 -0.3760060 -0.3759743 [343] -0.3759424 -0.3759105 -0.3758784 -0.3758463 -0.3758140 -0.3757816 [349] -0.3757492 -0.3757166 -0.3756840 -0.3756512 -0.3756184 -0.3755854 [355] -0.3755524 -0.3755192 -0.3754859 -0.3754526 -0.3754191 -0.3753856 [361] -0.3753519 -0.3753182 -0.3752843 -0.3752504 -0.3752163 -0.3751821 [367] -0.3751479 -0.3751135 -0.3750791 -0.3750445 -0.3750099 -0.3749751 [373] -0.3749403 -0.3749053 -0.3748703 -0.3748351 -0.3747999 -0.3747645 [379] -0.3747291 -0.3746936 -0.3746579 -0.3746222 -0.3745863 -0.3745504 [385] -0.3745144 -0.3744782 -0.3744420 -0.3744056 -0.3743692 -0.3743327 [391] -0.3742960 -0.3742593 -0.3742225 -0.3741856 -0.3741485 -0.3741114 [397] -0.3740742 -0.3740369 -0.3739994 -0.3739619 -0.3739243 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ccm71258588312.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/2na5h1258588312.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/311ev1258588312.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/4p13z1258588312.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/50cc01258588312.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/6o5481258588312.tab") > > system("convert tmp/1ccm71258588312.ps tmp/1ccm71258588312.png") > system("convert tmp/2na5h1258588312.ps tmp/2na5h1258588312.png") > system("convert tmp/311ev1258588312.ps tmp/311ev1258588312.png") > system("convert tmp/4p13z1258588312.ps tmp/4p13z1258588312.png") > system("convert tmp/50cc01258588312.ps tmp/50cc01258588312.png") > > > proc.time() user system elapsed 1.066 0.764 1.275