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(2220.6,2161.5,1863.6,1955.1,1907.4,1889.4,2246.3,2213,1965,2285.6,1983.8,1872.4,2371.4,2287,2198.2,2330.4,2014.4,2066.1,2355.8,2232.5,2091.7,2376.5,1931.9,2025.7,2404.9,2316.1,2368.1,2282.5,2158.6,2174.8,2594.1,2281.4,2547.9,2606.3,2190.8,2262.3,2423.8,2520.4,2482.9,2215.9,2441.9,2333.8,2670.2,2431,2559.3,2661.4,2404.6,2378.3,2489.2,2941,2700.9,2335.6,2770,2764.2,2784.9,2898.8,2853.4,3022.6,2851.4,2630.8) > #'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.7678452 0.7679884 0.7681313 0.7682738 0.7684161 0.7685580 0.7686996 [8] 0.7688408 0.7689818 0.7691224 0.7692626 0.7694026 0.7695422 0.7696815 [15] 0.7698204 0.7699591 0.7700974 0.7702353 0.7703729 0.7705102 0.7706472 [22] 0.7707838 0.7709200 0.7710560 0.7711916 0.7713268 0.7714617 0.7715963 [29] 0.7717306 0.7718645 0.7719980 0.7721312 0.7722641 0.7723966 0.7725288 [36] 0.7726606 0.7727921 0.7729232 0.7730540 0.7731844 0.7733145 0.7734442 [43] 0.7735736 0.7737027 0.7738313 0.7739597 0.7740876 0.7742153 0.7743425 [50] 0.7744694 0.7745960 0.7747222 0.7748480 0.7749735 0.7750986 0.7752234 [57] 0.7753478 0.7754719 0.7755955 0.7757189 0.7758418 0.7759644 0.7760867 [64] 0.7762085 0.7763300 0.7764512 0.7765719 0.7766923 0.7768124 0.7769321 [71] 0.7770514 0.7771703 0.7772888 0.7774070 0.7775249 0.7776423 0.7777594 [78] 0.7778761 0.7779924 0.7781084 0.7782240 0.7783392 0.7784540 0.7785685 [85] 0.7786826 0.7787963 0.7789096 0.7790225 0.7791351 0.7792473 0.7793591 [92] 0.7794705 0.7795816 0.7796923 0.7798025 0.7799124 0.7800220 0.7801311 [99] 0.7802398 0.7803482 0.7804562 0.7805638 0.7806710 0.7807778 0.7808842 [106] 0.7809903 0.7810959 0.7812012 0.7813061 0.7814106 0.7815147 0.7816184 [113] 0.7817217 0.7818246 0.7819271 0.7820293 0.7821310 0.7822324 0.7823333 [120] 0.7824339 0.7825340 0.7826338 0.7827332 0.7828322 0.7829307 0.7830289 [127] 0.7831267 0.7832241 0.7833211 0.7834176 0.7835138 0.7836096 0.7837050 [134] 0.7838000 0.7838945 0.7839887 0.7840825 0.7841758 0.7842688 0.7843614 [141] 0.7844535 0.7845453 0.7846366 0.7847275 0.7848181 0.7849082 0.7849979 [148] 0.7850872 0.7851761 0.7852646 0.7853527 0.7854404 0.7855277 0.7856145 [155] 0.7857010 0.7857870 0.7858726 0.7859578 0.7860426 0.7861270 0.7862110 [162] 0.7862945 0.7863777 0.7864604 0.7865428 0.7866247 0.7867062 0.7867872 [169] 0.7868679 0.7869481 0.7870280 0.7871074 0.7871864 0.7872649 0.7873431 [176] 0.7874208 0.7874982 0.7875751 0.7876516 0.7877276 0.7878033 0.7878785 [183] 0.7879533 0.7880277 0.7881017 0.7881752 0.7882483 0.7883210 0.7883933 [190] 0.7884652 0.7885366 0.7886076 0.7886782 0.7887484 0.7888181 0.7888874 [197] 0.7889563 0.7890248 0.7890928 0.7891604 0.7892276 0.7892944 0.7893608 [204] 0.7894267 0.7894922 0.7895572 0.7896219 0.7896861 0.7897498 0.7898132 [211] 0.7898761 0.7899386 0.7900007 0.7900623 0.7901235 0.7901843 0.7902447 [218] 0.7903046 0.7903641 0.7904232 0.7904818 0.7905400 0.7905978 0.7906551 [225] 0.7907121 0.7907685 0.7908246 0.7908802 0.7909354 0.7909902 0.7910445 [232] 0.7910984 0.7911518 0.7912049 0.7912575 0.7913096 0.7913614 0.7914127 [239] 0.7914635 0.7915140 0.7915640 0.7916135 0.7916627 0.7917114 0.7917597 [246] 0.7918075 0.7918549 0.7919018 0.7919484 0.7919945 0.7920401 0.7920854 [253] 0.7921302 0.7921745 0.7922184 0.7922619 0.7923050 0.7923476 0.7923898 [260] 0.7924315 0.7924728 0.7925137 0.7925541 0.7925941 0.7926337 0.7926728 [267] 0.7927115 0.7927498 0.7927876 0.7928250 0.7928620 0.7928985 0.7929346 [274] 0.7929702 0.7930054 0.7930402 0.7930745 0.7931084 0.7931419 0.7931749 [281] 0.7932075 0.7932396 0.7932714 0.7933026 0.7933335 0.7933639 0.7933939 [288] 0.7934234 0.7934525 0.7934811 0.7935094 0.7935372 0.7935645 0.7935914 [295] 0.7936179 0.7936439 0.7936695 0.7936947 0.7937194 0.7937437 0.7937676 [302] 0.7937910 0.7938140 0.7938366 0.7938587 0.7938804 0.7939016 0.7939224 [309] 0.7939428 0.7939627 0.7939822 0.7940013 0.7940199 0.7940381 0.7940559 [316] 0.7940732 0.7940901 0.7941065 0.7941225 0.7941381 0.7941533 0.7941680 [323] 0.7941823 0.7941961 0.7942095 0.7942225 0.7942350 0.7942471 0.7942588 [330] 0.7942701 0.7942809 0.7942912 0.7943012 0.7943107 0.7943197 0.7943284 [337] 0.7943366 0.7943444 0.7943517 0.7943586 0.7943651 0.7943711 0.7943767 [344] 0.7943819 0.7943866 0.7943910 0.7943948 0.7943983 0.7944013 0.7944039 [351] 0.7944061 0.7944078 0.7944091 0.7944100 0.7944104 0.7944104 0.7944100 [358] 0.7944091 0.7944079 0.7944061 0.7944040 0.7944014 0.7943985 0.7943950 [365] 0.7943912 0.7943869 0.7943822 0.7943771 0.7943715 0.7943655 0.7943591 [372] 0.7943523 0.7943450 0.7943373 0.7943292 0.7943206 0.7943117 0.7943023 [379] 0.7942925 0.7942822 0.7942716 0.7942605 0.7942489 0.7942370 0.7942247 [386] 0.7942119 0.7941987 0.7941850 0.7941710 0.7941565 0.7941416 0.7941263 [393] 0.7941106 0.7940944 0.7940778 0.7940608 0.7940434 0.7940256 0.7940073 [400] 0.7939887 0.7939696 > mx [1] 0.7944104 > mxli [1] 1.55 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/17cl81229075168.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/25kkm1229075168.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/314nz1229075169.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/44cdn1229075169.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/5x6da1229075169.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/6o3pc1229075169.tab") > > system("convert tmp/17cl81229075168.ps tmp/17cl81229075168.png") > system("convert tmp/25kkm1229075168.ps tmp/25kkm1229075168.png") > system("convert tmp/314nz1229075169.ps tmp/314nz1229075169.png") > system("convert tmp/44cdn1229075169.ps tmp/44cdn1229075169.png") > system("convert tmp/5x6da1229075169.ps tmp/5x6da1229075169.png") > > > proc.time() user system elapsed 3.595 1.607 3.903