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(8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8) > x <- c(30084,26290,24379,23335,21346,21106,24514,30805,28353,31348,34556,33855,34787,32529,29998,29257,28155,30466,35704,39327,39351,42234,43630,43722,43121,37985,37135,34646,33026,35087,38846,42013,43908,42868,44423,44167,43636,44382,42142,43452,36912,42413,45344,44873,47510,49554,47369,45998,48140,48441,44928,40454,38661,37246,36843,36424,37594,38144,38737,34560) > #'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.5372491 -0.5377563 -0.5382630 -0.5387693 -0.5392752 -0.5397806 [7] -0.5402855 -0.5407900 -0.5412940 -0.5417975 -0.5423006 -0.5428032 [13] -0.5433053 -0.5438069 -0.5443080 -0.5448086 -0.5453087 -0.5458083 [19] -0.5463074 -0.5468060 -0.5473040 -0.5478015 -0.5482984 -0.5487949 [25] -0.5492907 -0.5497861 -0.5502808 -0.5507750 -0.5512687 -0.5517618 [31] -0.5522543 -0.5527462 -0.5532375 -0.5537283 -0.5542184 -0.5547080 [37] -0.5551969 -0.5556853 -0.5561730 -0.5566601 -0.5571466 -0.5576325 [43] -0.5581177 -0.5586023 -0.5590862 -0.5595695 -0.5600522 -0.5605342 [49] -0.5610155 -0.5614962 -0.5619762 -0.5624555 -0.5629342 -0.5634121 [55] -0.5638894 -0.5643660 -0.5648419 -0.5653171 -0.5657916 -0.5662653 [61] -0.5667384 -0.5672107 -0.5676823 -0.5681532 -0.5686234 -0.5690928 [67] -0.5695615 -0.5700294 -0.5704966 -0.5709630 -0.5714286 -0.5718935 [73] -0.5723577 -0.5728210 -0.5732836 -0.5737454 -0.5742064 -0.5746667 [79] -0.5751261 -0.5755847 -0.5760426 -0.5764996 -0.5769558 -0.5774112 [85] -0.5778658 -0.5783196 -0.5787725 -0.5792246 -0.5796759 -0.5801264 [91] -0.5805760 -0.5810247 -0.5814726 -0.5819197 -0.5823659 -0.5828112 [97] -0.5832557 -0.5836992 -0.5841420 -0.5845838 -0.5850248 -0.5854649 [103] -0.5859040 -0.5863423 -0.5867797 -0.5872163 -0.5876519 -0.5880865 [109] -0.5885203 -0.5889532 -0.5893852 -0.5898162 -0.5902463 -0.5906755 [115] -0.5911037 -0.5915310 -0.5919574 -0.5923828 -0.5928073 -0.5932309 [121] -0.5936535 -0.5940751 -0.5944958 -0.5949155 -0.5953342 -0.5957520 [127] -0.5961688 -0.5965847 -0.5969995 -0.5974134 -0.5978263 -0.5982382 [133] -0.5986491 -0.5990590 -0.5994679 -0.5998759 -0.6002828 -0.6006887 [139] -0.6010936 -0.6014975 -0.6019004 -0.6023023 -0.6027031 -0.6031029 [145] -0.6035017 -0.6038995 -0.6042963 -0.6046920 -0.6050866 -0.6054803 [151] -0.6058729 -0.6062644 -0.6066549 -0.6070444 -0.6074328 -0.6078201 [157] -0.6082064 -0.6085916 -0.6089758 -0.6093589 -0.6097410 -0.6101219 [163] -0.6105018 -0.6108807 -0.6112584 -0.6116351 -0.6120107 -0.6123852 [169] -0.6127586 -0.6131310 -0.6135022 -0.6138724 -0.6142414 -0.6146094 [175] -0.6149763 -0.6153421 -0.6157067 -0.6160703 -0.6164328 -0.6167941 [181] -0.6171544 -0.6175135 -0.6178716 -0.6182285 -0.6185843 -0.6189390 [187] -0.6192925 -0.6196450 -0.6199963 -0.6203465 -0.6206956 -0.6210435 [193] -0.6213903 -0.6217360 -0.6220805 -0.6224240 -0.6227662 -0.6231074 [199] -0.6234474 -0.6237863 -0.6241240 -0.6244606 -0.6247960 -0.6251303 [205] -0.6254635 -0.6257955 -0.6261263 -0.6264560 -0.6267846 -0.6271120 [211] -0.6274382 -0.6277633 -0.6280873 -0.6284100 -0.6287317 -0.6290521 [217] -0.6293714 -0.6296896 -0.6300066 -0.6303224 -0.6306371 -0.6309506 [223] -0.6312629 -0.6315741 -0.6318841 -0.6321929 -0.6325006 -0.6328071 [229] -0.6331124 -0.6334166 -0.6337196 -0.6340214 -0.6343221 -0.6346215 [235] -0.6349198 -0.6352170 -0.6355129 -0.6358077 -0.6361013 -0.6363938 [241] -0.6366850 -0.6369751 -0.6372640 -0.6375518 -0.6378383 -0.6381237 [247] -0.6384079 -0.6386910 -0.6389728 -0.6392535 -0.6395330 -0.6398113 [253] -0.6400884 -0.6403644 -0.6406392 -0.6409128 -0.6411852 -0.6414565 [259] -0.6417266 -0.6419954 -0.6422632 -0.6425297 -0.6427951 -0.6430593 [265] -0.6433223 -0.6435841 -0.6438447 -0.6441042 -0.6443625 -0.6446196 [271] -0.6448756 -0.6451304 -0.6453840 -0.6456364 -0.6458876 -0.6461377 [277] -0.6463866 -0.6466343 -0.6468809 -0.6471262 -0.6473704 -0.6476135 [283] -0.6478553 -0.6480960 -0.6483356 -0.6485739 -0.6488111 -0.6490471 [289] -0.6492820 -0.6495156 -0.6497481 -0.6499795 -0.6502097 -0.6504387 [295] -0.6506666 -0.6508933 -0.6511188 -0.6513432 -0.6515664 -0.6517884 [301] -0.6520093 -0.6522290 -0.6524476 -0.6526650 -0.6528813 -0.6530964 [307] -0.6533104 -0.6535232 -0.6537348 -0.6539453 -0.6541547 -0.6543629 [313] -0.6545700 -0.6547759 -0.6549807 -0.6551843 -0.6553868 -0.6555881 [319] -0.6557883 -0.6559874 -0.6561853 -0.6563821 -0.6565778 -0.6567723 [325] -0.6569657 -0.6571579 -0.6573490 -0.6575390 -0.6577279 -0.6579156 [331] -0.6581022 -0.6582877 -0.6584721 -0.6586554 -0.6588375 -0.6590185 [337] -0.6591984 -0.6593772 -0.6595548 -0.6597314 -0.6599068 -0.6600811 [343] -0.6602544 -0.6604265 -0.6605975 -0.6607674 -0.6609362 -0.6611039 [349] -0.6612705 -0.6614360 -0.6616004 -0.6617637 -0.6619259 -0.6620871 [355] -0.6622471 -0.6624061 -0.6625639 -0.6627207 -0.6628764 -0.6630310 [361] -0.6631846 -0.6633370 -0.6634884 -0.6636387 -0.6637880 -0.6639361 [367] -0.6640832 -0.6642293 -0.6643742 -0.6645181 -0.6646610 -0.6648028 [373] -0.6649435 -0.6650832 -0.6652218 -0.6653593 -0.6654958 -0.6656313 [379] -0.6657657 -0.6658991 -0.6660314 -0.6661627 -0.6662930 -0.6664222 [385] -0.6665503 -0.6666775 -0.6668036 -0.6669287 -0.6670527 -0.6671757 [391] -0.6672978 -0.6674187 -0.6675387 -0.6676576 -0.6677756 -0.6678925 [397] -0.6680084 -0.6681233 -0.6682372 -0.6683500 -0.6684619 > mx [1] 0.6684619 > 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/17hxi1257413884.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/2opkp1257413884.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/3hlff1257413884.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/4o1q21257413884.tab") > > system("convert tmp/17hxi1257413884.ps tmp/17hxi1257413884.png") > system("convert tmp/2opkp1257413884.ps tmp/2opkp1257413884.png") > system("convert tmp/3hlff1257413884.ps tmp/3hlff1257413884.png") > > > proc.time() user system elapsed 1.266 0.839 1.446