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(109.1,113.8,97.4,72.5,82.7,88.9,105.9,100.8,94,105,58.5,87.6,113.1,112.5,89.6,74.5,82.7,90.1,109.4,96,89.2,109.1,49.1,92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84,103.3,88.5,99,105.9,44.7,94,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6,104.7) > x <- c(4.43,4.61,4.54,4.2,4.08,3.95,4.19,4.23,3.89,3.92,4.14,4.24,4.08,4.37,4.43,4.3,4.27,4.06,3.96,4.21,4.31,4.35,4.25,4.06,4,3.87,3.71,3.63,3.48,3.6,3.66,3.45,3.3,3.14,3.21,3.12,3.14,3.4,3.42,3.29,3.49,3.52,3.81,4.03,3.98,4.1,3.96,3.83,3.72,3.82,3.76,3.98,4.14,4,4.13,4.28,4.46,4.63,4.49,4.41,4.5,4.39,4.33,4.45,4.17,4.13,4.33,4.47,4.63,4.9) > #'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.1376161 0.1376695 0.1377228 0.1377761 0.1378293 0.1378826 0.1379358 [8] 0.1379889 0.1380421 0.1380952 0.1381482 0.1382013 0.1382543 0.1383073 [15] 0.1383603 0.1384132 0.1384661 0.1385190 0.1385718 0.1386246 0.1386774 [22] 0.1387302 0.1387829 0.1388356 0.1388882 0.1389409 0.1389935 0.1390460 [29] 0.1390986 0.1391511 0.1392036 0.1392560 0.1393084 0.1393608 0.1394132 [36] 0.1394655 0.1395178 0.1395701 0.1396223 0.1396746 0.1397267 0.1397789 [43] 0.1398310 0.1398831 0.1399351 0.1399872 0.1400392 0.1400911 0.1401431 [50] 0.1401950 0.1402469 0.1402987 0.1403505 0.1404023 0.1404540 0.1405058 [57] 0.1405575 0.1406091 0.1406607 0.1407123 0.1407639 0.1408154 0.1408670 [64] 0.1409184 0.1409699 0.1410213 0.1410727 0.1411240 0.1411753 0.1412266 [71] 0.1412779 0.1413291 0.1413803 0.1414315 0.1414826 0.1415337 0.1415848 [78] 0.1416358 0.1416868 0.1417378 0.1417888 0.1418397 0.1418906 0.1419414 [85] 0.1419922 0.1420430 0.1420938 0.1421445 0.1421952 0.1422459 0.1422965 [92] 0.1423471 0.1423977 0.1424482 0.1424987 0.1425492 0.1425997 0.1426501 [99] 0.1427004 0.1427508 0.1428011 0.1428514 0.1429017 0.1429519 0.1430021 [106] 0.1430522 0.1431024 0.1431525 0.1432025 0.1432526 0.1433026 0.1433525 [113] 0.1434025 0.1434524 0.1435022 0.1435521 0.1436019 0.1436517 0.1437014 [120] 0.1437511 0.1438008 0.1438505 0.1439001 0.1439497 0.1439992 0.1440487 [127] 0.1440982 0.1441477 0.1441971 0.1442465 0.1442959 0.1443452 0.1443945 [134] 0.1444438 0.1444930 0.1445422 0.1445914 0.1446405 0.1446896 0.1447387 [141] 0.1447877 0.1448367 0.1448857 0.1449346 0.1449836 0.1450324 0.1450813 [148] 0.1451301 0.1451789 0.1452276 0.1452763 0.1453250 0.1453737 0.1454223 [155] 0.1454709 0.1455194 0.1455679 0.1456164 0.1456649 0.1457133 0.1457617 [162] 0.1458101 0.1458584 0.1459067 0.1459549 0.1460032 0.1460513 0.1460995 [169] 0.1461476 0.1461957 0.1462438 0.1462918 0.1463398 0.1463878 0.1464357 [176] 0.1464836 0.1465315 0.1465793 0.1466271 0.1466749 0.1467226 0.1467703 [183] 0.1468180 0.1468656 0.1469132 0.1469608 0.1470083 0.1470558 0.1471033 [190] 0.1471507 0.1471981 0.1472455 0.1472929 0.1473402 0.1473874 0.1474347 [197] 0.1474819 0.1475290 0.1475762 0.1476233 0.1476704 0.1477174 0.1477644 [204] 0.1478114 0.1478583 0.1479052 0.1479521 0.1479990 0.1480458 0.1480925 [211] 0.1481393 0.1481860 0.1482327 0.1482793 0.1483259 0.1483725 0.1484190 [218] 0.1484655 0.1485120 0.1485584 0.1486049 0.1486512 0.1486976 0.1487439 [225] 0.1487901 0.1488364 0.1488826 0.1489288 0.1489749 0.1490210 0.1490671 [232] 0.1491131 0.1491591 0.1492051 0.1492510 0.1492970 0.1493428 0.1493887 [239] 0.1494345 0.1494802 0.1495260 0.1495717 0.1496173 0.1496630 0.1497086 [246] 0.1497542 0.1497997 0.1498452 0.1498907 0.1499361 0.1499815 0.1500269 [253] 0.1500722 0.1501175 0.1501628 0.1502080 0.1502532 0.1502984 0.1503435 [260] 0.1503886 0.1504337 0.1504787 0.1505237 0.1505686 0.1506136 0.1506585 [267] 0.1507033 0.1507481 0.1507929 0.1508377 0.1508824 0.1509271 0.1509718 [274] 0.1510164 0.1510610 0.1511055 0.1511501 0.1511945 0.1512390 0.1512834 [281] 0.1513278 0.1513722 0.1514165 0.1514608 0.1515050 0.1515492 0.1515934 [288] 0.1516376 0.1516817 0.1517257 0.1517698 0.1518138 0.1518578 0.1519017 [295] 0.1519456 0.1519895 0.1520334 0.1520772 0.1521209 0.1521647 0.1522084 [302] 0.1522520 0.1522957 0.1523393 0.1523829 0.1524264 0.1524699 0.1525134 [309] 0.1525568 0.1526002 0.1526435 0.1526869 0.1527302 0.1527734 0.1528167 [316] 0.1528599 0.1529030 0.1529461 0.1529892 0.1530323 0.1530753 0.1531183 [323] 0.1531612 0.1532042 0.1532470 0.1532899 0.1533327 0.1533755 0.1534182 [330] 0.1534609 0.1535036 0.1535463 0.1535889 0.1536315 0.1536740 0.1537165 [337] 0.1537590 0.1538014 0.1538438 0.1538862 0.1539285 0.1539708 0.1540131 [344] 0.1540553 0.1540975 0.1541397 0.1541818 0.1542239 0.1542660 0.1543080 [351] 0.1543500 0.1543919 0.1544339 0.1544757 0.1545176 0.1545594 0.1546012 [358] 0.1546430 0.1546847 0.1547263 0.1547680 0.1548096 0.1548512 0.1548927 [365] 0.1549342 0.1549757 0.1550171 0.1550586 0.1550999 0.1551413 0.1551826 [372] 0.1552238 0.1552651 0.1553063 0.1553474 0.1553886 0.1554296 0.1554707 [379] 0.1555117 0.1555527 0.1555937 0.1556346 0.1556755 0.1557163 0.1557572 [386] 0.1557979 0.1558387 0.1558794 0.1559201 0.1559607 0.1560013 0.1560419 [393] 0.1560825 0.1561230 0.1561634 0.1562039 0.1562443 0.1562846 0.1563250 [400] 0.1563653 0.1564055 > mx [1] 0.1564055 > 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/10h9f1228484091.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/27zpn1228484091.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/3ndi61228484091.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/4eviz1228484091.tab") > > system("convert tmp/10h9f1228484091.ps tmp/10h9f1228484091.png") > system("convert tmp/27zpn1228484091.ps tmp/27zpn1228484091.png") > system("convert tmp/3ndi61228484091.ps tmp/3ndi61228484091.png") > > > proc.time() user system elapsed 0.793 0.507 0.937