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(99.5,98.2,108.9,100.0,105.0,108.4,96.7,100.5,115.6,114.9,110.7,107.7,113.5,106.9,119.6,109.4,106.9,118.7,108.9,113.1,125.1,126.5,122.7,127.5,107.1,112.0,122.1,111.5,113.2,128.2,115.1,117.4,132.0,130.8,128.0,132.7,117.0,110.9,123.5,117.4,122.7,123.5,111.5,113.8,131.2,127.0,126.2,121.2,118.8,117.9,135.2,120.7,126.4,129.6,113.4,120.5,135.5,137.6,130.6,133.1,121.5,120.5,136.9,123.7,128.5,135.0,120.9,121.1,132.2,134.5,133.6,136.1,124.5,124.6,133.5,132.3,125.3,135.5,121.2,117.5,135.9) > x <- c(85.0,95.9,108.9,96.2,100.1,105.7,64.5,66.8,110.3,96.1,102.5,97.6,83.6,86.5,96.0,91.1,87.2,84.5,59.2,61.5,98.8,97.9,92.7,84.2,74.5,79.7,86.8,79.8,87.0,91.4,58.7,62.8,87.9,90.4,80.6,73.5,71.4,70.6,78.3,76.0,77.4,80.9,63.4,58.1,88.2,81.2,84.9,76.4,71.5,76.1,82.9,78.0,82.0,84.7,55.7,59.5,83.2,87.6,76.2,76.4,68.3,70.0,76.3,70.9,72.4,80.1,57.4,62.7,82.6,88.9,80.4,72.0,69.4,69.2,77.3,79.4,78.6,76.1,61.8,59.4,78.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.0748627025 0.0745094031 0.0741555931 0.0738012735 0.0734464453 [6] 0.0730911098 0.0727352678 0.0723789206 0.0720220692 0.0716647147 [11] 0.0713068582 0.0709485009 0.0705896438 0.0702302881 0.0698704350 [16] 0.0695100855 0.0691492409 0.0687879022 0.0684260708 0.0680637476 [21] 0.0677009340 0.0673376311 0.0669738401 0.0666095623 0.0662447988 [26] 0.0658795508 0.0655138196 0.0651476065 0.0647809127 0.0644137393 [31] 0.0640460878 0.0636779593 0.0633093551 0.0629402766 0.0625707249 [36] 0.0622007015 0.0618302075 0.0614592444 0.0610878134 0.0607159159 [41] 0.0603435532 0.0599707267 0.0595974376 0.0592236874 0.0588494774 [46] 0.0584748090 0.0580996836 0.0577241025 0.0573480672 0.0569715790 [51] 0.0565946395 0.0562172499 0.0558394117 0.0554611263 0.0550823953 [56] 0.0547032199 0.0543236018 0.0539435423 0.0535630429 0.0531821051 [61] 0.0528007304 0.0524189202 0.0520366761 0.0516539996 0.0512708921 [66] 0.0508873552 0.0505033905 0.0501189994 0.0497341836 0.0493489444 [71] 0.0489632836 0.0485772027 0.0481907032 0.0478037867 0.0474164548 [76] 0.0470287091 0.0466405512 0.0462519827 0.0458630051 0.0454736203 [81] 0.0450838296 0.0446936349 0.0443030377 0.0439120396 0.0435206424 [86] 0.0431288477 0.0427366571 0.0423440724 0.0419510952 0.0415577272 [91] 0.0411639701 0.0407698256 0.0403752954 0.0399803812 0.0395850848 [96] 0.0391894079 0.0387933522 0.0383969194 0.0380001113 0.0376029297 [101] 0.0372053764 0.0368074530 0.0364091614 0.0360105034 0.0356114807 [106] 0.0352120951 0.0348123485 0.0344122426 0.0340117793 0.0336109604 [111] 0.0332097877 0.0328082630 0.0324063883 0.0320041652 0.0316015958 [116] 0.0311986818 0.0307954251 0.0303918276 0.0299878911 0.0295836176 [121] 0.0291790089 0.0287740670 0.0283687937 0.0279631909 0.0275572606 [126] 0.0271510047 0.0267444250 0.0263375236 0.0259303024 0.0255227633 [131] 0.0251149083 0.0247067393 0.0242982582 0.0238894672 0.0234803680 [136] 0.0230709627 0.0226612534 0.0222512419 0.0218409303 0.0214303206 [141] 0.0210194147 0.0206082148 0.0201967227 0.0197849406 0.0193728705 [146] 0.0189605143 0.0185478742 0.0181349522 0.0177217503 0.0173082706 [151] 0.0168945151 0.0164804860 0.0160661852 0.0156516149 0.0152367772 [156] 0.0148216740 0.0144063076 0.0139906801 0.0135747934 0.0131586497 [161] 0.0127422512 0.0123256000 0.0119086981 0.0114915477 0.0110741509 [166] 0.0106565100 0.0102386269 0.0098205038 0.0094021430 0.0089835465 [171] 0.0085647165 0.0081456551 0.0077263646 0.0073068472 0.0068871049 [176] 0.0064671399 0.0060469545 0.0056265509 0.0052059312 0.0047850976 [181] 0.0043640523 0.0039427976 0.0035213356 0.0030996685 0.0026777987 [186] 0.0022557282 0.0018334594 0.0014109944 0.0009883355 0.0005654849 [191] 0.0001424448 -0.0002807824 -0.0007041946 -0.0011277895 -0.0015515648 [196] -0.0019755183 -0.0023996478 -0.0028239508 -0.0032484253 -0.0036730689 [201] -0.0040978793 -0.0045228543 -0.0049479916 -0.0053732888 -0.0057987438 [206] -0.0062243542 -0.0066501177 -0.0070760320 -0.0075020948 -0.0079283038 [211] -0.0083546568 -0.0087811513 -0.0092077851 -0.0096345559 -0.0100614614 [216] -0.0104884992 -0.0109156669 -0.0113429624 -0.0117703832 -0.0121979271 [221] -0.0126255916 -0.0130533745 -0.0134812734 -0.0139092860 -0.0143374099 [226] -0.0147656428 -0.0151939823 -0.0156224261 -0.0160509719 -0.0164796172 [231] -0.0169083598 -0.0173371972 -0.0177661271 -0.0181951472 -0.0186242551 [236] -0.0190534484 -0.0194827247 -0.0199120817 -0.0203415171 -0.0207710284 [241] -0.0212006132 -0.0216302693 -0.0220599941 -0.0224897854 -0.0229196408 [246] -0.0233495578 -0.0237795341 -0.0242095674 -0.0246396551 -0.0250697950 [251] -0.0254999847 -0.0259302217 -0.0263605037 -0.0267908283 -0.0272211931 [256] -0.0276515958 -0.0280820338 -0.0285125048 -0.0289430065 -0.0293735364 [261] -0.0298040921 -0.0302346713 -0.0306652715 -0.0310958904 -0.0315265255 [266] -0.0319571745 -0.0323878349 -0.0328185044 -0.0332491805 -0.0336798609 [271] -0.0341105432 -0.0345412249 -0.0349719037 -0.0354025772 -0.0358332429 [276] -0.0362638984 -0.0366945415 -0.0371251696 -0.0375557803 -0.0379863713 [281] -0.0384169402 -0.0388474846 -0.0392780021 -0.0397084902 -0.0401389466 [286] -0.0405693689 -0.0409997546 -0.0414301015 -0.0418604071 -0.0422906689 [291] -0.0427208847 -0.0431510520 -0.0435811684 -0.0440112316 -0.0444412391 [296] -0.0448711886 -0.0453010777 -0.0457309039 -0.0461606649 -0.0465903584 [301] -0.0470199819 -0.0474495331 -0.0478790095 -0.0483084088 -0.0487377287 [306] -0.0491669667 -0.0495961204 -0.0500251876 -0.0504541658 -0.0508830526 [311] -0.0513118457 -0.0517405428 -0.0521691414 -0.0525976392 -0.0530260338 [316] -0.0534543230 -0.0538825042 -0.0543105752 -0.0547385336 -0.0551663771 [321] -0.0555941032 -0.0560217098 -0.0564491943 -0.0568765546 -0.0573037882 [326] -0.0577308928 -0.0581578660 -0.0585847056 -0.0590114092 -0.0594379745 [331] -0.0598643991 -0.0602906808 -0.0607168171 -0.0611428059 -0.0615686447 [336] -0.0619943313 -0.0624198634 -0.0628452386 -0.0632704547 -0.0636955093 [341] -0.0641204002 -0.0645451251 -0.0649696816 -0.0653940675 -0.0658182805 [346] -0.0662423183 -0.0666661786 -0.0670898593 -0.0675133579 -0.0679366722 [351] -0.0683598000 -0.0687827390 -0.0692054870 -0.0696280416 -0.0700504007 [356] -0.0704725619 -0.0708945231 -0.0713162820 -0.0717378364 -0.0721591841 [361] -0.0725803227 -0.0730012501 -0.0734219641 -0.0738424625 -0.0742627429 [366] -0.0746828033 -0.0751026415 -0.0755222551 -0.0759416421 -0.0763608003 [371] -0.0767797273 -0.0771984212 -0.0776168796 -0.0780351004 -0.0784530815 [376] -0.0788708206 -0.0792883157 -0.0797055645 -0.0801225649 -0.0805393147 [381] -0.0809558119 -0.0813720542 -0.0817880396 -0.0822037658 -0.0826192309 [386] -0.0830344325 -0.0834493688 -0.0838640374 -0.0842784364 -0.0846925636 [391] -0.0851064169 -0.0855199943 -0.0859332936 -0.0863463128 -0.0867590497 [396] -0.0871715024 -0.0875836687 -0.0879955467 -0.0884071341 -0.0888184290 [401] -0.0892294294 > mx [1] 0.08922943 > 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/15j2x1228923567.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/26c681228923567.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/3omct1228923567.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/4wpxp1228923567.tab") > > system("convert tmp/15j2x1228923567.ps tmp/15j2x1228923567.png") > system("convert tmp/26c681228923567.ps tmp/26c681228923567.png") > system("convert tmp/3omct1228923567.ps tmp/3omct1228923567.png") > > > proc.time() user system elapsed 0.791 0.511 0.925