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(49,46,45,49,47,45,48,51,48,49,51,54,52,52,53,51,55,53,51,52,54,58,57,52,50,53,50,50,51,53,49,54,57,58,56,60,55,54,52,55,56,54,53,59,62,63,64,75,77,79,77,82,83,81,78,79,79,73,72,67) > x <- c(1,10,2,5,7,22,25,24,23,22,21,17,19,19,25,17,16,25,19,16,5,4,7,6,13,13,13,15,13,18,13,21,22,16,23,20,20,27,26,20,21,31,32,36,34,27,26,18,15,9,13,8,5,11,9,17,15,21,10,11) > #'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.1349529871 0.1349376844 0.1349188738 0.1348964726 0.1348703969 [6] 0.1348405614 0.1348068792 0.1347692622 0.1347276209 0.1346818642 [11] 0.1346318998 0.1345776338 0.1345189709 0.1344558144 0.1343880660 [16] 0.1343156260 0.1342383934 0.1341562655 0.1340691381 0.1339769057 [21] 0.1338794613 0.1337766962 0.1336685004 0.1335547624 0.1334353691 [26] 0.1333102060 0.1331791571 0.1330421051 0.1328989308 0.1327495140 [31] 0.1325937328 0.1324314639 0.1322625827 0.1320869629 0.1319044770 [36] 0.1317149962 0.1315183902 0.1313145273 0.1311032745 0.1308844977 [41] 0.1306580614 0.1304238287 0.1301816617 0.1299314213 0.1296729670 [46] 0.1294061576 0.1291308505 0.1288469022 0.1285541683 0.1282525032 [51] 0.1279417607 0.1276217936 0.1272924540 0.1269535932 0.1266050619 [56] 0.1262467101 0.1258783875 0.1254999432 0.1251112258 0.1247120838 [61] 0.1243023653 0.1238819185 0.1234505912 0.1230082315 0.1225546876 [66] 0.1220898077 0.1216134407 0.1211254356 0.1206256422 0.1201139106 [71] 0.1195900921 0.1190540385 0.1185056029 0.1179446393 0.1173710032 [76] 0.1167845514 0.1161851420 0.1155726352 0.1149468926 0.1143077782 [81] 0.1136551577 0.1129888993 0.1123088737 0.1116149539 0.1109070158 [86] 0.1101849384 0.1094486034 0.1086978961 0.1079327051 0.1071529224 [91] 0.1063584442 0.1055491701 0.1047250044 0.1038858553 0.1030316357 [96] 0.1021622631 0.1012776598 0.1003777532 0.0994624760 0.0985317662 [101] 0.0975855674 0.0966238288 0.0956465060 0.0946535602 0.0936449591 [106] 0.0926206770 0.0915806945 0.0905249994 0.0894535860 0.0883664561 [111] 0.0872636185 0.0861450895 0.0850108929 0.0838610603 0.0826956309 [116] 0.0815146520 0.0803181788 0.0791062748 0.0778790115 0.0766364691 [121] 0.0753787358 0.0741059085 0.0728180927 0.0715154024 0.0701979601 [126] 0.0688658972 0.0675193538 0.0661584783 0.0647834283 0.0633943697 [131] 0.0619914773 0.0605749343 0.0591449326 0.0577016724 0.0562453626 [136] 0.0547762203 0.0532944707 0.0518003473 0.0502940914 0.0487759524 [141] 0.0472461873 0.0457050604 0.0441528438 0.0425898164 0.0410162643 [146] 0.0394324803 0.0378387638 0.0362354205 0.0346227622 0.0330011066 [151] 0.0313707769 0.0297321017 0.0280854146 0.0264310540 0.0247693628 [156] 0.0231006880 0.0214253806 0.0197437951 0.0180562894 0.0163632242 [161] 0.0146649630 0.0129618715 0.0112543175 0.0095426704 0.0078273011 [166] 0.0061085814 0.0043868839 0.0026625815 0.0009360473 -0.0007923459 [171] -0.0025222258 -0.0042532210 -0.0059849614 -0.0077170781 -0.0094492041 [176] -0.0111809745 -0.0129120267 -0.0146420006 -0.0163705390 -0.0180972881 [181] -0.0198218971 -0.0215440191 -0.0232633109 -0.0249794336 -0.0266920524 [186] -0.0284008372 -0.0301054624 -0.0318056076 -0.0335009571 -0.0351912009 [191] -0.0368760340 -0.0385551573 -0.0402282772 -0.0418951060 -0.0435553619 [196] -0.0452087691 -0.0468550582 -0.0484939657 -0.0501252346 -0.0517486144 [201] -0.0533638607 -0.0549707360 -0.0565690091 -0.0581584553 -0.0597388567 [206] -0.0613100019 -0.0628716861 -0.0644237110 -0.0659658852 -0.0674980237 [211] -0.0690199480 -0.0705314862 -0.0720324730 -0.0735227495 -0.0750021631 [216] -0.0764705676 -0.0779278232 -0.0793737962 -0.0808083593 -0.0822313909 [221] -0.0836427757 -0.0850424044 -0.0864301732 -0.0878059844 -0.0891697458 [226] -0.0905213709 -0.0918607786 -0.0931878931 -0.0945026441 -0.0958049663 [231] -0.0970947995 -0.0983720886 -0.0996367833 -0.1008888380 -0.1021282118 [236] -0.1033548684 -0.1045687760 -0.1057699069 -0.1069582378 -0.1081337495 [241] -0.1092964268 -0.1104462585 -0.1115832369 -0.1127073584 -0.1138186226 [246] -0.1149170329 -0.1160025959 -0.1170753215 -0.1181352228 -0.1191823161 [251] -0.1202166203 -0.1212381577 -0.1222469529 -0.1232430336 -0.1242264298 [256] -0.1251971742 -0.1261553017 -0.1271008498 -0.1280338582 -0.1289543685 [261] -0.1298624246 -0.1307580724 -0.1316413597 -0.1325123360 -0.1333710528 [266] -0.1342175631 -0.1350519217 -0.1358741847 -0.1366844099 -0.1374826564 [271] -0.1382689846 -0.1390434564 -0.1398061348 -0.1405570838 -0.1412963687 [276] -0.1420240558 -0.1427402124 -0.1434449067 -0.1441382078 -0.1448201857 [281] -0.1454909110 -0.1461504552 -0.1467988905 -0.1474362896 -0.1480627259 [286] -0.1486782734 -0.1492830065 -0.1498770002 -0.1504603298 -0.1510330712 [291] -0.1515953005 -0.1521470943 -0.1526885291 -0.1532196823 -0.1537406309 [296] -0.1542514526 -0.1547522250 -0.1552430260 -0.1557239334 -0.1561950254 [301] -0.1566563800 -0.1571080755 -0.1575501900 -0.1579828017 -0.1584059888 [306] -0.1588198294 -0.1592244016 -0.1596197835 -0.1600060529 -0.1603832876 [311] -0.1607515653 -0.1611109635 -0.1614615596 -0.1618034307 -0.1621366538 [316] -0.1624613057 -0.1627774630 -0.1630852019 -0.1633845987 -0.1636757291 [321] -0.1639586688 -0.1642334929 -0.1645002766 -0.1647590946 -0.1650100212 [326] -0.1652531307 -0.1654884968 -0.1657161929 -0.1659362922 -0.1661488675 [331] -0.1663539913 -0.1665517356 -0.1667421722 -0.1669253725 -0.1671014073 [336] -0.1672703475 -0.1674322632 -0.1675872242 -0.1677353002 -0.1678765600 [341] -0.1680110725 -0.1681389060 -0.1682601282 -0.1683748067 -0.1684830086 [346] -0.1685848006 -0.1686802489 -0.1687694193 -0.1688523773 -0.1689291879 [351] -0.1689999157 -0.1690646248 -0.1691233790 -0.1691762417 -0.1692232758 [356] -0.1692645436 -0.1693001074 -0.1693300287 -0.1693543687 -0.1693731883 [361] -0.1693865478 -0.1693945070 -0.1693971256 -0.1693944627 -0.1693865768 [366] -0.1693735262 -0.1693553688 -0.1693321619 -0.1693039624 -0.1692708270 [371] -0.1692328118 -0.1691899724 -0.1691423642 -0.1690900420 -0.1690330602 [376] -0.1689714729 -0.1689053338 -0.1688346960 -0.1687596123 -0.1686801351 [381] -0.1685963163 -0.1685082077 -0.1684158602 -0.1683193246 -0.1682186514 [386] -0.1681138904 -0.1680050913 -0.1678923031 -0.1677755746 -0.1676549541 [391] -0.1675304897 -0.1674022289 -0.1672702189 -0.1671345065 -0.1669951381 [396] -0.1668521597 -0.1667056170 -0.1665555552 -0.1664020193 -0.1662450537 [401] -0.1660847025 > mx [1] 0.1693971 > mxli [1] 1.62 > 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/1d7661229458873.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/2dkrk1229458873.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/3itbf1229458874.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/4yc7n1229458874.tab") > > system("convert tmp/1d7661229458873.ps tmp/1d7661229458873.png") > system("convert tmp/2dkrk1229458873.ps tmp/2dkrk1229458873.png") > system("convert tmp/3itbf1229458874.ps tmp/3itbf1229458874.png") > > > proc.time() user system elapsed 1.196 0.786 1.307