R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(255 + ,280.2 + ,299.9 + ,339.2 + ,374.2 + ,393.5 + ,389.2 + ,381.7 + ,375.2 + ,369 + ,357.4 + ,352.1 + ,346.5 + ,342.9 + ,340.3 + ,328.3 + ,322.9 + ,314.3 + ,308.9 + ,294 + ,285.6 + ,281.2 + ,280.3 + ,278.8 + ,274.5 + ,270.4 + ,263.4 + ,259.9 + ,258 + ,262.7 + ,284.7 + ,311.3 + ,322.1 + ,327 + ,331.3 + ,333.3 + ,321.4 + ,327 + ,320 + ,314.7 + ,316.7 + ,314.4 + ,321.3 + ,318.2 + ,307.2 + ,301.3 + ,287.5 + ,277.7 + ,274.4 + ,258.8 + ,253.3 + ,251 + ,248.4 + ,249.5 + ,246.1 + ,244.5 + ,243.6 + ,244 + ,240.8 + ,249.8 + ,248 + ,259.4 + ,260.5 + ,260.8 + ,261.3 + ,259.5 + ,256.6 + ,257.9 + ,256.5 + ,254.2 + ,253.3 + ,253.8 + ,255.5 + ,257.1 + ,257.3 + ,253.2 + ,252.8 + ,252 + ,250.7 + ,252.2 + ,250 + ,251 + ,253.4 + ,251.2 + ,255.6 + ,261.1 + ,258.9 + ,259.9 + ,261.2 + ,264.7 + ,267.1 + ,266.4 + ,267.7 + ,268.6 + ,267.5 + ,268.5 + ,268.5 + ,270.5 + ,270.9 + ,270.1 + ,269.3 + ,269.8 + ,270.1 + ,264.9 + ,263.7 + ,264.8 + ,263.7 + ,255.9 + ,276.2 + ,360.1 + ,380.5 + ,373.7 + ,369.8 + ,366.6 + ,359.3 + ,345.8 + ,326.2 + ,324.5 + ,328.1 + ,327.5 + ,324.4 + ,316.5 + ,310.9 + ,301.5 + ,291.7 + ,290.4 + ,287.4 + ,277.7 + ,281.6 + ,288 + ,276 + ,272.9 + ,283 + ,283.3 + ,276.8 + ,284.5 + ,282.7 + ,281.2 + ,287.4 + ,283.1 + ,284 + ,285.5 + ,289.2 + ,292.5 + ,296.4 + ,305.2 + ,303.9 + ,311.5 + ,316.3 + ,316.7 + ,322.5 + ,317.1 + ,309.8 + ,303.8 + ,290.3 + ,293.7 + ,291.7 + ,296.5 + ,289.1 + ,288.5 + ,293.8 + ,297.7 + ,305.4 + ,302.7 + ,302.5 + ,303 + ,294.5 + ,294.1 + ,294.5 + ,297.1 + ,289.4 + ,292.4 + ,287.9 + ,286.6 + ,280.5 + ,272.4 + ,269.2 + ,270.6 + ,267.3 + ,262.5 + ,266.8 + ,268.8 + ,263.1 + ,261.2 + ,266 + ,262.5 + ,265.2 + ,261.3 + ,253.7 + ,249.2 + ,239.1 + ,236.4 + ,235.2 + ,245.2 + ,246.2 + ,247.7 + ,251.4 + ,253.3 + ,254.8 + ,250 + ,249.3 + ,241.5 + ,243.3 + ,248 + ,253 + ,252.9 + ,251.5 + ,251.6 + ,253.5 + ,259.8 + ,334.1 + ,448 + ,445.8 + ,445 + ,448.2 + ,438.2 + ,439.8 + ,423.4 + ,410.8 + ,408.4 + ,406.7 + ,405.9 + ,402.7 + ,405.1 + ,399.6 + ,386.5 + ,381.4 + ,375.2 + ,357.7 + ,359 + ,355 + ,352.7 + ,344.4 + ,343.8 + ,338 + ,339 + ,333.3 + ,334.4 + ,328.3 + ,330.7 + ,330 + ,331.6 + ,351.2 + ,389.4 + ,410.9 + ,442.8 + ,462.8 + ,466.9 + ,461.7 + ,439.2 + ,430.3 + ,416.1 + ,402.5 + ,397.3 + ,403.3 + ,395.9 + ,387.8 + ,378.6 + ,377.1 + ,370.4 + ,362 + ,350.3 + ,348.2 + ,344.6 + ,343.5 + ,342.8 + ,347.6 + ,346.6 + ,349.5 + ,342.1 + ,342 + ,342.8 + ,339.3 + ,348.2 + ,333.7 + ,334.7 + ,354 + ,367.7 + ,363.3 + ,358.4 + ,353.1 + ,343.1 + ,344.6 + ,344.4 + ,333.9 + ,331.7 + ,324.3 + ,321.2 + ,322.4 + ,321.7 + ,320.5 + ,312.8 + ,309.7 + ,315.6 + ,309.7 + ,304.6 + ,302.5 + ,301.5 + ,298.8 + ,291.3 + ,293.6 + ,294.6 + ,285.9 + ,297.6 + ,301.1 + ,293.8 + ,297.7 + ,292.9 + ,292.1 + ,287.2 + ,288.2 + ,283.8 + ,299.9 + ,292.4 + ,293.3 + ,300.8 + ,293.7 + ,293.1 + ,294.4 + ,292.1 + ,291.9 + ,282.5 + ,277.9 + ,287.5 + ,289.2 + ,285.6 + ,293.2 + ,290.8 + ,283.1 + ,275 + ,287.8 + ,287.8 + ,287.4 + ,284 + ,277.8 + ,277.6 + ,304.9 + ,294 + ,300.9 + ,324 + ,332.9 + ,341.6 + ,333.4 + ,348.2 + ,344.7 + ,344.7 + ,329.3 + ,323.5 + ,323.2 + ,317.4 + ,330.1 + ,329.2 + ,334.9 + ,315.8 + ,315.4 + ,319.6 + ,317.3 + ,313.8 + ,315.8 + ,311.3) > par3 = '2' > par2 = '-2' > par1 = 'Full Box-Cox transform' > par3 <- '2' > par2 <- '-2' > par1 <- 'Full Box-Cox transform' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Box-Cox Normality Plot (v1.1.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par2 <- abs(as.numeric(par2)*100) > par3 <- as.numeric(par3)*100 > numlam <- par2 + par3 + 1 > n <- length(x) > c <- array(NA,dim=c(numlam)) > l <- array(NA,dim=c(numlam)) > mx <- 0 > mxli <- -999 > for (i in 1:numlam) + { + l[i] <- (i-par2-1)/100 + if (l[i] != 0) + { + if (par1 == 'Full Box-Cox transform') x1 <- (x^l[i] - 1) / l[i] + if (par1 == 'Simple Box-Cox transform') x1 <- x^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.2576537 0.2575324 0.2574109 0.2572891 0.2571670 0.2570447 0.2569221 [8] 0.2567993 0.2566763 0.2565530 0.2564295 0.2563057 0.2561816 0.2560573 [15] 0.2559328 0.2558080 0.2556829 0.2555577 0.2554321 0.2553063 0.2551803 [22] 0.2550540 0.2549275 0.2548007 0.2546737 0.2545465 0.2544190 0.2542912 [29] 0.2541632 0.2540350 0.2539065 0.2537777 0.2536488 0.2535195 0.2533901 [36] 0.2532604 0.2531304 0.2530002 0.2528698 0.2527391 0.2526082 0.2524770 [43] 0.2523456 0.2522139 0.2520820 0.2519499 0.2518175 0.2516849 0.2515520 [50] 0.2514189 0.2512856 0.2511520 0.2510182 0.2508841 0.2507499 0.2506153 [57] 0.2504805 0.2503455 0.2502103 0.2500748 0.2499391 0.2498031 0.2496669 [64] 0.2495305 0.2493938 0.2492569 0.2491198 0.2489824 0.2488448 0.2487069 [71] 0.2485688 0.2484305 0.2482920 0.2481532 0.2480142 0.2478749 0.2477354 [78] 0.2475957 0.2474558 0.2473156 0.2471752 0.2470346 0.2468937 0.2467526 [85] 0.2466113 0.2464697 0.2463279 0.2461859 0.2460437 0.2459012 0.2457585 [92] 0.2456156 0.2454725 0.2453291 0.2451855 0.2450416 0.2448976 0.2447533 [99] 0.2446088 0.2444641 0.2443191 0.2441740 0.2440286 0.2438830 0.2437371 [106] 0.2435911 0.2434448 0.2432983 0.2431515 0.2430046 0.2428574 0.2427100 [113] 0.2425624 0.2424146 0.2422666 0.2421183 0.2419699 0.2418212 0.2416723 [120] 0.2415231 0.2413738 0.2412243 0.2410745 0.2409245 0.2407743 0.2406239 [127] 0.2404733 0.2403225 0.2401714 0.2400202 0.2398687 0.2397170 0.2395651 [134] 0.2394130 0.2392607 0.2391082 0.2389555 0.2388026 0.2386495 0.2384961 [141] 0.2383426 0.2381888 0.2380349 0.2378807 0.2377263 0.2375718 0.2374170 [148] 0.2372620 0.2371068 0.2369515 0.2367959 0.2366401 0.2364841 0.2363279 [155] 0.2361716 0.2360150 0.2358582 0.2357012 0.2355441 0.2353867 0.2352292 [162] 0.2350714 0.2349135 0.2347553 0.2345970 0.2344384 0.2342797 0.2341208 [169] 0.2339617 0.2338024 0.2336429 0.2334833 0.2333234 0.2331633 0.2330031 [176] 0.2328427 0.2326821 0.2325213 0.2323603 0.2321991 0.2320377 0.2318762 [183] 0.2317145 0.2315526 0.2313905 0.2312282 0.2310658 0.2309032 0.2307403 [190] 0.2305774 0.2304142 0.2302509 0.2300873 0.2299236 0.2297598 0.2295957 [197] 0.2294315 0.2292671 0.2291025 0.2289378 0.2287729 0.2286078 0.2284425 [204] 0.2282771 0.2281115 0.2279458 0.2277798 0.2276137 0.2274475 0.2272810 [211] 0.2271144 0.2269477 0.2267807 0.2266137 0.2264464 0.2262790 0.2261114 [218] 0.2259437 0.2257758 0.2256077 0.2254395 0.2252711 0.2251026 0.2249339 [225] 0.2247651 0.2245961 0.2244269 0.2242576 0.2240882 0.2239186 0.2237488 [232] 0.2235789 0.2234088 0.2232386 0.2230682 0.2228977 0.2227271 0.2225563 [239] 0.2223853 0.2222142 0.2220430 0.2218716 0.2217001 0.2215284 0.2213566 [246] 0.2211846 0.2210125 0.2208403 0.2206679 0.2204954 0.2203228 0.2201500 [253] 0.2199771 0.2198040 0.2196308 0.2194575 0.2192841 0.2191105 0.2189368 [260] 0.2187629 0.2185890 0.2184149 0.2182406 0.2180663 0.2178918 0.2177172 [267] 0.2175424 0.2173676 0.2171926 0.2170175 0.2168423 0.2166669 0.2164914 [274] 0.2163159 0.2161402 0.2159643 0.2157884 0.2156123 0.2154362 0.2152599 [281] 0.2150835 0.2149070 0.2147303 0.2145536 0.2143768 0.2141998 0.2140227 [288] 0.2138456 0.2136683 0.2134909 0.2133134 0.2131358 0.2129581 0.2127803 [295] 0.2126024 0.2124244 0.2122463 0.2120681 0.2118898 0.2117114 0.2115329 [302] 0.2113543 0.2111756 0.2109968 0.2108179 0.2106390 0.2104599 0.2102807 [309] 0.2101015 0.2099222 0.2097427 0.2095632 0.2093836 0.2092039 0.2090242 [316] 0.2088443 0.2086644 0.2084843 0.2083042 0.2081241 0.2079438 0.2077634 [323] 0.2075830 0.2074025 0.2072220 0.2070413 0.2068606 0.2066798 0.2064989 [330] 0.2063180 0.2061369 0.2059559 0.2057747 0.2055935 0.2054122 0.2052308 [337] 0.2050494 0.2048679 0.2046864 0.2045047 0.2043231 0.2041413 0.2039595 [344] 0.2037776 0.2035957 0.2034137 0.2032317 0.2030496 0.2028675 0.2026853 [351] 0.2025030 0.2023207 0.2021384 0.2019559 0.2017735 0.2015910 0.2014084 [358] 0.2012258 0.2010432 0.2008605 0.2006777 0.2004949 0.2003121 0.2001292 [365] 0.1999463 0.1997634 0.1995804 0.1993974 0.1992143 0.1990312 0.1988481 [372] 0.1986649 0.1984817 0.1982985 0.1981152 0.1979319 0.1977486 0.1975652 [379] 0.1973819 0.1971984 0.1970150 0.1968315 0.1966481 0.1964646 0.1962810 [386] 0.1960975 0.1959139 0.1957303 0.1955467 0.1953631 0.1951794 0.1949957 [393] 0.1948121 0.1946284 0.1944447 0.1942610 0.1940772 0.1938935 0.1937097 [400] 0.1935260 0.1933422 > mx [1] 0.2576537 > mxli [1] -2 > if (mxli != 0) + { + if (par1 == 'Full Box-Cox transform') x1 <- (x^mxli - 1) / mxli + if (par1 == 'Simple Box-Cox transform') x1 <- x^mxli + } else { + x1 <- log(x) + } > postscript(file="/var/fisher/rcomp/tmp/13d291352832921.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/2mjyg1352832921.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/3zoy51352832921.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/4ql391352832921.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/5vktz1352832921.ps",horizontal=F,onefile=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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/696mh1352832921.tab") > > try(system("convert tmp/13d291352832921.ps tmp/13d291352832921.png",intern=TRUE)) character(0) > try(system("convert tmp/2mjyg1352832921.ps tmp/2mjyg1352832921.png",intern=TRUE)) character(0) > try(system("convert tmp/3zoy51352832921.ps tmp/3zoy51352832921.png",intern=TRUE)) character(0) > try(system("convert tmp/4ql391352832921.ps tmp/4ql391352832921.png",intern=TRUE)) character(0) > try(system("convert tmp/5vktz1352832921.ps tmp/5vktz1352832921.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.112 0.625 3.726