R version 2.7.0 (2008-04-22) 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(15.59,13.17,11.20,13.30,10.78,11.60,15.18,15.87,12.58,11.43,10.30,11.17,11.26,11.20,9.99,11.17,10.29,10.47,14.36,16.06,14.47,13.24,13.03,14.43,13.98,13.62,12.20,12.24,12.07,12.30,16.12,18.38,14.59,12.96,14.14,13.92,14.24,14.10,12.91,13.69,14.11,13.99,17.93,21.37,16.25,14.53,15.36,14.95,15.95,15.25,12.67,13.86,14.65,12.41,17.46,18.95,15.33,15.31,14.84,14.75,15.83,14.83,13.00,13.92,13.94,12.54,18.12,17.83,14.41,15.18,12.99,13.06,12.81,12.95,10.48,13.23,11.80,11.69,15.33,14.89,12.92,11.27,10.68,11.55) > #'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.1362779 0.1362140 0.1361500 0.1360860 0.1360219 0.1359577 0.1358935 [8] 0.1358291 0.1357647 0.1357003 0.1356357 0.1355711 0.1355064 0.1354416 [15] 0.1353768 0.1353119 0.1352469 0.1351818 0.1351167 0.1350515 0.1349862 [22] 0.1349209 0.1348554 0.1347899 0.1347244 0.1346587 0.1345930 0.1345272 [29] 0.1344613 0.1343954 0.1343294 0.1342633 0.1341971 0.1341309 0.1340646 [36] 0.1339982 0.1339318 0.1338652 0.1337986 0.1337320 0.1336652 0.1335984 [43] 0.1335315 0.1334645 0.1333975 0.1333304 0.1332632 0.1331959 0.1331286 [50] 0.1330612 0.1329937 0.1329262 0.1328585 0.1327909 0.1327231 0.1326552 [57] 0.1325873 0.1325193 0.1324513 0.1323831 0.1323149 0.1322466 0.1321783 [64] 0.1321099 0.1320414 0.1319728 0.1319041 0.1318354 0.1317666 0.1316978 [71] 0.1316288 0.1315598 0.1314907 0.1314216 0.1313523 0.1312830 0.1312137 [78] 0.1311442 0.1310747 0.1310051 0.1309354 0.1308657 0.1307959 0.1307260 [85] 0.1306561 0.1305860 0.1305159 0.1304458 0.1303755 0.1303052 0.1302348 [92] 0.1301644 0.1300938 0.1300232 0.1299525 0.1298818 0.1298110 0.1297401 [99] 0.1296691 0.1295980 0.1295269 0.1294558 0.1293845 0.1293132 0.1292418 [106] 0.1291703 0.1290987 0.1290271 0.1289554 0.1288837 0.1288119 0.1287399 [113] 0.1286680 0.1285959 0.1285238 0.1284516 0.1283794 0.1283070 0.1282346 [120] 0.1281621 0.1280896 0.1280170 0.1279443 0.1278715 0.1277987 0.1277258 [127] 0.1276528 0.1275797 0.1275066 0.1274334 0.1273602 0.1272868 0.1272134 [134] 0.1271400 0.1270664 0.1269928 0.1269191 0.1268453 0.1267715 0.1266976 [141] 0.1266236 0.1265496 0.1264755 0.1264013 0.1263271 0.1262527 0.1261783 [148] 0.1261039 0.1260293 0.1259547 0.1258801 0.1258053 0.1257305 0.1256556 [155] 0.1255806 0.1255056 0.1254305 0.1253554 0.1252801 0.1252048 0.1251294 [162] 0.1250540 0.1249785 0.1249029 0.1248272 0.1247515 0.1246757 0.1245999 [169] 0.1245239 0.1244479 0.1243719 0.1242957 0.1242195 0.1241432 0.1240669 [176] 0.1239905 0.1239140 0.1238374 0.1237608 0.1236841 0.1236074 0.1235305 [183] 0.1234536 0.1233767 0.1232996 0.1232225 0.1231454 0.1230681 0.1229908 [190] 0.1229135 0.1228360 0.1227585 0.1226809 0.1226033 0.1225256 0.1224478 [197] 0.1223699 0.1222920 0.1222140 0.1221360 0.1220579 0.1219797 0.1219014 [204] 0.1218231 0.1217447 0.1216663 0.1215878 0.1215092 0.1214305 0.1213518 [211] 0.1212730 0.1211942 0.1211153 0.1210363 0.1209572 0.1208781 0.1207989 [218] 0.1207197 0.1206404 0.1205610 0.1204815 0.1204020 0.1203225 0.1202428 [225] 0.1201631 0.1200833 0.1200035 0.1199236 0.1198436 0.1197636 0.1196835 [232] 0.1196034 0.1195231 0.1194428 0.1193625 0.1192821 0.1192016 0.1191210 [239] 0.1190404 0.1189598 0.1188790 0.1187982 0.1187174 0.1186364 0.1185555 [246] 0.1184744 0.1183933 0.1183121 0.1182309 0.1181496 0.1180682 0.1179868 [253] 0.1179053 0.1178237 0.1177421 0.1176604 0.1175787 0.1174969 0.1174150 [260] 0.1173331 0.1172511 0.1171690 0.1170869 0.1170048 0.1169225 0.1168402 [267] 0.1167579 0.1166755 0.1165930 0.1165105 0.1164279 0.1163452 0.1162625 [274] 0.1161797 0.1160969 0.1160140 0.1159310 0.1158480 0.1157649 0.1156818 [281] 0.1155986 0.1155154 0.1154321 0.1153487 0.1152653 0.1151818 0.1150982 [288] 0.1150146 0.1149310 0.1148473 0.1147635 0.1146796 0.1145958 0.1145118 [295] 0.1144278 0.1143437 0.1142596 0.1141754 0.1140912 0.1140069 0.1139226 [302] 0.1138382 0.1137537 0.1136692 0.1135846 0.1135000 0.1134153 0.1133306 [309] 0.1132458 0.1131610 0.1130761 0.1129911 0.1129061 0.1128211 0.1127359 [316] 0.1126508 0.1125655 0.1124803 0.1123949 0.1123096 0.1122241 0.1121386 [323] 0.1120531 0.1119675 0.1118818 0.1117961 0.1117104 0.1116246 0.1115387 [330] 0.1114528 0.1113669 0.1112808 0.1111948 0.1111087 0.1110225 0.1109363 [337] 0.1108500 0.1107637 0.1106773 0.1105909 0.1105045 0.1104180 0.1103314 [344] 0.1102448 0.1101581 0.1100714 0.1099846 0.1098978 0.1098110 0.1097241 [351] 0.1096371 0.1095501 0.1094631 0.1093760 0.1092888 0.1092016 0.1091144 [358] 0.1090271 0.1089398 0.1088524 0.1087650 0.1086775 0.1085900 0.1085025 [365] 0.1084149 0.1083272 0.1082395 0.1081518 0.1080640 0.1079762 0.1078883 [372] 0.1078004 0.1077124 0.1076244 0.1075364 0.1074483 0.1073602 0.1072720 [379] 0.1071838 0.1070955 0.1070072 0.1069189 0.1068305 0.1067421 0.1066536 [386] 0.1065651 0.1064766 0.1063880 0.1062994 0.1062107 0.1061220 0.1060332 [393] 0.1059444 0.1058556 0.1057668 0.1056779 0.1055889 0.1054999 0.1054109 [400] 0.1053219 0.1052328 > mx [1] 0.1362779 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1x7zg1229548860.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/2yfxa1229548860.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/3ad4h1229548860.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/4w65q1229548861.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/5tpmz1229548861.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/689ep1229548861.tab") > > system("convert tmp/1x7zg1229548860.ps tmp/1x7zg1229548860.png") > system("convert tmp/2yfxa1229548860.ps tmp/2yfxa1229548860.png") > system("convert tmp/3ad4h1229548860.ps tmp/3ad4h1229548860.png") > system("convert tmp/4w65q1229548861.ps tmp/4w65q1229548861.png") > system("convert tmp/5tpmz1229548861.ps tmp/5tpmz1229548861.png") > > > proc.time() user system elapsed 2.447 1.373 2.617