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(2180995.35,2191117.36,2219483.98,2217992.79,2209675.04,2204327.56,2217758.16,2218743.78,2231760.73,2242745.96,2269344.45,2277708.79,2281332.03,2293500.47,2319792.57,2320736.3,2303874.92,2291488.94,2299751.72,2313222.41,2314078.67,2325555.72,2353668.83,2363959.25,2366135.5,2388164.24,2415043.36,2411619.15,2400100.64,2398536.15,2404054.33,2421077.9,2430396.04,2445739.91,2484702.11,2499887.85,2506371.6,2526847.52,2551947.88,2549403.15,2533567.74,2529577.21,2541049.08,2547421.64,2555613.49,2566290.53,2580919.67,2587978.57,2580098.72,2579086.96,2592127.5,2586944.73,2548600.43,2516994.05,2500125.23,2493360.56,2475571.42,2460157.93,2467502.24) > x <- c(24710.92,23983.59,24434.12,23939.23,24290.02,24117.63,23724.64,22989.44,23716.86,25058.83,25059,23579.18,24209.03,24173.67,24706.39,24522.12,24766.15,25940.04,24985.78,24788,26544.56,28019.08,27285.71,29161.16,28357.73,27979.91,27543.95,27397.53,27623.59,27736.07,27803.79,27779.55,27524.13,27582.72,28638.95,28825.78,30132.61,29326.85,29075.62,28230.63,28118.36,28173.29,27396.91,24578.55,24504.77,27582.37,26920.31,25426.68,25390.8,25041.16,22769.42,22921.89,26267.63,27364.67,28382.59,29132.81,28214.51,28865.73,24405.35) > #'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.4474254 0.4474673 0.4475091 0.4475509 0.4475924 0.4476340 0.4476755 [8] 0.4477169 0.4477581 0.4477993 0.4478404 0.4478814 0.4479224 0.4479632 [15] 0.4480040 0.4480447 0.4480853 0.4481257 0.4481662 0.4482065 0.4482467 [22] 0.4482869 0.4483270 0.4483669 0.4484068 0.4484466 0.4484863 0.4485260 [29] 0.4485655 0.4486050 0.4486443 0.4486836 0.4487228 0.4487619 0.4488010 [36] 0.4488399 0.4488787 0.4489175 0.4489562 0.4489948 0.4490333 0.4490717 [43] 0.4491100 0.4491483 0.4491864 0.4492245 0.4492625 0.4493004 0.4493382 [50] 0.4493759 0.4494135 0.4494511 0.4494886 0.4495259 0.4495632 0.4496004 [57] 0.4496375 0.4496746 0.4497115 0.4497484 0.4497852 0.4498218 0.4498584 [64] 0.4498950 0.4499314 0.4499677 0.4500040 0.4500401 0.4500762 0.4501122 [71] 0.4501481 0.4501840 0.4502197 0.4502553 0.4502909 0.4503264 0.4503618 [78] 0.4503971 0.4504323 0.4504674 0.4505025 0.4505374 0.4505723 0.4506071 [85] 0.4506418 0.4506764 0.4507110 0.4507454 0.4507798 0.4508141 0.4508482 [92] 0.4508823 0.4509164 0.4509503 0.4509841 0.4510179 0.4510516 0.4510852 [99] 0.4511187 0.4511521 0.4511854 0.4512187 0.4512518 0.4512849 0.4513179 [106] 0.4513508 0.4513836 0.4514163 0.4514490 0.4514815 0.4515140 0.4515464 [113] 0.4515787 0.4516109 0.4516431 0.4516751 0.4517071 0.4517390 0.4517708 [120] 0.4518025 0.4518341 0.4518656 0.4518971 0.4519284 0.4519597 0.4519909 [127] 0.4520220 0.4520531 0.4520840 0.4521149 0.4521456 0.4521763 0.4522069 [134] 0.4522374 0.4522679 0.4522982 0.4523285 0.4523586 0.4523887 0.4524187 [141] 0.4524487 0.4524785 0.4525082 0.4525379 0.4525675 0.4525970 0.4526264 [148] 0.4526557 0.4526850 0.4527141 0.4527432 0.4527722 0.4528011 0.4528299 [155] 0.4528587 0.4528873 0.4529159 0.4529443 0.4529727 0.4530011 0.4530293 [162] 0.4530574 0.4530855 0.4531135 0.4531414 0.4531692 0.4531969 0.4532245 [169] 0.4532521 0.4532795 0.4533069 0.4533342 0.4533614 0.4533886 0.4534156 [176] 0.4534426 0.4534695 0.4534963 0.4535230 0.4535496 0.4535761 0.4536026 [183] 0.4536290 0.4536553 0.4536815 0.4537076 0.4537336 0.4537596 0.4537855 [190] 0.4538112 0.4538369 0.4538626 0.4538881 0.4539136 0.4539389 0.4539642 [197] 0.4539894 0.4540145 0.4540396 0.4540645 0.4540894 0.4541142 0.4541389 [204] 0.4541635 0.4541880 0.4542125 0.4542368 0.4542611 0.4542853 0.4543094 [211] 0.4543335 0.4543574 0.4543813 0.4544051 0.4544288 0.4544524 0.4544759 [218] 0.4544994 0.4545227 0.4545460 0.4545692 0.4545923 0.4546154 0.4546383 [225] 0.4546612 0.4546840 0.4547067 0.4547293 0.4547518 0.4547743 0.4547967 [232] 0.4548189 0.4548412 0.4548633 0.4548853 0.4549073 0.4549291 0.4549509 [239] 0.4549726 0.4549943 0.4550158 0.4550373 0.4550587 0.4550800 0.4551012 [246] 0.4551223 0.4551433 0.4551643 0.4551852 0.4552060 0.4552267 0.4552474 [253] 0.4552679 0.4552884 0.4553088 0.4553291 0.4553493 0.4553694 0.4553895 [260] 0.4554095 0.4554294 0.4554492 0.4554689 0.4554886 0.4555081 0.4555276 [267] 0.4555470 0.4555664 0.4555856 0.4556048 0.4556238 0.4556428 0.4556617 [274] 0.4556806 0.4556993 0.4557180 0.4557366 0.4557551 0.4557735 0.4557919 [281] 0.4558101 0.4558283 0.4558464 0.4558644 0.4558823 0.4559002 0.4559180 [288] 0.4559356 0.4559533 0.4559708 0.4559882 0.4560056 0.4560229 0.4560401 [295] 0.4560572 0.4560742 0.4560912 0.4561081 0.4561249 0.4561416 0.4561582 [302] 0.4561748 0.4561912 0.4562076 0.4562239 0.4562402 0.4562563 0.4562724 [309] 0.4562884 0.4563043 0.4563201 0.4563358 0.4563515 0.4563671 0.4563826 [316] 0.4563980 0.4564133 0.4564286 0.4564438 0.4564589 0.4564739 0.4564888 [323] 0.4565037 0.4565185 0.4565331 0.4565478 0.4565623 0.4565768 0.4565911 [330] 0.4566054 0.4566196 0.4566338 0.4566478 0.4566618 0.4566757 0.4566895 [337] 0.4567032 0.4567169 0.4567305 0.4567439 0.4567574 0.4567707 0.4567839 [344] 0.4567971 0.4568102 0.4568232 0.4568361 0.4568490 0.4568618 0.4568745 [351] 0.4568871 0.4568996 0.4569121 0.4569244 0.4569367 0.4569490 0.4569611 [358] 0.4569731 0.4569851 0.4569970 0.4570088 0.4570206 0.4570322 0.4570438 [365] 0.4570553 0.4570667 0.4570781 0.4570893 0.4571005 0.4571116 0.4571227 [372] 0.4571336 0.4571445 0.4571553 0.4571660 0.4571766 0.4571871 0.4571976 [379] 0.4572080 0.4572183 0.4572286 0.4572387 0.4572488 0.4572588 0.4572687 [386] 0.4572786 0.4572883 0.4572980 0.4573076 0.4573171 0.4573266 0.4573360 [393] 0.4573452 0.4573545 0.4573636 0.4573727 0.4573816 0.4573905 0.4573994 [400] 0.4574081 0.4574168 > mx [1] 0.4574168 > mxli [1] 2 > 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/1g24s1257493038.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/2xvnb1257493038.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/3xg3r1257493038.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/4lagf1257493038.tab") > > system("convert tmp/1g24s1257493038.ps tmp/1g24s1257493038.png") > system("convert tmp/2xvnb1257493038.ps tmp/2xvnb1257493038.png") > system("convert tmp/3xg3r1257493038.ps tmp/3xg3r1257493038.png") > > > proc.time() user system elapsed 0.784 0.503 1.832