R version 2.8.1 (2008-12-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(100.00,98.86,96.87,103.18,104.66,103.74,103.87,98.10,98.91,109.43,104.89,88.63,97.03,93.79,97.61,98.17,96.31,97.82,87.52,85.71,89.15,90.65,92.74,80.00,84.33,93.26,115.89,105.21,94.23,106.12,94.41,101.30,98.43,107.94,102.82,92.33,97.48,88.37,92.50,81.48,92.55,98.96,77.28,91.01,81.21,88.41,96.02,91.59,86.30,86.37,105.41,76.73,93.26,95.02,84.32,93.24,89.81,111.66,103.23,103.21) > #'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.2378738 -0.2378239 -0.2377737 -0.2377234 -0.2376730 -0.2376224 [7] -0.2375717 -0.2375208 -0.2374697 -0.2374185 -0.2373672 -0.2373157 [13] -0.2372640 -0.2372122 -0.2371603 -0.2371082 -0.2370559 -0.2370035 [19] -0.2369509 -0.2368982 -0.2368453 -0.2367923 -0.2367391 -0.2366858 [25] -0.2366323 -0.2365787 -0.2365249 -0.2364709 -0.2364168 -0.2363626 [31] -0.2363082 -0.2362537 -0.2361990 -0.2361441 -0.2360891 -0.2360340 [37] -0.2359786 -0.2359232 -0.2358676 -0.2358118 -0.2357559 -0.2356998 [43] -0.2356436 -0.2355872 -0.2355307 -0.2354740 -0.2354172 -0.2353602 [49] -0.2353031 -0.2352458 -0.2351884 -0.2351308 -0.2350730 -0.2350151 [55] -0.2349571 -0.2348989 -0.2348406 -0.2347821 -0.2347234 -0.2346646 [61] -0.2346057 -0.2345465 -0.2344873 -0.2344279 -0.2343683 -0.2343086 [67] -0.2342487 -0.2341887 -0.2341286 -0.2340682 -0.2340078 -0.2339472 [73] -0.2338864 -0.2338255 -0.2337644 -0.2337032 -0.2336418 -0.2335803 [79] -0.2335186 -0.2334567 -0.2333948 -0.2333326 -0.2332704 -0.2332079 [85] -0.2331453 -0.2330826 -0.2330197 -0.2329567 -0.2328935 -0.2328301 [91] -0.2327667 -0.2327030 -0.2326392 -0.2325753 -0.2325112 -0.2324469 [97] -0.2323826 -0.2323180 -0.2322533 -0.2321885 -0.2321235 -0.2320583 [103] -0.2319930 -0.2319276 -0.2318620 -0.2317963 -0.2317304 -0.2316643 [109] -0.2315981 -0.2315318 -0.2314653 -0.2313986 -0.2313319 -0.2312649 [115] -0.2311978 -0.2311306 -0.2310632 -0.2309956 -0.2309280 -0.2308601 [121] -0.2307921 -0.2307240 -0.2306557 -0.2305873 -0.2305187 -0.2304500 [127] -0.2303811 -0.2303120 -0.2302429 -0.2301735 -0.2301041 -0.2300344 [133] -0.2299647 -0.2298947 -0.2298247 -0.2297545 -0.2296841 -0.2296136 [139] -0.2295429 -0.2294721 -0.2294011 -0.2293300 -0.2292588 -0.2291874 [145] -0.2291158 -0.2290441 -0.2289723 -0.2289003 -0.2288282 -0.2287559 [151] -0.2286834 -0.2286109 -0.2285381 -0.2284653 -0.2283922 -0.2283191 [157] -0.2282458 -0.2281723 -0.2280987 -0.2280249 -0.2279510 -0.2278770 [163] -0.2278028 -0.2277285 -0.2276540 -0.2275793 -0.2275046 -0.2274296 [169] -0.2273546 -0.2272794 -0.2272040 -0.2271285 -0.2270528 -0.2269770 [175] -0.2269011 -0.2268250 -0.2267488 -0.2266724 -0.2265959 -0.2265192 [181] -0.2264424 -0.2263654 -0.2262883 -0.2262111 -0.2261337 -0.2260562 [187] -0.2259785 -0.2259007 -0.2258227 -0.2257446 -0.2256663 -0.2255879 [193] -0.2255094 -0.2254307 -0.2253519 -0.2252729 -0.2251938 -0.2251145 [199] -0.2250351 -0.2249556 -0.2248759 -0.2247961 -0.2247161 -0.2246360 [205] -0.2245557 -0.2244753 -0.2243948 -0.2243141 -0.2242333 -0.2241523 [211] -0.2240712 -0.2239900 -0.2239086 -0.2238270 -0.2237454 -0.2236635 [217] -0.2235816 -0.2234995 -0.2234172 -0.2233349 -0.2232523 -0.2231697 [223] -0.2230869 -0.2230039 -0.2229208 -0.2228376 -0.2227543 -0.2226707 [229] -0.2225871 -0.2225033 -0.2224194 -0.2223353 -0.2222511 -0.2221668 [235] -0.2220823 -0.2219977 -0.2219129 -0.2218280 -0.2217430 -0.2216578 [241] -0.2215725 -0.2214870 -0.2214015 -0.2213157 -0.2212299 -0.2211439 [247] -0.2210577 -0.2209714 -0.2208850 -0.2207985 -0.2207118 -0.2206249 [253] -0.2205380 -0.2204509 -0.2203636 -0.2202762 -0.2201887 -0.2201011 [259] -0.2200133 -0.2199254 -0.2198373 -0.2197491 -0.2196608 -0.2195723 [265] -0.2194837 -0.2193950 -0.2193061 -0.2192171 -0.2191280 -0.2190387 [271] -0.2189493 -0.2188597 -0.2187701 -0.2186802 -0.2185903 -0.2185002 [277] -0.2184100 -0.2183196 -0.2182292 -0.2181385 -0.2180478 -0.2179569 [283] -0.2178659 -0.2177747 -0.2176835 -0.2175920 -0.2175005 -0.2174088 [289] -0.2173170 -0.2172251 -0.2171330 -0.2170408 -0.2169484 -0.2168560 [295] -0.2167633 -0.2166706 -0.2165777 -0.2164848 -0.2163916 -0.2162984 [301] -0.2162050 -0.2161115 -0.2160178 -0.2159240 -0.2158301 -0.2157361 [307] -0.2156419 -0.2155476 -0.2154532 -0.2153586 -0.2152639 -0.2151691 [313] -0.2150742 -0.2149791 -0.2148839 -0.2147886 -0.2146931 -0.2145975 [319] -0.2145018 -0.2144060 -0.2143100 -0.2142139 -0.2141177 -0.2140213 [325] -0.2139249 -0.2138282 -0.2137315 -0.2136347 -0.2135377 -0.2134406 [331] -0.2133433 -0.2132460 -0.2131485 -0.2130509 -0.2129531 -0.2128553 [337] -0.2127573 -0.2126592 -0.2125609 -0.2124626 -0.2123641 -0.2122655 [343] -0.2121667 -0.2120679 -0.2119689 -0.2118698 -0.2117705 -0.2116712 [349] -0.2115717 -0.2114721 -0.2113724 -0.2112725 -0.2111726 -0.2110725 [355] -0.2109723 -0.2108719 -0.2107715 -0.2106709 -0.2105702 -0.2104694 [361] -0.2103684 -0.2102674 -0.2101662 -0.2100649 -0.2099635 -0.2098619 [367] -0.2097603 -0.2096585 -0.2095566 -0.2094545 -0.2093524 -0.2092501 [373] -0.2091478 -0.2090453 -0.2089426 -0.2088399 -0.2087370 -0.2086341 [379] -0.2085310 -0.2084278 -0.2083244 -0.2082210 -0.2081174 -0.2080137 [385] -0.2079100 -0.2078060 -0.2077020 -0.2075979 -0.2074936 -0.2073892 [391] -0.2072847 -0.2071801 -0.2070754 -0.2069705 -0.2068656 -0.2067605 [397] -0.2066553 -0.2065500 -0.2064446 -0.2063391 -0.2062334 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1nubu1257952195.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/rcomp/tmp/2yiro1257952195.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/rcomp/tmp/3qohm1257952195.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/rcomp/tmp/4yjnq1257952195.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/rcomp/tmp/5i91p1257952195.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6br9y1257952195.tab") > > system("convert tmp/1nubu1257952195.ps tmp/1nubu1257952195.png") > system("convert tmp/2yiro1257952195.ps tmp/2yiro1257952195.png") > system("convert tmp/3qohm1257952195.ps tmp/3qohm1257952195.png") > system("convert tmp/4yjnq1257952195.ps tmp/4yjnq1257952195.png") > system("convert tmp/5i91p1257952195.ps tmp/5i91p1257952195.png") > > > proc.time() user system elapsed 1.350 1.240 2.274