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(5.8,5.8,5.7,5.5,5.3,5.2,5.3,5.3,5.0,4.8,4.9,5.3,6.0,6.2,6.4,6.4,6.4,6.2,6.1,6.0,5.9,6.2,6.2,6.4,6.8,6.9,7.0,7.0,6.9,6.7,6.6,6.5,6.4,6.5,6.5,6.6,6.7,6.8,7.2,7.6,7.6,7.3,6.4,6.1,6.3,7.1,7.5,7.4,7.1,6.8,6.9,7.2,7.4,7.3,6.9,6.9,6.8,7.1,7.2,7.1,7.0,6.9,7.0,7.4,7.5,7.5,7.4,7.3,7.0,6.7,6.5,6.5,6.5,6.6,6.8,6.9,6.9,6.8,6.8,6.5,6.1,6.0,5.9,5.8,5.9,5.9,6.2,6.3,6.2,6.0,5.8,5.5,5.5,5.7,5.8,5.7) > #'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.2439695 0.2438406 0.2437117 0.2435828 0.2434538 0.2433248 0.2431957 [8] 0.2430666 0.2429374 0.2428082 0.2426789 0.2425496 0.2424203 0.2422909 [15] 0.2421614 0.2420319 0.2419024 0.2417728 0.2416432 0.2415136 0.2413839 [22] 0.2412541 0.2411244 0.2409945 0.2408647 0.2407348 0.2406048 0.2404749 [29] 0.2403448 0.2402148 0.2400847 0.2399546 0.2398244 0.2396942 0.2395639 [36] 0.2394337 0.2393034 0.2391730 0.2390426 0.2389122 0.2387817 0.2386512 [43] 0.2385207 0.2383902 0.2382596 0.2381289 0.2379983 0.2378676 0.2377369 [50] 0.2376061 0.2374753 0.2373445 0.2372137 0.2370828 0.2369519 0.2368210 [57] 0.2366900 0.2365590 0.2364280 0.2362969 0.2361658 0.2360347 0.2359036 [64] 0.2357724 0.2356413 0.2355100 0.2353788 0.2352475 0.2351162 0.2349849 [71] 0.2348536 0.2347222 0.2345908 0.2344594 0.2343280 0.2341965 0.2340651 [78] 0.2339336 0.2338020 0.2336705 0.2335389 0.2334073 0.2332757 0.2331441 [85] 0.2330125 0.2328808 0.2327491 0.2326174 0.2324857 0.2323539 0.2322222 [92] 0.2320904 0.2319586 0.2318268 0.2316950 0.2315631 0.2314313 0.2312994 [99] 0.2311675 0.2310356 0.2309037 0.2307717 0.2306398 0.2305078 0.2303759 [106] 0.2302439 0.2301119 0.2299799 0.2298478 0.2297158 0.2295838 0.2294517 [113] 0.2293196 0.2291876 0.2290555 0.2289234 0.2287913 0.2286592 0.2285270 [120] 0.2283949 0.2282628 0.2281306 0.2279985 0.2278663 0.2277341 0.2276020 [127] 0.2274698 0.2273376 0.2272054 0.2270732 0.2269410 0.2268088 0.2266766 [134] 0.2265444 0.2264122 0.2262800 0.2261477 0.2260155 0.2258833 0.2257511 [141] 0.2256188 0.2254866 0.2253544 0.2252221 0.2250899 0.2249577 0.2248254 [148] 0.2246932 0.2245610 0.2244288 0.2242965 0.2241643 0.2240321 0.2238999 [155] 0.2237676 0.2236354 0.2235032 0.2233710 0.2232388 0.2231066 0.2229744 [162] 0.2228422 0.2227100 0.2225779 0.2224457 0.2223135 0.2221814 0.2220492 [169] 0.2219171 0.2217849 0.2216528 0.2215207 0.2213886 0.2212565 0.2211244 [176] 0.2209923 0.2208602 0.2207282 0.2205961 0.2204641 0.2203320 0.2202000 [183] 0.2200680 0.2199360 0.2198040 0.2196720 0.2195401 0.2194081 0.2192762 [190] 0.2191443 0.2190124 0.2188805 0.2187486 0.2186167 0.2184849 0.2183530 [197] 0.2182212 0.2180894 0.2179576 0.2178259 0.2176941 0.2175624 0.2174306 [204] 0.2172989 0.2171673 0.2170356 0.2169040 0.2167723 0.2166407 0.2165091 [211] 0.2163776 0.2162460 0.2161145 0.2159830 0.2158515 0.2157200 0.2155886 [218] 0.2154571 0.2153257 0.2151944 0.2150630 0.2149317 0.2148003 0.2146691 [225] 0.2145378 0.2144066 0.2142753 0.2141441 0.2140130 0.2138818 0.2137507 [232] 0.2136196 0.2134886 0.2133575 0.2132265 0.2130955 0.2129645 0.2128336 [239] 0.2127027 0.2125718 0.2124410 0.2123102 0.2121794 0.2120486 0.2119179 [246] 0.2117872 0.2116565 0.2115258 0.2113952 0.2112646 0.2111341 0.2110035 [253] 0.2108730 0.2107426 0.2106122 0.2104818 0.2103514 0.2102210 0.2100907 [260] 0.2099605 0.2098302 0.2097000 0.2095699 0.2094397 0.2093096 0.2091796 [267] 0.2090495 0.2089195 0.2087896 0.2086596 0.2085298 0.2083999 0.2082701 [274] 0.2081403 0.2080106 0.2078808 0.2077512 0.2076215 0.2074919 0.2073624 [281] 0.2072329 0.2071034 0.2069739 0.2068445 0.2067152 0.2065859 0.2064566 [288] 0.2063273 0.2061981 0.2060689 0.2059398 0.2058107 0.2056817 0.2055527 [295] 0.2054237 0.2052948 0.2051659 0.2050371 0.2049083 0.2047796 0.2046509 [302] 0.2045222 0.2043936 0.2042650 0.2041365 0.2040080 0.2038795 0.2037511 [309] 0.2036228 0.2034945 0.2033662 0.2032380 0.2031098 0.2029817 0.2028536 [316] 0.2027256 0.2025976 0.2024697 0.2023418 0.2022139 0.2020861 0.2019584 [323] 0.2018307 0.2017030 0.2015754 0.2014479 0.2013203 0.2011929 0.2010655 [330] 0.2009381 0.2008108 0.2006835 0.2005563 0.2004292 0.2003021 0.2001750 [337] 0.2000480 0.1999210 0.1997941 0.1996673 0.1995405 0.1994137 0.1992870 [344] 0.1991604 0.1990338 0.1989072 0.1987807 0.1986543 0.1985279 0.1984016 [351] 0.1982753 0.1981491 0.1980229 0.1978968 0.1977707 0.1976447 0.1975188 [358] 0.1973929 0.1972670 0.1971413 0.1970155 0.1968899 0.1967642 0.1966387 [365] 0.1965132 0.1963877 0.1962623 0.1961370 0.1960117 0.1958865 0.1957614 [372] 0.1956363 0.1955112 0.1953862 0.1952613 0.1951364 0.1950116 0.1948869 [379] 0.1947622 0.1946375 0.1945130 0.1943884 0.1942640 0.1941396 0.1940153 [386] 0.1938910 0.1937668 0.1936426 0.1935185 0.1933945 0.1932705 0.1931466 [393] 0.1930228 0.1928990 0.1927752 0.1926516 0.1925280 0.1924044 0.1922810 [400] 0.1921575 0.1920342 > mx [1] 0.2439695 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1yx1j1226505624.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/23dbi1226505625.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/3qzsn1226505625.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/4e2ab1226505625.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/5jbov1226505625.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/6pmma1226505625.tab") > > system("convert tmp/1yx1j1226505624.ps tmp/1yx1j1226505624.png") > system("convert tmp/23dbi1226505625.ps tmp/23dbi1226505625.png") > system("convert tmp/3qzsn1226505625.ps tmp/3qzsn1226505625.png") > system("convert tmp/4e2ab1226505625.ps tmp/4e2ab1226505625.png") > system("convert tmp/5jbov1226505625.ps tmp/5jbov1226505625.png") > > > proc.time() user system elapsed 2.445 1.348 2.629