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. > y <- c(594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478,528,534,518,506,502,516,528,533,536,537,524,536,587,597,581,564,558) > x <- c(18004,17537,20366,22782,19169,13807,29743,25591,29096,26482,22405,27044,17970,18730,19684,19785,18479,10698,31956,29506,34506,27165,26736,23691,18157,17328,18205,20995,17382,9367,31124,26551,30651,25859,25100,25778,20418,18688,20424,24776,19814,12738,31566,30111,30019,31934,25826,26835,20205,17789,20520,22518,15572,11509,25447,24090,27786,26195,20516,22759,19028,16971,20036,22485,18730) > #'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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] -0.1386570 -0.1392188 -0.1397811 -0.1403441 -0.1409077 -0.1414719 [7] -0.1420366 -0.1426019 -0.1431677 -0.1437340 -0.1443008 -0.1448681 [13] -0.1454359 -0.1460042 -0.1465729 -0.1471420 -0.1477116 -0.1482815 [19] -0.1488518 -0.1494225 -0.1499936 -0.1505650 -0.1511367 -0.1517087 [25] -0.1522810 -0.1528536 -0.1534265 -0.1539996 -0.1545729 -0.1551465 [31] -0.1557203 -0.1562942 -0.1568683 -0.1574426 -0.1580170 -0.1585915 [37] -0.1591661 -0.1597408 -0.1603156 -0.1608904 -0.1614653 -0.1620402 [43] -0.1626151 -0.1631900 -0.1637648 -0.1643397 -0.1649144 -0.1654891 [49] -0.1660637 -0.1666382 -0.1672125 -0.1677867 -0.1683608 -0.1689347 [55] -0.1695083 -0.1700818 -0.1706551 -0.1712280 -0.1718008 -0.1723732 [61] -0.1729454 -0.1735173 -0.1740888 -0.1746600 -0.1752308 -0.1758012 [67] -0.1763713 -0.1769409 -0.1775101 -0.1780788 -0.1786471 -0.1792149 [73] -0.1797822 -0.1803490 -0.1809153 -0.1814810 -0.1820461 -0.1826107 [79] -0.1831747 -0.1837380 -0.1843008 -0.1848628 -0.1854242 -0.1859850 [85] -0.1865450 -0.1871043 -0.1876629 -0.1882207 -0.1887778 -0.1893340 [91] -0.1898895 -0.1904442 -0.1909980 -0.1915510 -0.1921031 -0.1926544 [97] -0.1932047 -0.1937542 -0.1943027 -0.1948503 -0.1953969 -0.1959425 [103] -0.1964871 -0.1970308 -0.1975734 -0.1981149 -0.1986554 -0.1991949 [109] -0.1997332 -0.2002705 -0.2008066 -0.2013416 -0.2018755 -0.2024082 [115] -0.2029397 -0.2034700 -0.2039992 -0.2045271 -0.2050537 -0.2055791 [121] -0.2061033 -0.2066261 -0.2071477 -0.2076680 -0.2081869 -0.2087045 [127] -0.2092208 -0.2097356 -0.2102492 -0.2107613 -0.2112720 -0.2117813 [133] -0.2122891 -0.2127955 -0.2133005 -0.2138040 -0.2143060 -0.2148064 [139] -0.2153054 -0.2158029 -0.2162988 -0.2167932 -0.2172860 -0.2177772 [145] -0.2182669 -0.2187549 -0.2192413 -0.2197262 -0.2202093 -0.2206909 [151] -0.2211708 -0.2216490 -0.2221255 -0.2226004 -0.2230735 -0.2235449 [157] -0.2240146 -0.2244826 -0.2249488 -0.2254133 -0.2258760 -0.2263369 [163] -0.2267961 -0.2272534 -0.2277090 -0.2281627 -0.2286146 -0.2290647 [169] -0.2295129 -0.2299593 -0.2304038 -0.2308465 -0.2312873 -0.2317261 [175] -0.2321631 -0.2325982 -0.2330314 -0.2334626 -0.2338919 -0.2343193 [181] -0.2347448 -0.2351683 -0.2355898 -0.2360093 -0.2364269 -0.2368425 [187] -0.2372561 -0.2376678 -0.2380774 -0.2384850 -0.2388906 -0.2392942 [193] -0.2396957 -0.2400952 -0.2404927 -0.2408881 -0.2412815 -0.2416728 [199] -0.2420621 -0.2424493 -0.2428344 -0.2432174 -0.2435984 -0.2439772 [205] -0.2443540 -0.2447287 -0.2451013 -0.2454717 -0.2458401 -0.2462063 [211] -0.2465705 -0.2469325 -0.2472924 -0.2476501 -0.2480057 -0.2483592 [217] -0.2487106 -0.2490598 -0.2494068 -0.2497517 -0.2500945 -0.2504351 [223] -0.2507735 -0.2511098 -0.2514439 -0.2517759 -0.2521057 -0.2524333 [229] -0.2527588 -0.2530821 -0.2534032 -0.2537222 -0.2540389 -0.2543535 [235] -0.2546660 -0.2549762 -0.2552843 -0.2555901 -0.2558938 -0.2561954 [241] -0.2564947 -0.2567918 -0.2570868 -0.2573796 -0.2576702 -0.2579586 [247] -0.2582448 -0.2585289 -0.2588108 -0.2590904 -0.2593680 -0.2596433 [253] -0.2599164 -0.2601874 -0.2604562 -0.2607228 -0.2609872 -0.2612494 [259] -0.2615095 -0.2617674 -0.2620231 -0.2622767 -0.2625281 -0.2627773 [265] -0.2630244 -0.2632692 -0.2635120 -0.2637525 -0.2639909 -0.2642272 [271] -0.2644613 -0.2646932 -0.2649230 -0.2651507 -0.2653762 -0.2655996 [277] -0.2658208 -0.2660399 -0.2662568 -0.2664716 -0.2666843 -0.2668949 [283] -0.2671034 -0.2673097 -0.2675139 -0.2677160 -0.2679160 -0.2681139 [289] -0.2683097 -0.2685034 -0.2686950 -0.2688845 -0.2690719 -0.2692573 [295] -0.2694405 -0.2696217 -0.2698008 -0.2699778 -0.2701528 -0.2703257 [301] -0.2704966 -0.2706654 -0.2708322 -0.2709969 -0.2711596 -0.2713203 [307] -0.2714789 -0.2716355 -0.2717901 -0.2719427 -0.2720932 -0.2722418 [313] -0.2723883 -0.2725329 -0.2726754 -0.2728160 -0.2729546 -0.2730912 [319] -0.2732259 -0.2733586 -0.2734893 -0.2736181 -0.2737449 -0.2738698 [325] -0.2739927 -0.2741137 -0.2742328 -0.2743499 -0.2744651 -0.2745784 [331] -0.2746898 -0.2747993 -0.2749069 -0.2750126 -0.2751165 -0.2752184 [337] -0.2753185 -0.2754167 -0.2755130 -0.2756075 -0.2757001 -0.2757909 [343] -0.2758798 -0.2759669 -0.2760522 -0.2761357 -0.2762173 -0.2762971 [349] -0.2763751 -0.2764514 -0.2765258 -0.2765984 -0.2766693 -0.2767384 [355] -0.2768057 -0.2768712 -0.2769350 -0.2769970 -0.2770573 -0.2771159 [361] -0.2771727 -0.2772278 -0.2772811 -0.2773328 -0.2773827 -0.2774310 [367] -0.2774775 -0.2775224 -0.2775655 -0.2776070 -0.2776468 -0.2776850 [373] -0.2777215 -0.2777563 -0.2777895 -0.2778210 -0.2778509 -0.2778792 [379] -0.2779059 -0.2779309 -0.2779544 -0.2779762 -0.2779964 -0.2780151 [385] -0.2780321 -0.2780476 -0.2780615 -0.2780738 -0.2780846 -0.2780938 [391] -0.2781015 -0.2781077 -0.2781123 -0.2781153 -0.2781169 -0.2781169 [397] -0.2781154 -0.2781124 -0.2781080 -0.2781020 -0.2780945 > mx [1] 0.2781169 > mxli [1] 1.95 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > r<-lm(y~x) > se <- sqrt(var(r$residuals)) > r1 <- lm(y~x1) > se1 <- sqrt(var(r1$residuals)) > postscript(file="/var/www/html/rcomp/tmp/1olcz1261323204.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2vpfy1261323204.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') > abline(r) > grid() > mtext(paste('Residual Standard Deviation = ',se)) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3iksu1261323204.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') > abline(r1) > grid() > mtext(paste('Residual Standard Deviation = ',se1)) > 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 Linearity 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(x)',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (orginial)',header=TRUE) > a<-table.element(a,se) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (transformed)',header=TRUE) > a<-table.element(a,se1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/4kljk1261323204.tab") > > try(system("convert tmp/1olcz1261323204.ps tmp/1olcz1261323204.png",intern=TRUE)) character(0) > try(system("convert tmp/2vpfy1261323204.ps tmp/2vpfy1261323204.png",intern=TRUE)) character(0) > try(system("convert tmp/3iksu1261323204.ps tmp/3iksu1261323204.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.743 0.477 0.928