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. > x <- c(123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.4) > #'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.1583080 0.1582620 0.1582160 0.1581699 0.1581238 0.1580778 0.1580316 [8] 0.1579855 0.1579394 0.1578932 0.1578470 0.1578008 0.1577546 0.1577083 [15] 0.1576621 0.1576158 0.1575695 0.1575231 0.1574768 0.1574304 0.1573841 [22] 0.1573377 0.1572912 0.1572448 0.1571983 0.1571519 0.1571054 0.1570589 [29] 0.1570123 0.1569658 0.1569192 0.1568726 0.1568260 0.1567794 0.1567328 [36] 0.1566861 0.1566394 0.1565928 0.1565460 0.1564993 0.1564526 0.1564058 [43] 0.1563590 0.1563122 0.1562654 0.1562186 0.1561718 0.1561249 0.1560780 [50] 0.1560311 0.1559842 0.1559373 0.1558903 0.1558434 0.1557964 0.1557494 [57] 0.1557024 0.1556554 0.1556083 0.1555613 0.1555142 0.1554671 0.1554200 [64] 0.1553729 0.1553257 0.1552786 0.1552314 0.1551842 0.1551370 0.1550898 [71] 0.1550426 0.1549953 0.1549481 0.1549008 0.1548535 0.1548062 0.1547589 [78] 0.1547115 0.1546642 0.1546168 0.1545695 0.1545221 0.1544747 0.1544272 [85] 0.1543798 0.1543324 0.1542849 0.1542374 0.1541899 0.1541424 0.1540949 [92] 0.1540474 0.1539998 0.1539523 0.1539047 0.1538571 0.1538095 0.1537619 [99] 0.1537143 0.1536667 0.1536190 0.1535714 0.1535237 0.1534760 0.1534283 [106] 0.1533806 0.1533329 0.1532851 0.1532374 0.1531896 0.1531419 0.1530941 [113] 0.1530463 0.1529985 0.1529507 0.1529028 0.1528550 0.1528071 0.1527593 [120] 0.1527114 0.1526635 0.1526156 0.1525677 0.1525198 0.1524718 0.1524239 [127] 0.1523759 0.1523280 0.1522800 0.1522320 0.1521840 0.1521360 0.1520880 [134] 0.1520399 0.1519919 0.1519438 0.1518958 0.1518477 0.1517996 0.1517515 [141] 0.1517034 0.1516553 0.1516072 0.1515591 0.1515109 0.1514628 0.1514146 [148] 0.1513665 0.1513183 0.1512701 0.1512219 0.1511737 0.1511255 0.1510773 [155] 0.1510290 0.1509808 0.1509326 0.1508843 0.1508360 0.1507878 0.1507395 [162] 0.1506912 0.1506429 0.1505946 0.1505463 0.1504980 0.1504496 0.1504013 [169] 0.1503529 0.1503046 0.1502562 0.1502079 0.1501595 0.1501111 0.1500627 [176] 0.1500143 0.1499659 0.1499175 0.1498691 0.1498207 0.1497722 0.1497238 [183] 0.1496753 0.1496269 0.1495784 0.1495300 0.1494815 0.1494330 0.1493845 [190] 0.1493360 0.1492876 0.1492390 0.1491905 0.1491420 0.1490935 0.1490450 [197] 0.1489964 0.1489479 0.1488994 0.1488508 0.1488023 0.1487537 0.1487051 [204] 0.1486566 0.1486080 0.1485594 0.1485108 0.1484622 0.1484137 0.1483651 [211] 0.1483164 0.1482678 0.1482192 0.1481706 0.1481220 0.1480734 0.1480247 [218] 0.1479761 0.1479275 0.1478788 0.1478302 0.1477815 0.1477329 0.1476842 [225] 0.1476356 0.1475869 0.1475382 0.1474896 0.1474409 0.1473922 0.1473435 [232] 0.1472948 0.1472462 0.1471975 0.1471488 0.1471001 0.1470514 0.1470027 [239] 0.1469540 0.1469053 0.1468566 0.1468078 0.1467591 0.1467104 0.1466617 [246] 0.1466130 0.1465643 0.1465155 0.1464668 0.1464181 0.1463693 0.1463206 [253] 0.1462719 0.1462232 0.1461744 0.1461257 0.1460769 0.1460282 0.1459795 [260] 0.1459307 0.1458820 0.1458332 0.1457845 0.1457357 0.1456870 0.1456382 [267] 0.1455895 0.1455408 0.1454920 0.1454433 0.1453945 0.1453458 0.1452970 [274] 0.1452483 0.1451995 0.1451508 0.1451020 0.1450533 0.1450045 0.1449558 [281] 0.1449070 0.1448583 0.1448095 0.1447608 0.1447120 0.1446633 0.1446145 [288] 0.1445658 0.1445170 0.1444683 0.1444196 0.1443708 0.1443221 0.1442733 [295] 0.1442246 0.1441759 0.1441271 0.1440784 0.1440297 0.1439809 0.1439322 [302] 0.1438835 0.1438348 0.1437861 0.1437373 0.1436886 0.1436399 0.1435912 [309] 0.1435425 0.1434938 0.1434451 0.1433964 0.1433477 0.1432990 0.1432503 [316] 0.1432016 0.1431529 0.1431042 0.1430555 0.1430068 0.1429582 0.1429095 [323] 0.1428608 0.1428122 0.1427635 0.1427148 0.1426662 0.1426175 0.1425689 [330] 0.1425202 0.1424716 0.1424230 0.1423743 0.1423257 0.1422771 0.1422284 [337] 0.1421798 0.1421312 0.1420826 0.1420340 0.1419854 0.1419368 0.1418882 [344] 0.1418396 0.1417910 0.1417425 0.1416939 0.1416453 0.1415968 0.1415482 [351] 0.1414997 0.1414511 0.1414026 0.1413540 0.1413055 0.1412570 0.1412085 [358] 0.1411600 0.1411115 0.1410629 0.1410145 0.1409660 0.1409175 0.1408690 [365] 0.1408205 0.1407721 0.1407236 0.1406751 0.1406267 0.1405783 0.1405298 [372] 0.1404814 0.1404330 0.1403846 0.1403362 0.1402878 0.1402394 0.1401910 [379] 0.1401426 0.1400942 0.1400459 0.1399975 0.1399491 0.1399008 0.1398525 [386] 0.1398041 0.1397558 0.1397075 0.1396592 0.1396109 0.1395626 0.1395143 [393] 0.1394660 0.1394178 0.1393695 0.1393213 0.1392730 0.1392248 0.1391766 [400] 0.1391283 0.1390801 > mx [1] 0.158308 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/19rkv1226610864.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/freestat/rcomp/tmp/25o221226610864.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/freestat/rcomp/tmp/3iezd1226610864.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/freestat/rcomp/tmp/4vpx11226610864.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/freestat/rcomp/tmp/5adg51226610864.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/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 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/freestat/rcomp/tmp/6fgj31226610864.tab") > > system("convert tmp/19rkv1226610864.ps tmp/19rkv1226610864.png") > system("convert tmp/25o221226610864.ps tmp/25o221226610864.png") > system("convert tmp/3iezd1226610864.ps tmp/3iezd1226610864.png") > system("convert tmp/4vpx11226610864.ps tmp/4vpx11226610864.png") > system("convert tmp/5adg51226610864.ps tmp/5adg51226610864.png") > > > proc.time() user system elapsed 1.680 1.250 1.833