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(269645,267037,258113,262813,267413,267366,264777,258863,254844,254868,277267,285351,286602,283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710,295881) > #'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.2525237 -0.2524482 -0.2523611 -0.2522796 -0.2522000 -0.2521199 [7] -0.2520402 -0.2519586 -0.2518742 -0.2517935 -0.2517114 -0.2516322 [13] -0.2515478 -0.2514670 -0.2513844 -0.2513025 -0.2512204 -0.2511378 [19] -0.2510552 -0.2509722 -0.2508900 -0.2508072 -0.2507248 -0.2506414 [25] -0.2505586 -0.2504759 -0.2503927 -0.2503098 -0.2502265 -0.2501431 [31] -0.2500597 -0.2499762 -0.2498926 -0.2498089 -0.2497252 -0.2496415 [37] -0.2495575 -0.2494736 -0.2493895 -0.2493054 -0.2492212 -0.2491369 [43] -0.2490525 -0.2489681 -0.2488835 -0.2487990 -0.2487143 -0.2486295 [49] -0.2485447 -0.2484597 -0.2483747 -0.2482897 -0.2482045 -0.2481193 [55] -0.2480339 -0.2479485 -0.2478631 -0.2477775 -0.2476919 -0.2476062 [61] -0.2475204 -0.2474345 -0.2473486 -0.2472625 -0.2471764 -0.2470903 [67] -0.2470040 -0.2469177 -0.2468312 -0.2467448 -0.2466582 -0.2465715 [73] -0.2464848 -0.2463980 -0.2463111 -0.2462242 -0.2461371 -0.2460500 [79] -0.2459628 -0.2458756 -0.2457882 -0.2457008 -0.2456133 -0.2455257 [85] -0.2454381 -0.2453504 -0.2452626 -0.2451747 -0.2450867 -0.2449987 [91] -0.2449106 -0.2448224 -0.2447341 -0.2446458 -0.2445574 -0.2444689 [97] -0.2443803 -0.2442917 -0.2442030 -0.2441142 -0.2440253 -0.2439364 [103] -0.2438474 -0.2437583 -0.2436691 -0.2435799 -0.2434905 -0.2434012 [109] -0.2433117 -0.2432221 -0.2431325 -0.2430428 -0.2429531 -0.2428632 [115] -0.2427733 -0.2426833 -0.2425933 -0.2425031 -0.2424129 -0.2423226 [121] -0.2422323 -0.2421418 -0.2420513 -0.2419608 -0.2418701 -0.2417794 [127] -0.2416886 -0.2415977 -0.2415068 -0.2414157 -0.2413246 -0.2412335 [133] -0.2411422 -0.2410509 -0.2409595 -0.2408681 -0.2407765 -0.2406849 [139] -0.2405933 -0.2405015 -0.2404097 -0.2403178 -0.2402258 -0.2401338 [145] -0.2400417 -0.2399495 -0.2398573 -0.2397649 -0.2396725 -0.2395801 [151] -0.2394875 -0.2393949 -0.2393022 -0.2392095 -0.2391167 -0.2390238 [157] -0.2389308 -0.2388378 -0.2387447 -0.2386515 -0.2385582 -0.2384649 [163] -0.2383715 -0.2382781 -0.2381845 -0.2380909 -0.2379973 -0.2379035 [169] -0.2378097 -0.2377158 -0.2376219 -0.2375278 -0.2374338 -0.2373396 [175] -0.2372454 -0.2371511 -0.2370567 -0.2369623 -0.2368677 -0.2367732 [181] -0.2366785 -0.2365838 -0.2364890 -0.2363942 -0.2362992 -0.2362043 [187] -0.2361092 -0.2360141 -0.2359189 -0.2358236 -0.2357283 -0.2356329 [193] -0.2355374 -0.2354419 -0.2353463 -0.2352506 -0.2351548 -0.2350590 [199] -0.2349632 -0.2348672 -0.2347712 -0.2346751 -0.2345790 -0.2344828 [205] -0.2343865 -0.2342901 -0.2341937 -0.2340972 -0.2340007 -0.2339041 [211] -0.2338074 -0.2337107 -0.2336138 -0.2335170 -0.2334200 -0.2333230 [217] -0.2332259 -0.2331288 -0.2330316 -0.2329343 -0.2328370 -0.2327395 [223] -0.2326421 -0.2325445 -0.2324469 -0.2323493 -0.2322515 -0.2321537 [229] -0.2320559 -0.2319579 -0.2318599 -0.2317619 -0.2316637 -0.2315656 [235] -0.2314673 -0.2313690 -0.2312706 -0.2311722 -0.2310736 -0.2309751 [241] -0.2308764 -0.2307777 -0.2306790 -0.2305801 -0.2304812 -0.2303823 [247] -0.2302832 -0.2301842 -0.2300850 -0.2299858 -0.2298865 -0.2297872 [253] -0.2296878 -0.2295883 -0.2294888 -0.2293892 -0.2292895 -0.2291898 [259] -0.2290901 -0.2289902 -0.2288903 -0.2287903 -0.2286903 -0.2285902 [265] -0.2284901 -0.2283899 -0.2282896 -0.2281892 -0.2280888 -0.2279884 [271] -0.2278879 -0.2277873 -0.2276866 -0.2275859 -0.2274852 -0.2273843 [277] -0.2272834 -0.2271825 -0.2270815 -0.2269804 -0.2268793 -0.2267781 [283] -0.2266768 -0.2265755 -0.2264741 -0.2263727 -0.2262712 -0.2261697 [289] -0.2260680 -0.2259664 -0.2258646 -0.2257628 -0.2256610 -0.2255591 [295] -0.2254571 -0.2253551 -0.2252530 -0.2251508 -0.2250486 -0.2249464 [301] -0.2248440 -0.2247416 -0.2246392 -0.2245367 -0.2244341 -0.2243315 [307] -0.2242288 -0.2241261 -0.2240233 -0.2239204 -0.2238175 -0.2237146 [313] -0.2236115 -0.2235085 -0.2234053 -0.2233021 -0.2231989 -0.2230955 [319] -0.2229922 -0.2228887 -0.2227852 -0.2226817 -0.2225781 -0.2224744 [325] -0.2223707 -0.2222670 -0.2221631 -0.2220592 -0.2219553 -0.2218513 [331] -0.2217473 -0.2216431 -0.2215390 -0.2214348 -0.2213305 -0.2212261 [337] -0.2211217 -0.2210173 -0.2209128 -0.2208082 -0.2207036 -0.2205990 [343] -0.2204942 -0.2203895 -0.2202846 -0.2201797 -0.2200748 -0.2199698 [349] -0.2198648 -0.2197596 -0.2196545 -0.2195493 -0.2194440 -0.2193387 [355] -0.2192333 -0.2191279 -0.2190224 -0.2189168 -0.2188112 -0.2187056 [361] -0.2185999 -0.2184941 -0.2183883 -0.2182825 -0.2181765 -0.2180706 [367] -0.2179646 -0.2178585 -0.2177524 -0.2176462 -0.2175399 -0.2174337 [373] -0.2173273 -0.2172209 -0.2171145 -0.2170080 -0.2169014 -0.2167948 [379] -0.2166882 -0.2165815 -0.2164747 -0.2163679 -0.2162610 -0.2161541 [385] -0.2160472 -0.2159402 -0.2158331 -0.2157260 -0.2156188 -0.2155116 [391] -0.2154043 -0.2152970 -0.2151896 -0.2150822 -0.2149747 -0.2148672 [397] -0.2147596 -0.2146520 -0.2145443 -0.2144366 -0.2143288 > 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/1id7h1257905991.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/2rqo01257905991.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/3qomw1257905991.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/4g2ix1257905991.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/56jp81257905991.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/6hai71257905991.tab") > > system("convert tmp/1id7h1257905991.ps tmp/1id7h1257905991.png") > system("convert tmp/2rqo01257905991.ps tmp/2rqo01257905991.png") > system("convert tmp/3qomw1257905991.ps tmp/3qomw1257905991.png") > system("convert tmp/4g2ix1257905991.ps tmp/4g2ix1257905991.png") > system("convert tmp/56jp81257905991.ps tmp/56jp81257905991.png") > > > proc.time() user system elapsed 1.090 0.802 1.573