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(10.574,10.653,10.805,10.872,10.625,10.407,10.463,10.556,10.646,10.702,11.353,11.346,11.451,11.964,12.574,13.031,13.812,14.544,14.931,14.886,16.005,17.064,15.168,16.050,15.839,15.137,14.954,15.648,15.305,15.579,16.348,15.928,16.171,15.937,15.713,15.594,15.683,16.438,17.032,17.696,17.745,19.394,20.148,20.108,18.584,18.441,18.391,19.178,18.079,18.483,19.644,19.195,19.650,20.830,23.595,22.937,21.814,21.928,21.777,21.383,21.467) > x <- c(1.2111,1.2409,1.2737,1.3295,1.3621,1.3035,1.3257,1.2964,1.2957,1.2331,1.2092,1.2093,1.2198,1.2042,1.2023,1.1769,1.1797,1.2118,1.1875,1.2104,1.2537,1.2868,1.2713,1.2767,1.2851,1.266,1.2696,1.32,1.317,1.2954,1.3211,1.3318,1.3605,1.3453,1.3505,1.3707,1.3705,1.4179,1.4447,1.4761,1.4721,1.487,1.5167,1.5812,1.554,1.5508,1.5764,1.5611,1.4735,1.4303,1.2757,1.2727,1.3917,1.2816,1.2644,1.3308,1.3275,1.4098,1.4134,1.4138,1.4272) > #'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.5588136 0.5587942 0.5587746 0.5587549 0.5587351 0.5587152 0.5586952 [8] 0.5586751 0.5586548 0.5586344 0.5586140 0.5585934 0.5585726 0.5585518 [15] 0.5585308 0.5585098 0.5584886 0.5584673 0.5584459 0.5584243 0.5584027 [22] 0.5583809 0.5583590 0.5583370 0.5583149 0.5582927 0.5582703 0.5582478 [29] 0.5582253 0.5582026 0.5581797 0.5581568 0.5581338 0.5581106 0.5580873 [36] 0.5580639 0.5580404 0.5580167 0.5579930 0.5579691 0.5579451 0.5579210 [43] 0.5578968 0.5578725 0.5578480 0.5578235 0.5577988 0.5577740 0.5577490 [50] 0.5577240 0.5576989 0.5576736 0.5576482 0.5576227 0.5575971 0.5575713 [57] 0.5575455 0.5575195 0.5574934 0.5574672 0.5574409 0.5574144 0.5573879 [64] 0.5573612 0.5573344 0.5573075 0.5572805 0.5572533 0.5572261 0.5571987 [71] 0.5571712 0.5571436 0.5571159 0.5570880 0.5570601 0.5570320 0.5570038 [78] 0.5569755 0.5569471 0.5569185 0.5568898 0.5568611 0.5568322 0.5568031 [85] 0.5567740 0.5567448 0.5567154 0.5566859 0.5566563 0.5566266 0.5565968 [92] 0.5565668 0.5565367 0.5565066 0.5564763 0.5564458 0.5564153 0.5563847 [99] 0.5563539 0.5563230 0.5562920 0.5562609 0.5562296 0.5561983 0.5561668 [106] 0.5561352 0.5561035 0.5560717 0.5560397 0.5560077 0.5559755 0.5559432 [113] 0.5559108 0.5558783 0.5558456 0.5558129 0.5557800 0.5557470 0.5557139 [120] 0.5556807 0.5556473 0.5556139 0.5555803 0.5555466 0.5555128 0.5554789 [127] 0.5554448 0.5554107 0.5553764 0.5553420 0.5553075 0.5552729 0.5552381 [134] 0.5552032 0.5551683 0.5551332 0.5550980 0.5550626 0.5550272 0.5549916 [141] 0.5549560 0.5549202 0.5548842 0.5548482 0.5548121 0.5547758 0.5547394 [148] 0.5547029 0.5546663 0.5546296 0.5545928 0.5545558 0.5545187 0.5544815 [155] 0.5544442 0.5544068 0.5543693 0.5543316 0.5542938 0.5542560 0.5542179 [162] 0.5541798 0.5541416 0.5541032 0.5540648 0.5540262 0.5539875 0.5539487 [169] 0.5539097 0.5538707 0.5538315 0.5537922 0.5537528 0.5537133 0.5536737 [176] 0.5536339 0.5535941 0.5535541 0.5535140 0.5534738 0.5534335 0.5533930 [183] 0.5533525 0.5533118 0.5532710 0.5532301 0.5531891 0.5531480 0.5531067 [190] 0.5530654 0.5530239 0.5529823 0.5529406 0.5528987 0.5528568 0.5528147 [197] 0.5527726 0.5527303 0.5526879 0.5526454 0.5526027 0.5525600 0.5525171 [204] 0.5524741 0.5524311 0.5523878 0.5523445 0.5523011 0.5522575 0.5522139 [211] 0.5521701 0.5521262 0.5520822 0.5520381 0.5519938 0.5519495 0.5519050 [218] 0.5518604 0.5518157 0.5517709 0.5517260 0.5516809 0.5516358 0.5515905 [225] 0.5515451 0.5514996 0.5514540 0.5514083 0.5513624 0.5513165 0.5512704 [232] 0.5512242 0.5511779 0.5511315 0.5510850 0.5510384 0.5509916 0.5509447 [239] 0.5508978 0.5508507 0.5508035 0.5507562 0.5507087 0.5506612 0.5506135 [246] 0.5505657 0.5505179 0.5504699 0.5504217 0.5503735 0.5503252 0.5502767 [253] 0.5502282 0.5501795 0.5501307 0.5500818 0.5500328 0.5499836 0.5499344 [260] 0.5498850 0.5498356 0.5497860 0.5497363 0.5496865 0.5496366 0.5495866 [267] 0.5495364 0.5494862 0.5494358 0.5493853 0.5493347 0.5492840 0.5492332 [274] 0.5491823 0.5491312 0.5490801 0.5490288 0.5489775 0.5489260 0.5488744 [281] 0.5488227 0.5487709 0.5487189 0.5486669 0.5486147 0.5485625 0.5485101 [288] 0.5484576 0.5484050 0.5483523 0.5482995 0.5482465 0.5481935 0.5481403 [295] 0.5480871 0.5480337 0.5479802 0.5479266 0.5478729 0.5478191 0.5477652 [302] 0.5477111 0.5476570 0.5476027 0.5475484 0.5474939 0.5474393 0.5473846 [309] 0.5473298 0.5472749 0.5472198 0.5471647 0.5471095 0.5470541 0.5469986 [316] 0.5469431 0.5468874 0.5468316 0.5467757 0.5467197 0.5466635 0.5466073 [323] 0.5465510 0.5464945 0.5464380 0.5463813 0.5463245 0.5462677 0.5462107 [330] 0.5461536 0.5460964 0.5460390 0.5459816 0.5459241 0.5458664 0.5458087 [337] 0.5457508 0.5456929 0.5456348 0.5455766 0.5455183 0.5454599 0.5454014 [344] 0.5453428 0.5452841 0.5452253 0.5451663 0.5451073 0.5450481 0.5449889 [351] 0.5449295 0.5448701 0.5448105 0.5447508 0.5446910 0.5446311 0.5445711 [358] 0.5445110 0.5444508 0.5443905 0.5443300 0.5442695 0.5442089 0.5441481 [365] 0.5440873 0.5440263 0.5439652 0.5439041 0.5438428 0.5437814 0.5437199 [372] 0.5436583 0.5435966 0.5435348 0.5434729 0.5434109 0.5433488 0.5432866 [379] 0.5432242 0.5431618 0.5430993 0.5430366 0.5429739 0.5429110 0.5428481 [386] 0.5427850 0.5427219 0.5426586 0.5425952 0.5425318 0.5424682 0.5424045 [393] 0.5423407 0.5422768 0.5422128 0.5421487 0.5420845 0.5420202 0.5419558 [400] 0.5418913 0.5418267 > mx [1] 0.5588136 > 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/17xj21257952325.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/2e9ym1257952325.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/3xoas1257952325.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/415uk1257952325.tab") > > system("convert tmp/17xj21257952325.ps tmp/17xj21257952325.png") > system("convert tmp/2e9ym1257952325.ps tmp/2e9ym1257952325.png") > system("convert tmp/3xoas1257952325.ps tmp/3xoas1257952325.png") > > > proc.time() user system elapsed 0.789 0.494 1.665