R version 2.7.2 (2008-08-25) 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. > y <- c(392,394,392,396,392,396,419,421,420,418,410,418,426,428,430,424,423,427,441,449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397) > x <- c(127,123,118,114,108,111,151,159,158,148,138,137,136,133,126,120,114,116,153,162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109) > #'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.5605655 0.5605438 0.5605214 0.5604984 0.5604747 0.5604505 0.5604256 [8] 0.5604001 0.5603739 0.5603471 0.5603197 0.5602917 0.5602631 0.5602338 [15] 0.5602039 0.5601734 0.5601422 0.5601104 0.5600780 0.5600450 0.5600113 [22] 0.5599770 0.5599421 0.5599066 0.5598705 0.5598337 0.5597963 0.5597583 [29] 0.5597196 0.5596803 0.5596404 0.5595999 0.5595588 0.5595170 0.5594746 [36] 0.5594316 0.5593880 0.5593438 0.5592989 0.5592534 0.5592073 0.5591606 [43] 0.5591133 0.5590653 0.5590167 0.5589675 0.5589177 0.5588673 0.5588163 [50] 0.5587646 0.5587123 0.5586594 0.5586059 0.5585518 0.5584971 0.5584417 [57] 0.5583858 0.5583292 0.5582720 0.5582142 0.5581558 0.5580968 0.5580372 [64] 0.5579769 0.5579161 0.5578547 0.5577926 0.5577299 0.5576667 0.5576028 [71] 0.5575383 0.5574732 0.5574075 0.5573412 0.5572743 0.5572068 0.5571387 [78] 0.5570700 0.5570007 0.5569308 0.5568603 0.5567892 0.5567175 0.5566452 [85] 0.5565724 0.5564989 0.5564248 0.5563501 0.5562748 0.5561990 0.5561225 [92] 0.5560455 0.5559679 0.5558896 0.5558108 0.5557314 0.5556514 0.5555708 [99] 0.5554897 0.5554079 0.5553256 0.5552427 0.5551592 0.5550751 0.5549905 [106] 0.5549052 0.5548194 0.5547330 0.5546460 0.5545585 0.5544703 0.5543816 [113] 0.5542923 0.5542025 0.5541121 0.5540211 0.5539295 0.5538374 0.5537446 [120] 0.5536514 0.5535575 0.5534631 0.5533681 0.5532726 0.5531765 0.5530798 [127] 0.5529826 0.5528848 0.5527865 0.5526876 0.5525881 0.5524881 0.5523875 [134] 0.5522864 0.5521847 0.5520825 0.5519797 0.5518763 0.5517724 0.5516680 [141] 0.5515630 0.5514575 0.5513514 0.5512448 0.5511376 0.5510299 0.5509217 [148] 0.5508129 0.5507036 0.5505937 0.5504833 0.5503724 0.5502609 0.5501489 [155] 0.5500363 0.5499233 0.5498097 0.5496955 0.5495809 0.5494657 0.5493500 [162] 0.5492338 0.5491170 0.5489997 0.5488819 0.5487636 0.5486448 0.5485254 [169] 0.5484055 0.5482851 0.5481642 0.5480428 0.5479209 0.5477985 0.5476755 [176] 0.5475521 0.5474281 0.5473036 0.5471787 0.5470532 0.5469272 0.5468007 [183] 0.5466738 0.5465463 0.5464183 0.5462899 0.5461609 0.5460314 0.5459015 [190] 0.5457710 0.5456401 0.5455087 0.5453768 0.5452444 0.5451115 0.5449782 [197] 0.5448443 0.5447100 0.5445752 0.5444400 0.5443042 0.5441680 0.5440313 [204] 0.5438941 0.5437565 0.5436183 0.5434798 0.5433407 0.5432012 0.5430612 [211] 0.5429208 0.5427799 0.5426385 0.5424967 0.5423544 0.5422116 0.5420684 [218] 0.5419248 0.5417807 0.5416361 0.5414911 0.5413457 0.5411998 0.5410534 [225] 0.5409066 0.5407594 0.5406117 0.5404636 0.5403151 0.5401661 0.5400166 [232] 0.5398668 0.5397165 0.5395658 0.5394146 0.5392630 0.5391110 0.5389586 [239] 0.5388057 0.5386524 0.5384987 0.5383445 0.5381900 0.5380350 0.5378796 [246] 0.5377238 0.5375676 0.5374110 0.5372539 0.5370965 0.5369386 0.5367804 [253] 0.5366217 0.5364626 0.5363032 0.5361433 0.5359830 0.5358223 0.5356613 [260] 0.5354998 0.5353380 0.5351757 0.5350131 0.5348500 0.5346866 0.5345228 [267] 0.5343586 0.5341940 0.5340291 0.5338638 0.5336980 0.5335319 0.5333655 [274] 0.5331986 0.5330314 0.5328638 0.5326959 0.5325275 0.5323588 0.5321898 [281] 0.5320203 0.5318506 0.5316804 0.5315099 0.5313390 0.5311678 0.5309962 [288] 0.5308243 0.5306520 0.5304793 0.5303063 0.5301330 0.5299593 0.5297852 [295] 0.5296109 0.5294361 0.5292611 0.5290857 0.5289099 0.5287338 0.5285574 [302] 0.5283807 0.5282036 0.5280262 0.5278484 0.5276704 0.5274920 0.5273132 [309] 0.5271342 0.5269548 0.5267751 0.5265951 0.5264148 0.5262341 0.5260532 [316] 0.5258719 0.5256903 0.5255084 0.5253262 0.5251437 0.5249609 0.5247777 [323] 0.5245943 0.5244106 0.5242265 0.5240422 0.5238576 0.5236726 0.5234874 [330] 0.5233019 0.5231161 0.5229300 0.5227436 0.5225569 0.5223700 0.5221827 [337] 0.5219952 0.5218074 0.5216193 0.5214309 0.5212423 0.5210534 0.5208642 [344] 0.5206747 0.5204849 0.5202949 0.5201046 0.5199141 0.5197233 0.5195322 [351] 0.5193409 0.5191492 0.5189574 0.5187652 0.5185729 0.5183802 0.5181873 [358] 0.5179942 0.5178008 0.5176071 0.5174132 0.5172191 0.5170247 0.5168300 [365] 0.5166352 0.5164400 0.5162447 0.5160491 0.5158532 0.5156571 0.5154608 [372] 0.5152643 0.5150675 0.5148705 0.5146732 0.5144758 0.5142781 0.5140801 [379] 0.5138820 0.5136836 0.5134850 0.5132862 0.5130872 0.5128879 0.5126885 [386] 0.5124888 0.5122889 0.5120888 0.5118885 0.5116879 0.5114872 0.5112863 [393] 0.5110851 0.5108838 0.5106822 0.5104805 0.5102785 0.5100764 0.5098740 [400] 0.5096715 0.5094687 > mx [1] 0.5605655 > 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/freestat/rcomp/tmp/109k71226249791.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/freestat/rcomp/tmp/2nl551226249791.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/freestat/rcomp/tmp/3oimh1226249791.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/450jh1226249792.tab") > > system("convert tmp/109k71226249791.ps tmp/109k71226249791.png") > system("convert tmp/2nl551226249791.ps tmp/2nl551226249791.png") > system("convert tmp/3oimh1226249791.ps tmp/3oimh1226249791.png") > > > proc.time() user system elapsed 1.498 0.791 1.646