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(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(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2.21,2.25,2.25,2.45,2.5,2.5,2.64,2.75,2.93,3,3.17,3.25,3.39,3.5,3.5,3.65,3.75,3.75,3.9,4,4,4,4,4,4,4,4,4,4,4,4,4.18,4.25,4.25,3.97,3.42,2.75,2.31,2,1.66,1.31,1.09,1,1,1) > #'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.3802760 -0.3815885 -0.3829045 -0.3842239 -0.3855469 -0.3868732 [7] -0.3882030 -0.3895361 -0.3908725 -0.3922123 -0.3935553 -0.3949016 [13] -0.3962510 -0.3976036 -0.3989594 -0.4003182 -0.4016802 -0.4030451 [19] -0.4044130 -0.4057839 -0.4071577 -0.4085344 -0.4099139 -0.4112962 [25] -0.4126813 -0.4140691 -0.4154596 -0.4168527 -0.4182484 -0.4196466 [31] -0.4210474 -0.4224507 -0.4238563 -0.4252644 -0.4266748 -0.4280875 [37] -0.4295024 -0.4309195 -0.4323388 -0.4337602 -0.4351837 -0.4366092 [43] -0.4380366 -0.4394660 -0.4408972 -0.4423303 -0.4437651 -0.4452017 [49] -0.4466399 -0.4480798 -0.4495212 -0.4509642 -0.4524086 -0.4538544 [55] -0.4553017 -0.4567502 -0.4581999 -0.4596509 -0.4611031 -0.4625563 [61] -0.4640106 -0.4654658 -0.4669220 -0.4683791 -0.4698370 -0.4712957 [67] -0.4727551 -0.4742152 -0.4756758 -0.4771370 -0.4785987 -0.4800608 [73] -0.4815233 -0.4829861 -0.4844491 -0.4859124 -0.4873758 -0.4888393 [79] -0.4903028 -0.4917663 -0.4932297 -0.4946929 -0.4961560 -0.4976188 [85] -0.4990812 -0.5005433 -0.5020049 -0.5034660 -0.5049266 -0.5063866 [91] -0.5078458 -0.5093044 -0.5107621 -0.5122190 -0.5136749 -0.5151299 [97] -0.5165839 -0.5180368 -0.5194885 -0.5209390 -0.5223882 -0.5238362 [103] -0.5252827 -0.5267278 -0.5281714 -0.5296134 -0.5310538 -0.5324926 [109] -0.5339296 -0.5353648 -0.5367982 -0.5382297 -0.5396592 -0.5410867 [115] -0.5425121 -0.5439354 -0.5453565 -0.5467754 -0.5481920 -0.5496062 [121] -0.5510180 -0.5524274 -0.5538343 -0.5552386 -0.5566402 -0.5580392 [127] -0.5594355 -0.5608290 -0.5622197 -0.5636075 -0.5649923 -0.5663742 [133] -0.5677530 -0.5691288 -0.5705014 -0.5718709 -0.5732371 -0.5746000 [139] -0.5759596 -0.5773159 -0.5786687 -0.5800180 -0.5813639 -0.5827062 [145] -0.5840449 -0.5853799 -0.5867113 -0.5880389 -0.5893627 -0.5906828 [151] -0.5919989 -0.5933112 -0.5946195 -0.5959239 -0.5972242 -0.5985204 [157] -0.5998126 -0.6011006 -0.6023845 -0.6036641 -0.6049395 -0.6062107 [163] -0.6074775 -0.6087399 -0.6099980 -0.6112516 -0.6125008 -0.6137456 [169] -0.6149858 -0.6162214 -0.6174525 -0.6186790 -0.6199009 -0.6211181 [175] -0.6223306 -0.6235384 -0.6247414 -0.6259397 -0.6271332 -0.6283219 [181] -0.6295057 -0.6306847 -0.6318587 -0.6330279 -0.6341922 -0.6353514 [187] -0.6365058 -0.6376551 -0.6387994 -0.6399387 -0.6410729 -0.6422021 [193] -0.6433261 -0.6444451 -0.6455590 -0.6466678 -0.6477714 -0.6488698 [199] -0.6499631 -0.6510512 -0.6521341 -0.6532118 -0.6542843 -0.6553515 [205] -0.6564136 -0.6574703 -0.6585219 -0.6595681 -0.6606091 -0.6616448 [211] -0.6626753 -0.6637004 -0.6647203 -0.6657348 -0.6667441 -0.6677480 [217] -0.6687467 -0.6697400 -0.6707280 -0.6717107 -0.6726881 -0.6736602 [223] -0.6746269 -0.6755883 -0.6765444 -0.6774952 -0.6784407 -0.6793809 [229] -0.6803158 -0.6812453 -0.6821696 -0.6830886 -0.6840022 -0.6849106 [235] -0.6858137 -0.6867115 -0.6876041 -0.6884913 -0.6893733 -0.6902501 [241] -0.6911216 -0.6919879 -0.6928490 -0.6937048 -0.6945555 -0.6954009 [247] -0.6962411 -0.6970762 -0.6979061 -0.6987308 -0.6995504 -0.7003649 [253] -0.7011742 -0.7019784 -0.7027775 -0.7035715 -0.7043605 -0.7051444 [259] -0.7059232 -0.7066970 -0.7074658 -0.7082296 -0.7089883 -0.7097421 [265] -0.7104910 -0.7112349 -0.7119739 -0.7127079 -0.7134371 -0.7141613 [271] -0.7148808 -0.7155953 -0.7163050 -0.7170099 -0.7177100 -0.7184054 [277] -0.7190959 -0.7197817 -0.7204628 -0.7211392 -0.7218109 -0.7224779 [283] -0.7231402 -0.7237979 -0.7244510 -0.7250995 -0.7257434 -0.7263828 [289] -0.7270176 -0.7276479 -0.7282737 -0.7288950 -0.7295118 -0.7301242 [295] -0.7307321 -0.7313357 -0.7319349 -0.7325297 -0.7331201 -0.7337063 [301] -0.7342881 -0.7348657 -0.7354389 -0.7360080 -0.7365728 -0.7371334 [307] -0.7376899 -0.7382421 -0.7387903 -0.7393343 -0.7398742 -0.7404100 [313] -0.7409418 -0.7414696 -0.7419933 -0.7425130 -0.7430288 -0.7435406 [319] -0.7440485 -0.7445525 -0.7450525 -0.7455487 -0.7460411 -0.7465296 [325] -0.7470144 -0.7474953 -0.7479725 -0.7484459 -0.7489156 -0.7493816 [331] -0.7498439 -0.7503026 -0.7507576 -0.7512090 -0.7516568 -0.7521010 [337] -0.7525417 -0.7529788 -0.7534124 -0.7538425 -0.7542692 -0.7546923 [343] -0.7551121 -0.7555284 -0.7559413 -0.7563509 -0.7567571 -0.7571599 [349] -0.7575595 -0.7579557 -0.7583487 -0.7587384 -0.7591249 -0.7595082 [355] -0.7598882 -0.7602651 -0.7606388 -0.7610094 -0.7613769 -0.7617412 [361] -0.7621025 -0.7624608 -0.7628159 -0.7631681 -0.7635172 -0.7638634 [367] -0.7642066 -0.7645468 -0.7648841 -0.7652185 -0.7655500 -0.7658786 [373] -0.7662044 -0.7665273 -0.7668474 -0.7671647 -0.7674792 -0.7677909 [379] -0.7680999 -0.7684061 -0.7687096 -0.7690105 -0.7693086 -0.7696041 [385] -0.7698969 -0.7701871 -0.7704747 -0.7707597 -0.7710421 -0.7713220 [391] -0.7715993 -0.7718740 -0.7721463 -0.7724160 -0.7726833 -0.7729481 [397] -0.7732105 -0.7734704 -0.7737279 -0.7739830 -0.7742357 > mx [1] 0.7742357 > 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/11bny1260638540.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/24raw1260638540.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/3vgrf1260638540.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/4osz41260638540.tab") > try(system("convert tmp/11bny1260638540.ps tmp/11bny1260638540.png",intern=TRUE)) character(0) > try(system("convert tmp/24raw1260638540.ps tmp/24raw1260638540.png",intern=TRUE)) character(0) > try(system("convert tmp/3vgrf1260638540.ps tmp/3vgrf1260638540.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.751 0.490 0.937