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. > x <- c(6.3,6.1,6.1,6.3,6.3,6,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8,8.1,8.2,8.3,8.2,8,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7) > #'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(qnorm(ppoints(x), mean=0, sd=1),x1) + if (mx < c[i]) + { + mx <- c[i] + mxli <- l[i] + } + } > c [1] 0.1823748 0.1822114 0.1820480 0.1818846 0.1817212 0.1815577 0.1813942 [8] 0.1812307 0.1810672 0.1809037 0.1807402 0.1805766 0.1804130 0.1802494 [15] 0.1800858 0.1799222 0.1797585 0.1795949 0.1794312 0.1792675 0.1791038 [22] 0.1789401 0.1787764 0.1786127 0.1784489 0.1782851 0.1781214 0.1779576 [29] 0.1777938 0.1776299 0.1774661 0.1773023 0.1771384 0.1769746 0.1768107 [36] 0.1766468 0.1764829 0.1763190 0.1761551 0.1759912 0.1758272 0.1756633 [43] 0.1754994 0.1753354 0.1751714 0.1750075 0.1748435 0.1746795 0.1745155 [50] 0.1743515 0.1741875 0.1740235 0.1738594 0.1736954 0.1735314 0.1733673 [57] 0.1732033 0.1730393 0.1728752 0.1727111 0.1725471 0.1723830 0.1722189 [64] 0.1720549 0.1718908 0.1717267 0.1715626 0.1713986 0.1712345 0.1710704 [71] 0.1709063 0.1707422 0.1705781 0.1704140 0.1702500 0.1700859 0.1699218 [78] 0.1697577 0.1695936 0.1694295 0.1692654 0.1691013 0.1689373 0.1687732 [85] 0.1686091 0.1684450 0.1682809 0.1681169 0.1679528 0.1677887 0.1676247 [92] 0.1674606 0.1672966 0.1671325 0.1669685 0.1668044 0.1666404 0.1664764 [99] 0.1663124 0.1661483 0.1659843 0.1658203 0.1656563 0.1654924 0.1653284 [106] 0.1651644 0.1650004 0.1648365 0.1646725 0.1645086 0.1643447 0.1641807 [113] 0.1640168 0.1638529 0.1636890 0.1635252 0.1633613 0.1631974 0.1630336 [120] 0.1628697 0.1627059 0.1625421 0.1623783 0.1622145 0.1620507 0.1618870 [127] 0.1617232 0.1615595 0.1613957 0.1612320 0.1610683 0.1609046 0.1607410 [134] 0.1605773 0.1604137 0.1602501 0.1600864 0.1599229 0.1597593 0.1595957 [141] 0.1594322 0.1592687 0.1591051 0.1589417 0.1587782 0.1586147 0.1584513 [148] 0.1582879 0.1581245 0.1579611 0.1577977 0.1576344 0.1574711 0.1573078 [155] 0.1571445 0.1569812 0.1568180 0.1566547 0.1564915 0.1563284 0.1561652 [162] 0.1560021 0.1558390 0.1556759 0.1555128 0.1553498 0.1551867 0.1550237 [169] 0.1548608 0.1546978 0.1545349 0.1543720 0.1542091 0.1540463 0.1538834 [176] 0.1537206 0.1535579 0.1533951 0.1532324 0.1530697 0.1529070 0.1527444 [183] 0.1525818 0.1524192 0.1522566 0.1520941 0.1519316 0.1517691 0.1516067 [190] 0.1514443 0.1512819 0.1511195 0.1509572 0.1507949 0.1506326 0.1504704 [197] 0.1503082 0.1501460 0.1499839 0.1498217 0.1496597 0.1494976 0.1493356 [204] 0.1491736 0.1490117 0.1488497 0.1486879 0.1485260 0.1483642 0.1482024 [211] 0.1480406 0.1478789 0.1477173 0.1475556 0.1473940 0.1472324 0.1470709 [218] 0.1469094 0.1467479 0.1465865 0.1464251 0.1462637 0.1461024 0.1459411 [225] 0.1457799 0.1456187 0.1454575 0.1452963 0.1451353 0.1449742 0.1448132 [232] 0.1446522 0.1444913 0.1443304 0.1441695 0.1440087 0.1438479 0.1436872 [239] 0.1435265 0.1433658 0.1432052 0.1430446 0.1428841 0.1427236 0.1425632 [246] 0.1424028 0.1422424 0.1420821 0.1419218 0.1417616 0.1416014 0.1414413 [253] 0.1412812 0.1411211 0.1409611 0.1408011 0.1406412 0.1404813 0.1403215 [260] 0.1401617 0.1400020 0.1398423 0.1396827 0.1395231 0.1393635 0.1392040 [267] 0.1390446 0.1388851 0.1387258 0.1385665 0.1384072 0.1382480 0.1380888 [274] 0.1379297 0.1377706 0.1376116 0.1374527 0.1372937 0.1371349 0.1369760 [281] 0.1368173 0.1366586 0.1364999 0.1363413 0.1361827 0.1360242 0.1358657 [288] 0.1357073 0.1355490 0.1353907 0.1352324 0.1350742 0.1349161 0.1347580 [295] 0.1346000 0.1344420 0.1342840 0.1341262 0.1339684 0.1338106 0.1336529 [302] 0.1334952 0.1333376 0.1331801 0.1330226 0.1328652 0.1327078 0.1325505 [309] 0.1323932 0.1322360 0.1320789 0.1319218 0.1317647 0.1316078 0.1314508 [316] 0.1312940 0.1311372 0.1309804 0.1308238 0.1306671 0.1305106 0.1303541 [323] 0.1301976 0.1300412 0.1298849 0.1297286 0.1295724 0.1294163 0.1292602 [330] 0.1291042 0.1289482 0.1287923 0.1286365 0.1284807 0.1283250 0.1281694 [337] 0.1280138 0.1278582 0.1277028 0.1275474 0.1273920 0.1272368 0.1270816 [344] 0.1269264 0.1267713 0.1266163 0.1264614 0.1263065 0.1261517 0.1259969 [351] 0.1258422 0.1256876 0.1255330 0.1253785 0.1252241 0.1250698 0.1249155 [358] 0.1247612 0.1246071 0.1244530 0.1242990 0.1241450 0.1239911 0.1238373 [365] 0.1236835 0.1235299 0.1233762 0.1232227 0.1230692 0.1229158 0.1227625 [372] 0.1226092 0.1224560 0.1223029 0.1221498 0.1219968 0.1218439 0.1216910 [379] 0.1215382 0.1213855 0.1212329 0.1210803 0.1209278 0.1207754 0.1206231 [386] 0.1204708 0.1203186 0.1201665 0.1200144 0.1198624 0.1197105 0.1195586 [393] 0.1194069 0.1192552 0.1191036 0.1189520 0.1188005 0.1186491 0.1184978 [400] 0.1183466 0.1181954 > mx [1] 0.1823748 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/16ile1257697750.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Normality Plot',xlab='Lambda',ylab='correlation') > mtext(paste('Optimal Lambda =',mxli)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/25cqm1257697750.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x,main='Histogram of Original Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3uwe61257697750.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x1,main='Histogram of Transformed Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/42eq81257697750.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5x8sx1257697750.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > qqline(x1) > grid() > mtext('Transformed Data') > 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 Normality 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',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/6761p1257697750.tab") > > system("convert tmp/16ile1257697750.ps tmp/16ile1257697750.png") > system("convert tmp/25cqm1257697750.ps tmp/25cqm1257697750.png") > system("convert tmp/3uwe61257697750.ps tmp/3uwe61257697750.png") > system("convert tmp/42eq81257697750.ps tmp/42eq81257697750.png") > system("convert tmp/5x8sx1257697750.ps tmp/5x8sx1257697750.png") > > > proc.time() user system elapsed 1.106 0.815 1.472