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(94.1,95.8,99.3,101.1,104,99,105.4,107.1,110.7,117.1,118.7,126.5,127.5,134.6,131.8,135.9,142.7,141.7,153.4,145,137.7,148.3,152.2,169.4,168.6,161.1,174.1,179,190.6,190,181.6,174.8,180.5,196.8,193.8,197,216.3,221.4,217.9,229.7,227.4,204.2,196.6,198.8,207.5,190.7,201.6,210.5,223.5,223.8,231.2,244,234.7,250.2,265.7,287.6,283.3,295.4,312.3,333.8) > x <- c(80.9,113.8,71.2,55.8,61,60.8,74.3,66.5,71,61.6,66.4,74.7,72.4,76.4,86.4,73.9,133.1,83.3,85.8,76.8,92.7,68.8,69.4,97,84.6,84.2,201.8,83.1,69.4,78.8,77.1,90.7,107.5,81.4,83.3,105.7,85.8,87.2,87.5,77.5,78.5,89.7,94.3,104.4,115.9,90,91.1,119.8,101.9,99.2,115.7,94.9,99.8,109.6,109,119.6,119.2,94.6,102.5,105.4) > #'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.6169378 0.6168308 0.6167217 0.6166103 0.6164968 0.6163811 0.6162631 [8] 0.6161430 0.6160206 0.6158960 0.6157692 0.6156401 0.6155087 0.6153751 [15] 0.6152393 0.6151011 0.6149607 0.6148179 0.6146729 0.6145255 0.6143758 [22] 0.6142238 0.6140694 0.6139127 0.6137536 0.6135922 0.6134283 0.6132621 [29] 0.6130935 0.6129225 0.6127491 0.6125733 0.6123950 0.6122143 0.6120311 [36] 0.6118455 0.6116574 0.6114669 0.6112738 0.6110783 0.6108803 0.6106797 [43] 0.6104766 0.6102710 0.6100629 0.6098522 0.6096389 0.6094231 0.6092047 [50] 0.6089837 0.6087602 0.6085340 0.6083052 0.6080737 0.6078397 0.6076030 [57] 0.6073636 0.6071216 0.6068769 0.6066295 0.6063795 0.6061267 0.6058712 [64] 0.6056130 0.6053521 0.6050884 0.6048220 0.6045528 0.6042809 0.6040062 [71] 0.6037287 0.6034483 0.6031652 0.6028793 0.6025905 0.6022989 0.6020045 [78] 0.6017072 0.6014070 0.6011039 0.6007980 0.6004892 0.6001774 0.5998628 [85] 0.5995452 0.5992247 0.5989012 0.5985748 0.5982454 0.5979130 0.5975776 [92] 0.5972393 0.5968979 0.5965535 0.5962061 0.5958557 0.5955022 0.5951457 [99] 0.5947861 0.5944234 0.5940576 0.5936887 0.5933167 0.5929416 0.5925634 [106] 0.5921820 0.5917975 0.5914099 0.5910190 0.5906250 0.5902278 0.5898274 [113] 0.5894238 0.5890170 0.5886069 0.5881936 0.5877771 0.5873573 0.5869342 [120] 0.5865079 0.5860783 0.5856454 0.5852091 0.5847696 0.5843267 0.5838805 [127] 0.5834310 0.5829781 0.5825218 0.5820621 0.5815991 0.5811327 0.5806629 [134] 0.5801896 0.5797129 0.5792328 0.5787493 0.5782623 0.5777719 0.5772779 [141] 0.5767806 0.5762797 0.5757753 0.5752674 0.5747560 0.5742411 0.5737226 [148] 0.5732006 0.5726750 0.5721459 0.5716132 0.5710770 0.5705371 0.5699937 [155] 0.5694466 0.5688959 0.5683417 0.5677837 0.5672222 0.5666570 0.5660881 [162] 0.5655156 0.5649395 0.5643596 0.5637761 0.5631888 0.5625979 0.5620032 [169] 0.5614049 0.5608028 0.5601970 0.5595874 0.5589741 0.5583571 0.5577363 [176] 0.5571117 0.5564834 0.5558512 0.5552153 0.5545756 0.5539321 0.5532848 [183] 0.5526337 0.5519788 0.5513200 0.5506574 0.5499910 0.5493208 0.5486467 [190] 0.5479687 0.5472869 0.5466013 0.5459118 0.5452184 0.5445211 0.5438200 [197] 0.5431149 0.5424060 0.5416932 0.5409765 0.5402560 0.5395315 0.5388031 [204] 0.5380708 0.5373346 0.5365945 0.5358504 0.5351025 0.5343506 0.5335948 [211] 0.5328351 0.5320714 0.5313039 0.5305324 0.5297569 0.5289776 0.5281943 [218] 0.5274071 0.5266159 0.5258208 0.5250218 0.5242189 0.5234120 0.5226012 [225] 0.5217864 0.5209677 0.5201451 0.5193186 0.5184881 0.5176538 0.5168155 [232] 0.5159733 0.5151271 0.5142771 0.5134231 0.5125653 0.5117035 0.5108378 [239] 0.5099683 0.5090948 0.5082175 0.5073363 0.5064512 0.5055622 0.5046694 [246] 0.5037727 0.5028721 0.5019677 0.5010595 0.5001474 0.4992315 0.4983118 [253] 0.4973883 0.4964609 0.4955298 0.4945949 0.4936562 0.4927137 0.4917675 [260] 0.4908175 0.4898638 0.4889063 0.4879451 0.4869803 0.4860117 0.4850394 [267] 0.4840635 0.4830838 0.4821006 0.4811137 0.4801231 0.4791290 0.4781313 [274] 0.4771299 0.4761250 0.4751166 0.4741045 0.4730890 0.4720699 0.4710474 [281] 0.4700214 0.4689919 0.4679589 0.4669225 0.4658827 0.4648395 0.4637929 [288] 0.4627429 0.4616896 0.4606330 0.4595731 0.4585098 0.4574433 0.4563736 [295] 0.4553006 0.4542244 0.4531450 0.4520625 0.4509768 0.4498879 0.4487960 [302] 0.4477010 0.4466029 0.4455018 0.4443976 0.4432905 0.4421804 0.4410674 [309] 0.4399514 0.4388325 0.4377108 0.4365862 0.4354588 0.4343287 0.4331957 [316] 0.4320600 0.4309216 0.4297805 0.4286367 0.4274903 0.4263412 0.4251896 [323] 0.4240355 0.4228788 0.4217196 0.4205580 0.4193939 0.4182274 0.4170585 [330] 0.4158873 0.4147138 0.4135379 0.4123599 0.4111795 0.4099970 0.4088123 [337] 0.4076255 0.4064366 0.4052456 0.4040526 0.4028576 0.4016606 0.4004616 [344] 0.3992608 0.3980580 0.3968535 0.3956471 0.3944389 0.3932290 0.3920174 [351] 0.3908042 0.3895892 0.3883727 0.3871546 0.3859350 0.3847139 0.3834913 [358] 0.3822673 0.3810419 0.3798152 0.3785871 0.3773578 0.3761271 0.3748953 [365] 0.3736623 0.3724282 0.3711930 0.3699567 0.3687193 0.3674810 0.3662417 [372] 0.3650015 0.3637604 0.3625185 0.3612757 0.3600322 0.3587880 0.3575430 [379] 0.3562974 0.3550512 0.3538044 0.3525571 0.3513092 0.3500609 0.3488121 [386] 0.3475629 0.3463134 0.3450636 0.3438135 0.3425631 0.3413125 0.3400618 [393] 0.3388109 0.3375599 0.3363089 0.3350578 0.3338068 0.3325558 0.3313049 [400] 0.3300542 0.3288036 > mx [1] 0.6169378 > 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/1vmve1257965293.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/25k8e1257965293.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/3eifm1257965293.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/4pzdn1257965293.tab") > > system("convert tmp/1vmve1257965293.ps tmp/1vmve1257965293.png") > system("convert tmp/25k8e1257965293.ps tmp/25k8e1257965293.png") > system("convert tmp/3eifm1257965293.ps tmp/3eifm1257965293.png") > > > proc.time() user system elapsed 0.805 0.527 0.982