R version 2.8.0 (2008-10-20) 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(151.7,121.3,133.0,119.6,122.2,117.4,106.7,87.5,81.0,110.3,87.0,55.7,146.0,137.5,138.5,135.6,107.3,99.0,91.4,68.4,82.6,98.4,71.3,47.6,130.8,113.6,125.7,113.6,97.1,104.4,91.8,75.1,89.2,110.2,78.4,68.4,122.8,129.7,159.1,139.0,102.2,113.6,81.5,77.4,87.6,101.2,87.2,64.9,133.1,118.0,135.9,125.7,108.0,128.3,84.7,86.4,92.2,95.8,92.3,54.3) > #'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.1827536 -0.1830665 -0.1833791 -0.1836915 -0.1840037 -0.1843157 [7] -0.1846275 -0.1849390 -0.1852504 -0.1855614 -0.1858723 -0.1861829 [13] -0.1864932 -0.1868033 -0.1871131 -0.1874227 -0.1877320 -0.1880410 [19] -0.1883497 -0.1886581 -0.1889663 -0.1892741 -0.1895816 -0.1898889 [25] -0.1901958 -0.1905024 -0.1908087 -0.1911146 -0.1914202 -0.1917255 [31] -0.1920305 -0.1923350 -0.1926393 -0.1929431 -0.1932467 -0.1935498 [37] -0.1938526 -0.1941550 -0.1944570 -0.1947586 -0.1950598 -0.1953606 [43] -0.1956611 -0.1959611 -0.1962607 -0.1965599 -0.1968586 -0.1971570 [49] -0.1974549 -0.1977523 -0.1980493 -0.1983459 -0.1986421 -0.1989377 [55] -0.1992329 -0.1995277 -0.1998219 -0.2001157 -0.2004091 -0.2007019 [61] -0.2009942 -0.2012861 -0.2015774 -0.2018683 -0.2021586 -0.2024485 [67] -0.2027378 -0.2030266 -0.2033148 -0.2036026 -0.2038898 -0.2041764 [73] -0.2044626 -0.2047481 -0.2050332 -0.2053176 -0.2056015 -0.2058849 [79] -0.2061676 -0.2064498 -0.2067315 -0.2070125 -0.2072930 -0.2075728 [85] -0.2078521 -0.2081308 -0.2084088 -0.2086863 -0.2089632 -0.2092394 [91] -0.2095150 -0.2097900 -0.2100644 -0.2103381 -0.2106113 -0.2108837 [97] -0.2111556 -0.2114268 -0.2116973 -0.2119672 -0.2122364 -0.2125050 [103] -0.2127729 -0.2130401 -0.2133067 -0.2135726 -0.2138378 -0.2141024 [109] -0.2143662 -0.2146294 -0.2148919 -0.2151537 -0.2154147 -0.2156751 [115] -0.2159348 -0.2161938 -0.2164520 -0.2167096 -0.2169664 -0.2172225 [121] -0.2174779 -0.2177326 -0.2179865 -0.2182397 -0.2184922 -0.2187439 [127] -0.2189949 -0.2192452 -0.2194947 -0.2197434 -0.2199914 -0.2202387 [133] -0.2204852 -0.2207309 -0.2209759 -0.2212201 -0.2214635 -0.2217062 [139] -0.2219480 -0.2221892 -0.2224295 -0.2226691 -0.2229078 -0.2231458 [145] -0.2233830 -0.2236195 -0.2238551 -0.2240899 -0.2243240 -0.2245572 [151] -0.2247896 -0.2250213 -0.2252521 -0.2254822 -0.2257114 -0.2259398 [157] -0.2261674 -0.2263942 -0.2266202 -0.2268453 -0.2270697 -0.2272932 [163] -0.2275159 -0.2277378 -0.2279588 -0.2281790 -0.2283984 -0.2286170 [169] -0.2288347 -0.2290516 -0.2292677 -0.2294830 -0.2296974 -0.2299109 [175] -0.2301236 -0.2303355 -0.2305466 -0.2307568 -0.2309661 -0.2311746 [181] -0.2313823 -0.2315891 -0.2317951 -0.2320002 -0.2322044 -0.2324079 [187] -0.2326104 -0.2328121 -0.2330130 -0.2332130 -0.2334121 -0.2336104 [193] -0.2338079 -0.2340044 -0.2342001 -0.2343950 -0.2345890 -0.2347821 [199] -0.2349744 -0.2351658 -0.2353564 -0.2355461 -0.2357349 -0.2359229 [205] -0.2361100 -0.2362962 -0.2364816 -0.2366661 -0.2368498 -0.2370326 [211] -0.2372145 -0.2373955 -0.2375757 -0.2377551 -0.2379335 -0.2381111 [217] -0.2382878 -0.2384637 -0.2386387 -0.2388128 -0.2389861 -0.2391585 [223] -0.2393300 -0.2395007 -0.2396705 -0.2398394 -0.2400075 -0.2401747 [229] -0.2403411 -0.2405066 -0.2406712 -0.2408349 -0.2409978 -0.2411599 [235] -0.2413210 -0.2414813 -0.2416408 -0.2417994 -0.2419571 -0.2421140 [241] -0.2422700 -0.2424251 -0.2425794 -0.2427328 -0.2428854 -0.2430371 [247] -0.2431880 -0.2433380 -0.2434871 -0.2436354 -0.2437829 -0.2439295 [253] -0.2440752 -0.2442201 -0.2443642 -0.2445074 -0.2446497 -0.2447912 [259] -0.2449318 -0.2450717 -0.2452106 -0.2453487 -0.2454860 -0.2456224 [265] -0.2457580 -0.2458928 -0.2460267 -0.2461598 -0.2462920 -0.2464234 [271] -0.2465540 -0.2466837 -0.2468126 -0.2469407 -0.2470680 -0.2471944 [277] -0.2473200 -0.2474447 -0.2475687 -0.2476918 -0.2478141 -0.2479355 [283] -0.2480562 -0.2481760 -0.2482950 -0.2484132 -0.2485306 -0.2486471 [289] -0.2487629 -0.2488778 -0.2489920 -0.2491053 -0.2492178 -0.2493295 [295] -0.2494404 -0.2495505 -0.2496598 -0.2497683 -0.2498760 -0.2499829 [301] -0.2500890 -0.2501943 -0.2502989 -0.2504026 -0.2505055 -0.2506077 [307] -0.2507091 -0.2508096 -0.2509094 -0.2510085 -0.2511067 -0.2512041 [313] -0.2513008 -0.2513967 -0.2514919 -0.2515862 -0.2516798 -0.2517726 [319] -0.2518647 -0.2519559 -0.2520465 -0.2521362 -0.2522252 -0.2523134 [325] -0.2524009 -0.2524876 -0.2525736 -0.2526588 -0.2527433 -0.2528270 [331] -0.2529099 -0.2529922 -0.2530736 -0.2531544 -0.2532343 -0.2533136 [337] -0.2533921 -0.2534699 -0.2535469 -0.2536232 -0.2536988 -0.2537737 [343] -0.2538478 -0.2539212 -0.2539938 -0.2540658 -0.2541370 -0.2542075 [349] -0.2542773 -0.2543464 -0.2544148 -0.2544824 -0.2545494 -0.2546156 [355] -0.2546811 -0.2547460 -0.2548101 -0.2548735 -0.2549363 -0.2549983 [361] -0.2550596 -0.2551203 -0.2551802 -0.2552395 -0.2552980 -0.2553559 [367] -0.2554131 -0.2554696 -0.2555255 -0.2555806 -0.2556351 -0.2556889 [373] -0.2557420 -0.2557945 -0.2558463 -0.2558974 -0.2559479 -0.2559977 [379] -0.2560468 -0.2560952 -0.2561431 -0.2561902 -0.2562367 -0.2562825 [385] -0.2563277 -0.2563723 -0.2564162 -0.2564594 -0.2565020 -0.2565440 [391] -0.2565853 -0.2566259 -0.2566660 -0.2567054 -0.2567442 -0.2567823 [397] -0.2568198 -0.2568567 -0.2568929 -0.2569286 -0.2569636 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/16q3u1257954604.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/freestat/rcomp/tmp/2npu71257954604.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/freestat/rcomp/tmp/3pq5i1257954604.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/freestat/rcomp/tmp/4eoxt1257954604.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/freestat/rcomp/tmp/58mcr1257954604.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6ca011257954604.tab") > > system("convert tmp/16q3u1257954604.ps tmp/16q3u1257954604.png") > system("convert tmp/2npu71257954604.ps tmp/2npu71257954604.png") > system("convert tmp/3pq5i1257954604.ps tmp/3pq5i1257954604.png") > system("convert tmp/4eoxt1257954604.ps tmp/4eoxt1257954604.png") > system("convert tmp/58mcr1257954604.ps tmp/58mcr1257954604.png") > > > proc.time() user system elapsed 1.702 1.258 2.102