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(115.6,111.9,107,107.1,100.6,99.2,108.4,103,99.8,115,90.8,95.9,114.4,108.2,112.6,109.1,105,105,118.5,103.7,112.5,116.6,96.6,101.9,116.5,119.3,115.4,108.5,111.5,108.8,121.8,109.6,112.2,119.6,104.1,105.3,115,124.1,116.8,107.5,115.6,116.2,116.3,119,111.9,118.6,106.9,103.2,118.6,118.7,102.8,100.6,94.9,94.5,102.9,95.3,92.5,102.7,91.5,89.5) > #'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.2548471 -0.2546972 -0.2545473 -0.2543972 -0.2542471 -0.2540970 [7] -0.2539468 -0.2537965 -0.2536462 -0.2534958 -0.2533454 -0.2531949 [13] -0.2530443 -0.2528937 -0.2527430 -0.2525923 -0.2524415 -0.2522907 [19] -0.2521398 -0.2519888 -0.2518378 -0.2516867 -0.2515356 -0.2513844 [25] -0.2512332 -0.2510819 -0.2509305 -0.2507791 -0.2506277 -0.2504761 [31] -0.2503246 -0.2501729 -0.2500213 -0.2498695 -0.2497177 -0.2495659 [37] -0.2494140 -0.2492620 -0.2491100 -0.2489579 -0.2488058 -0.2486537 [43] -0.2485014 -0.2483492 -0.2481968 -0.2480444 -0.2478920 -0.2477395 [49] -0.2475870 -0.2474344 -0.2472817 -0.2471290 -0.2469763 -0.2468235 [55] -0.2466706 -0.2465177 -0.2463648 -0.2462118 -0.2460587 -0.2459056 [61] -0.2457524 -0.2455992 -0.2454459 -0.2452926 -0.2451393 -0.2449859 [67] -0.2448324 -0.2446789 -0.2445253 -0.2443717 -0.2442180 -0.2440643 [73] -0.2439106 -0.2437568 -0.2436029 -0.2434490 -0.2432950 -0.2431410 [79] -0.2429870 -0.2428329 -0.2426787 -0.2425246 -0.2423703 -0.2422160 [85] -0.2420617 -0.2419073 -0.2417529 -0.2415984 -0.2414439 -0.2412893 [91] -0.2411347 -0.2409800 -0.2408253 -0.2406706 -0.2405158 -0.2403609 [97] -0.2402060 -0.2400511 -0.2398961 -0.2397411 -0.2395860 -0.2394309 [103] -0.2392757 -0.2391205 -0.2389653 -0.2388100 -0.2386547 -0.2384993 [109] -0.2383439 -0.2381884 -0.2380329 -0.2378773 -0.2377217 -0.2375661 [115] -0.2374104 -0.2372547 -0.2370989 -0.2369431 -0.2367873 -0.2366314 [121] -0.2364755 -0.2363195 -0.2361635 -0.2360074 -0.2358513 -0.2356952 [127] -0.2355390 -0.2353828 -0.2352265 -0.2350702 -0.2349139 -0.2347575 [133] -0.2346011 -0.2344446 -0.2342881 -0.2341316 -0.2339750 -0.2338184 [139] -0.2336617 -0.2335050 -0.2333483 -0.2331915 -0.2330347 -0.2328778 [145] -0.2327210 -0.2325640 -0.2324071 -0.2322501 -0.2320930 -0.2319360 [151] -0.2317788 -0.2316217 -0.2314645 -0.2313073 -0.2311500 -0.2309927 [157] -0.2308354 -0.2306780 -0.2305206 -0.2303632 -0.2302057 -0.2300482 [163] -0.2298907 -0.2297331 -0.2295755 -0.2294178 -0.2292602 -0.2291024 [169] -0.2289447 -0.2287869 -0.2286291 -0.2284712 -0.2283134 -0.2281554 [175] -0.2279975 -0.2278395 -0.2276815 -0.2275234 -0.2273653 -0.2272072 [181] -0.2270491 -0.2268909 -0.2267327 -0.2265744 -0.2264162 -0.2262579 [187] -0.2260995 -0.2259411 -0.2257827 -0.2256243 -0.2254658 -0.2253074 [193] -0.2251488 -0.2249903 -0.2248317 -0.2246731 -0.2245144 -0.2243558 [199] -0.2241970 -0.2240383 -0.2238796 -0.2237208 -0.2235619 -0.2234031 [205] -0.2232442 -0.2230853 -0.2229264 -0.2227674 -0.2226084 -0.2224494 [211] -0.2222904 -0.2221313 -0.2219722 -0.2218131 -0.2216539 -0.2214947 [217] -0.2213355 -0.2211763 -0.2210170 -0.2208577 -0.2206984 -0.2205391 [223] -0.2203797 -0.2202203 -0.2200609 -0.2199015 -0.2197420 -0.2195825 [229] -0.2194230 -0.2192635 -0.2191039 -0.2189443 -0.2187847 -0.2186251 [235] -0.2184654 -0.2183057 -0.2181460 -0.2179863 -0.2178265 -0.2176668 [241] -0.2175070 -0.2173471 -0.2171873 -0.2170274 -0.2168675 -0.2167076 [247] -0.2165477 -0.2163877 -0.2162278 -0.2160678 -0.2159078 -0.2157477 [253] -0.2155877 -0.2154276 -0.2152675 -0.2151073 -0.2149472 -0.2147870 [259] -0.2146269 -0.2144666 -0.2143064 -0.2141462 -0.2139859 -0.2138256 [265] -0.2136653 -0.2135050 -0.2133447 -0.2131843 -0.2130239 -0.2128636 [271] -0.2127031 -0.2125427 -0.2123823 -0.2122218 -0.2120613 -0.2119008 [277] -0.2117403 -0.2115798 -0.2114192 -0.2112586 -0.2110981 -0.2109375 [283] -0.2107768 -0.2106162 -0.2104556 -0.2102949 -0.2101342 -0.2099735 [289] -0.2098128 -0.2096521 -0.2094913 -0.2093306 -0.2091698 -0.2090090 [295] -0.2088482 -0.2086874 -0.2085266 -0.2083657 -0.2082049 -0.2080440 [301] -0.2078831 -0.2077222 -0.2075613 -0.2074004 -0.2072395 -0.2070785 [307] -0.2069176 -0.2067566 -0.2065956 -0.2064346 -0.2062736 -0.2061126 [313] -0.2059515 -0.2057905 -0.2056294 -0.2054684 -0.2053073 -0.2051462 [319] -0.2049851 -0.2048240 -0.2046629 -0.2045018 -0.2043406 -0.2041795 [325] -0.2040183 -0.2038571 -0.2036960 -0.2035348 -0.2033736 -0.2032124 [331] -0.2030512 -0.2028899 -0.2027287 -0.2025675 -0.2024062 -0.2022450 [337] -0.2020837 -0.2019224 -0.2017612 -0.2015999 -0.2014386 -0.2012773 [343] -0.2011160 -0.2009546 -0.2007933 -0.2006320 -0.2004707 -0.2003093 [349] -0.2001480 -0.1999866 -0.1998253 -0.1996639 -0.1995025 -0.1993412 [355] -0.1991798 -0.1990184 -0.1988570 -0.1986956 -0.1985342 -0.1983728 [361] -0.1982114 -0.1980500 -0.1978886 -0.1977272 -0.1975657 -0.1974043 [367] -0.1972429 -0.1970815 -0.1969200 -0.1967586 -0.1965971 -0.1964357 [373] -0.1962742 -0.1961128 -0.1959514 -0.1957899 -0.1956284 -0.1954670 [379] -0.1953055 -0.1951441 -0.1949826 -0.1948212 -0.1946597 -0.1944982 [385] -0.1943368 -0.1941753 -0.1940138 -0.1938524 -0.1936909 -0.1935294 [391] -0.1933680 -0.1932065 -0.1930451 -0.1928836 -0.1927221 -0.1925607 [397] -0.1923992 -0.1922378 -0.1920763 -0.1919149 -0.1917534 > 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/1zjb91259348732.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/2f44k1259348732.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/3b0za1259348732.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/4184j1259348732.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/5145i1259348732.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/6itfp1259348732.tab") > > system("convert tmp/1zjb91259348732.ps tmp/1zjb91259348732.png") > system("convert tmp/2f44k1259348732.ps tmp/2f44k1259348732.png") > system("convert tmp/3b0za1259348732.ps tmp/3b0za1259348732.png") > system("convert tmp/4184j1259348732.ps tmp/4184j1259348732.png") > system("convert tmp/5145i1259348732.ps tmp/5145i1259348732.png") > > > proc.time() user system elapsed 1.055 0.770 1.267