R version 2.8.0 (2008-10-20) 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(4.62,4.64,4.57,4.49,4.48,4.5,4.52,4.63,4.75,4.99,5.28,5.33,5.26,5.14,4.99,4.85,4.83,4.83,4.88,4.91,4.93,4.93,4.95,4.95,4.88,4.78,4.61,4.46,4.42,4.43,4.41,4.4,4.36,4.36,4.38,4.4,4.37,4.32,4.18,4.04,4,3.97,3.94,3.93,3.89,3.89,3.88,3.9,3.9,3.95,4.02,4.07,4.17,4.27,4.32,4.38,4.45,4.71,4.96,4.95,4.78,4.78,4.68,4.65,4.64,4.74,4.76,4.61,4.75,4.73,4.68,4.68,4.75,4.79,4.81,4.92,4.99,5.18,5.29,5.48,5.66) > x <- c(2.97,3.04,3.12,3.21,3.34,3.45,3.74,4.02,4.24,4.87,5.62,6.02,5.98,5.89,5.76,5.58,5.39,5.19,5.16,5.2,5.25,5.26,5.21,5.18,5.13,5.03,5.01,4.87,4.86,4.82,4.69,4.65,4.61,4.47,4.37,4.29,4.2,4.19,4.09,3.88,3.87,3.74,3.61,3.43,3.29,3.18,3.07,3.02,2.97,2.98,3.01,3.06,3.12,3.16,3.19,3.21,3.27,3.36,3.45,3.52,3.58,3.62,3.5,3.43,3.41,3.48,3.63,3.76,3.8,3.72,3.67,3.58,3.47,3.43,3.55,3.65,3.7,3.7,3.93,4.15,4.24) > #'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.5318634 0.5318403 0.5318171 0.5317938 0.5317704 0.5317469 0.5317233 [8] 0.5316997 0.5316759 0.5316521 0.5316281 0.5316041 0.5315800 0.5315558 [15] 0.5315315 0.5315071 0.5314826 0.5314581 0.5314334 0.5314087 0.5313839 [22] 0.5313590 0.5313340 0.5313089 0.5312837 0.5312584 0.5312331 0.5312077 [29] 0.5311822 0.5311565 0.5311309 0.5311051 0.5310792 0.5310533 0.5310273 [36] 0.5310012 0.5309750 0.5309487 0.5309223 0.5308959 0.5308693 0.5308427 [43] 0.5308160 0.5307893 0.5307624 0.5307355 0.5307084 0.5306813 0.5306541 [50] 0.5306269 0.5305995 0.5305721 0.5305446 0.5305170 0.5304893 0.5304616 [57] 0.5304338 0.5304058 0.5303779 0.5303498 0.5303217 0.5302934 0.5302651 [64] 0.5302368 0.5302083 0.5301798 0.5301512 0.5301225 0.5300937 0.5300649 [71] 0.5300360 0.5300070 0.5299779 0.5299488 0.5299196 0.5298903 0.5298609 [78] 0.5298315 0.5298019 0.5297724 0.5297427 0.5297130 0.5296832 0.5296533 [85] 0.5296233 0.5295933 0.5295632 0.5295330 0.5295028 0.5294725 0.5294421 [92] 0.5294116 0.5293811 0.5293505 0.5293199 0.5292891 0.5292583 0.5292274 [99] 0.5291965 0.5291655 0.5291344 0.5291033 0.5290721 0.5290408 0.5290094 [106] 0.5289780 0.5289465 0.5289150 0.5288833 0.5288517 0.5288199 0.5287881 [113] 0.5287562 0.5287243 0.5286922 0.5286602 0.5286280 0.5285958 0.5285635 [120] 0.5285312 0.5284988 0.5284663 0.5284338 0.5284012 0.5283686 0.5283359 [127] 0.5283031 0.5282702 0.5282374 0.5282044 0.5281714 0.5281383 0.5281051 [134] 0.5280719 0.5280387 0.5280054 0.5279720 0.5279385 0.5279050 0.5278715 [141] 0.5278379 0.5278042 0.5277704 0.5277366 0.5277028 0.5276689 0.5276349 [148] 0.5276009 0.5275668 0.5275327 0.5274985 0.5274642 0.5274299 0.5273956 [155] 0.5273612 0.5273267 0.5272922 0.5272576 0.5272230 0.5271883 0.5271535 [162] 0.5271188 0.5270839 0.5270490 0.5270141 0.5269790 0.5269440 0.5269089 [169] 0.5268737 0.5268385 0.5268032 0.5267679 0.5267326 0.5266971 0.5266617 [176] 0.5266262 0.5265906 0.5265550 0.5265193 0.5264836 0.5264478 0.5264120 [183] 0.5263761 0.5263402 0.5263043 0.5262683 0.5262322 0.5261961 0.5261600 [190] 0.5261238 0.5260875 0.5260512 0.5260149 0.5259785 0.5259421 0.5259056 [197] 0.5258691 0.5258325 0.5257959 0.5257592 0.5257225 0.5256858 0.5256490 [204] 0.5256122 0.5255753 0.5255384 0.5255014 0.5254644 0.5254274 0.5253903 [211] 0.5253531 0.5253159 0.5252787 0.5252415 0.5252042 0.5251668 0.5251294 [218] 0.5250920 0.5250545 0.5250170 0.5249795 0.5249419 0.5249043 0.5248666 [225] 0.5248289 0.5247911 0.5247533 0.5247155 0.5246776 0.5246397 0.5246018 [232] 0.5245638 0.5245258 0.5244877 0.5244496 0.5244115 0.5243733 0.5243351 [239] 0.5242969 0.5242586 0.5242203 0.5241819 0.5241435 0.5241051 0.5240666 [246] 0.5240281 0.5239896 0.5239510 0.5239124 0.5238738 0.5238351 0.5237964 [253] 0.5237576 0.5237189 0.5236800 0.5236412 0.5236023 0.5235634 0.5235244 [260] 0.5234855 0.5234464 0.5234074 0.5233683 0.5233292 0.5232900 0.5232509 [267] 0.5232117 0.5231724 0.5231331 0.5230938 0.5230545 0.5230151 0.5229757 [274] 0.5229363 0.5228968 0.5228573 0.5228178 0.5227782 0.5227386 0.5226990 [281] 0.5226593 0.5226197 0.5225799 0.5225402 0.5225004 0.5224606 0.5224208 [288] 0.5223809 0.5223410 0.5223011 0.5222612 0.5222212 0.5221812 0.5221412 [295] 0.5221011 0.5220610 0.5220209 0.5219807 0.5219406 0.5219004 0.5218601 [302] 0.5218199 0.5217796 0.5217393 0.5216989 0.5216585 0.5216181 0.5215777 [309] 0.5215373 0.5214968 0.5214563 0.5214158 0.5213752 0.5213346 0.5212940 [316] 0.5212534 0.5212127 0.5211720 0.5211313 0.5210905 0.5210498 0.5210090 [323] 0.5209682 0.5209273 0.5208864 0.5208455 0.5208046 0.5207637 0.5207227 [330] 0.5206817 0.5206407 0.5205996 0.5205586 0.5205175 0.5204763 0.5204352 [337] 0.5203940 0.5203528 0.5203116 0.5202703 0.5202291 0.5201878 0.5201465 [344] 0.5201051 0.5200637 0.5200223 0.5199809 0.5199395 0.5198980 0.5198565 [351] 0.5198150 0.5197735 0.5197319 0.5196903 0.5196487 0.5196071 0.5195655 [358] 0.5195238 0.5194821 0.5194403 0.5193986 0.5193568 0.5193150 0.5192732 [365] 0.5192314 0.5191895 0.5191476 0.5191057 0.5190638 0.5190218 0.5189798 [372] 0.5189378 0.5188958 0.5188537 0.5188117 0.5187696 0.5187274 0.5186853 [379] 0.5186431 0.5186009 0.5185587 0.5185165 0.5184742 0.5184319 0.5183896 [386] 0.5183473 0.5183050 0.5182626 0.5182202 0.5181778 0.5181353 0.5180928 [393] 0.5180504 0.5180078 0.5179653 0.5179227 0.5178802 0.5178376 0.5177949 [400] 0.5177523 0.5177096 > mx [1] 0.5318634 > 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/1sulr1258034320.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/2j9fc1258034320.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/3zw9l1258034320.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/4qvrh1258034320.tab") > > system("convert tmp/1sulr1258034320.ps tmp/1sulr1258034320.png") > system("convert tmp/2j9fc1258034320.ps tmp/2j9fc1258034320.png") > system("convert tmp/3zw9l1258034320.ps tmp/3zw9l1258034320.png") > > > proc.time() user system elapsed 1.241 0.808 1.390