R version 2.7.2 (2008-08-25) 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(103.2,102.9,102.6,102.3,102.1,101.5,101.1,101.9,101.5,101.5,102.0,101.5,101.6,101.5,101.9,102.0,102.0,102.2,102.2,102.3,102.0,101.8,101.8,101.6,101.9,102.3,102.4,102.1,102.3,102.2) > #'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.1393366 -0.1393559 -0.1393751 -0.1393944 -0.1394137 -0.1394329 [7] -0.1394522 -0.1394715 -0.1394907 -0.1395100 -0.1395293 -0.1395486 [13] -0.1395678 -0.1395871 -0.1396064 -0.1396256 -0.1396449 -0.1396642 [19] -0.1396834 -0.1397027 -0.1397220 -0.1397413 -0.1397605 -0.1397798 [25] -0.1397991 -0.1398183 -0.1398376 -0.1398569 -0.1398762 -0.1398954 [31] -0.1399147 -0.1399340 -0.1399532 -0.1399725 -0.1399918 -0.1400111 [37] -0.1400303 -0.1400496 -0.1400689 -0.1400882 -0.1401074 -0.1401267 [43] -0.1401460 -0.1401653 -0.1401845 -0.1402038 -0.1402231 -0.1402424 [49] -0.1402616 -0.1402809 -0.1403002 -0.1403195 -0.1403387 -0.1403580 [55] -0.1403773 -0.1403966 -0.1404158 -0.1404351 -0.1404544 -0.1404737 [61] -0.1404929 -0.1405122 -0.1405315 -0.1405508 -0.1405701 -0.1405893 [67] -0.1406086 -0.1406279 -0.1406472 -0.1406664 -0.1406857 -0.1407050 [73] -0.1407243 -0.1407436 -0.1407628 -0.1407821 -0.1408014 -0.1408207 [79] -0.1408400 -0.1408592 -0.1408785 -0.1408978 -0.1409171 -0.1409364 [85] -0.1409556 -0.1409749 -0.1409942 -0.1410135 -0.1410328 -0.1410521 [91] -0.1410713 -0.1410906 -0.1411099 -0.1411292 -0.1411485 -0.1411677 [97] -0.1411870 -0.1412063 -0.1412256 -0.1412449 -0.1412642 -0.1412834 [103] -0.1413027 -0.1413220 -0.1413413 -0.1413606 -0.1413799 -0.1413991 [109] -0.1414184 -0.1414377 -0.1414570 -0.1414763 -0.1414956 -0.1415149 [115] -0.1415341 -0.1415534 -0.1415727 -0.1415920 -0.1416113 -0.1416306 [121] -0.1416499 -0.1416691 -0.1416884 -0.1417077 -0.1417270 -0.1417463 [127] -0.1417656 -0.1417849 -0.1418042 -0.1418234 -0.1418427 -0.1418620 [133] -0.1418813 -0.1419006 -0.1419199 -0.1419392 -0.1419585 -0.1419777 [139] -0.1419970 -0.1420163 -0.1420356 -0.1420549 -0.1420742 -0.1420935 [145] -0.1421128 -0.1421321 -0.1421514 -0.1421706 -0.1421899 -0.1422092 [151] -0.1422285 -0.1422478 -0.1422671 -0.1422864 -0.1423057 -0.1423250 [157] -0.1423443 -0.1423636 -0.1423828 -0.1424021 -0.1424214 -0.1424407 [163] -0.1424600 -0.1424793 -0.1424986 -0.1425179 -0.1425372 -0.1425565 [169] -0.1425758 -0.1425951 -0.1426144 -0.1426337 -0.1426530 -0.1426722 [175] -0.1426915 -0.1427108 -0.1427301 -0.1427494 -0.1427687 -0.1427880 [181] -0.1428073 -0.1428266 -0.1428459 -0.1428652 -0.1428845 -0.1429038 [187] -0.1429231 -0.1429424 -0.1429617 -0.1429810 -0.1430003 -0.1430196 [193] -0.1430389 -0.1430582 -0.1430775 -0.1430968 -0.1431161 -0.1431354 [199] -0.1431546 -0.1431739 -0.1431932 -0.1432125 -0.1432318 -0.1432511 [205] -0.1432704 -0.1432897 -0.1433090 -0.1433283 -0.1433476 -0.1433669 [211] -0.1433862 -0.1434055 -0.1434248 -0.1434441 -0.1434634 -0.1434827 [217] -0.1435020 -0.1435213 -0.1435406 -0.1435599 -0.1435792 -0.1435985 [223] -0.1436178 -0.1436371 -0.1436564 -0.1436757 -0.1436950 -0.1437143 [229] -0.1437336 -0.1437530 -0.1437723 -0.1437916 -0.1438109 -0.1438302 [235] -0.1438495 -0.1438688 -0.1438881 -0.1439074 -0.1439267 -0.1439460 [241] -0.1439653 -0.1439846 -0.1440039 -0.1440232 -0.1440425 -0.1440618 [247] -0.1440811 -0.1441004 -0.1441197 -0.1441390 -0.1441583 -0.1441776 [253] -0.1441969 -0.1442162 -0.1442356 -0.1442549 -0.1442742 -0.1442935 [259] -0.1443128 -0.1443321 -0.1443514 -0.1443707 -0.1443900 -0.1444093 [265] -0.1444286 -0.1444479 -0.1444672 -0.1444865 -0.1445058 -0.1445252 [271] -0.1445445 -0.1445638 -0.1445831 -0.1446024 -0.1446217 -0.1446410 [277] -0.1446603 -0.1446796 -0.1446989 -0.1447182 -0.1447375 -0.1447569 [283] -0.1447762 -0.1447955 -0.1448148 -0.1448341 -0.1448534 -0.1448727 [289] -0.1448920 -0.1449113 -0.1449306 -0.1449500 -0.1449693 -0.1449886 [295] -0.1450079 -0.1450272 -0.1450465 -0.1450658 -0.1450851 -0.1451044 [301] -0.1451238 -0.1451431 -0.1451624 -0.1451817 -0.1452010 -0.1452203 [307] -0.1452396 -0.1452589 -0.1452783 -0.1452976 -0.1453169 -0.1453362 [313] -0.1453555 -0.1453748 -0.1453941 -0.1454135 -0.1454328 -0.1454521 [319] -0.1454714 -0.1454907 -0.1455100 -0.1455293 -0.1455487 -0.1455680 [325] -0.1455873 -0.1456066 -0.1456259 -0.1456452 -0.1456645 -0.1456839 [331] -0.1457032 -0.1457225 -0.1457418 -0.1457611 -0.1457804 -0.1457998 [337] -0.1458191 -0.1458384 -0.1458577 -0.1458770 -0.1458963 -0.1459157 [343] -0.1459350 -0.1459543 -0.1459736 -0.1459929 -0.1460122 -0.1460316 [349] -0.1460509 -0.1460702 -0.1460895 -0.1461088 -0.1461282 -0.1461475 [355] -0.1461668 -0.1461861 -0.1462054 -0.1462248 -0.1462441 -0.1462634 [361] -0.1462827 -0.1463020 -0.1463213 -0.1463407 -0.1463600 -0.1463793 [367] -0.1463986 -0.1464180 -0.1464373 -0.1464566 -0.1464759 -0.1464952 [373] -0.1465146 -0.1465339 -0.1465532 -0.1465725 -0.1465918 -0.1466112 [379] -0.1466305 -0.1466498 -0.1466691 -0.1466885 -0.1467078 -0.1467271 [385] -0.1467464 -0.1467657 -0.1467851 -0.1468044 -0.1468237 -0.1468430 [391] -0.1468624 -0.1468817 -0.1469010 -0.1469203 -0.1469397 -0.1469590 [397] -0.1469783 -0.1469976 -0.1470169 -0.1470363 -0.1470556 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1g3h91226592503.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/28fex1226592503.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/3ove61226592503.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/42mf61226592503.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/51muw1226592503.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/6efxy1226592503.tab") > > system("convert tmp/1g3h91226592503.ps tmp/1g3h91226592503.png") > system("convert tmp/28fex1226592503.ps tmp/28fex1226592503.png") > system("convert tmp/3ove61226592503.ps tmp/3ove61226592503.png") > system("convert tmp/42mf61226592503.ps tmp/42mf61226592503.png") > system("convert tmp/51muw1226592503.ps tmp/51muw1226592503.png") > > > proc.time() user system elapsed 1.382 0.875 2.417