R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(112,128,132,129,121,148,148,136,119,104,118,115,126,141,135,125,149,170,170,158,133,114,140,145,150,178,163,172,178,199,199,184,162,146,166,171,180,193,181,183,218,230,242,209,191,172,194,196,196,236,235,229,243,264,272,237,211,180,201,204,188,235,227,234,264,302,293,259,229,203,229,242,233,267,269,270,315,364,347,312,274,237,278,284,277,317,313,318,374,413,405,355,306,271,306,315,301,356,348,355,422,465,467,404,347,305,336,340,318,362,348,363,435,491,505,404,359,310,337,360,342,406,396,420,472,548,559,463,407,362,405,417,391,419,461,472,535,622,606,508,461,390,432) > #'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.8543384 0.8549648 0.8555898 0.8562132 0.8568352 0.8574556 0.8580745 [8] 0.8586919 0.8593076 0.8599218 0.8605344 0.8611453 0.8617546 0.8623622 [15] 0.8629681 0.8635723 0.8641747 0.8647754 0.8653744 0.8659715 0.8665669 [22] 0.8671604 0.8677521 0.8683419 0.8689298 0.8695158 0.8700999 0.8706820 [29] 0.8712622 0.8718404 0.8724165 0.8729907 0.8735627 0.8741328 0.8747007 [36] 0.8752665 0.8758302 0.8763918 0.8769511 0.8775083 0.8780633 0.8786160 [43] 0.8791665 0.8797147 0.8802606 0.8808042 0.8813455 0.8818844 0.8824210 [50] 0.8829551 0.8834868 0.8840161 0.8845430 0.8850673 0.8855892 0.8861085 [57] 0.8866253 0.8871395 0.8876511 0.8881602 0.8886666 0.8891704 0.8896715 [64] 0.8901699 0.8906656 0.8911586 0.8916489 0.8921363 0.8926210 0.8931029 [71] 0.8935819 0.8940581 0.8945315 0.8950019 0.8954694 0.8959340 0.8963956 [78] 0.8968543 0.8973100 0.8977626 0.8982123 0.8986588 0.8991023 0.8995427 [85] 0.8999800 0.9004142 0.9008452 0.9012730 0.9016976 0.9021190 0.9025372 [92] 0.9029522 0.9033638 0.9037722 0.9041773 0.9045790 0.9049774 0.9053724 [99] 0.9057640 0.9061522 0.9065370 0.9069183 0.9072962 0.9076706 0.9080415 [106] 0.9084088 0.9087727 0.9091329 0.9094896 0.9098427 0.9101922 0.9105381 [113] 0.9108803 0.9112188 0.9115537 0.9118849 0.9122123 0.9125360 0.9128560 [120] 0.9131721 0.9134845 0.9137931 0.9140979 0.9143988 0.9146959 0.9149891 [127] 0.9152784 0.9155638 0.9158453 0.9161228 0.9163964 0.9166660 0.9169317 [134] 0.9171933 0.9174510 0.9177046 0.9179541 0.9181996 0.9184410 0.9186784 [141] 0.9189116 0.9191407 0.9193657 0.9195866 0.9198032 0.9200157 0.9202241 [148] 0.9204282 0.9206281 0.9208238 0.9210152 0.9212024 0.9213853 0.9215640 [155] 0.9217384 0.9219084 0.9220742 0.9222356 0.9223927 0.9225454 0.9226938 [162] 0.9228378 0.9229775 0.9231127 0.9232436 0.9233700 0.9234920 0.9236096 [169] 0.9237227 0.9238314 0.9239357 0.9240354 0.9241307 0.9242215 0.9243079 [176] 0.9243897 0.9244670 0.9245397 0.9246080 0.9246717 0.9247309 0.9247855 [183] 0.9248356 0.9248811 0.9249221 0.9249584 0.9249902 0.9250174 0.9250400 [190] 0.9250580 0.9250714 0.9250802 0.9250844 0.9250840 0.9250789 0.9250692 [197] 0.9250549 0.9250360 0.9250124 0.9249842 0.9249513 0.9249138 0.9248716 [204] 0.9248248 0.9247733 0.9247172 0.9246564 0.9245909 0.9245208 0.9244460 [211] 0.9243665 0.9242824 0.9241936 0.9241001 0.9240020 0.9238992 0.9237918 [218] 0.9236796 0.9235628 0.9234414 0.9233153 0.9231845 0.9230490 0.9229089 [225] 0.9227641 0.9226147 0.9224606 0.9223019 0.9221385 0.9219704 0.9217978 [232] 0.9216204 0.9214385 0.9212519 0.9210607 0.9208648 0.9206644 0.9204593 [239] 0.9202496 0.9200353 0.9198164 0.9195929 0.9193648 0.9191322 0.9188949 [246] 0.9186531 0.9184067 0.9181558 0.9179003 0.9176402 0.9173756 0.9171065 [253] 0.9168329 0.9165547 0.9162721 0.9159849 0.9156932 0.9153971 0.9150965 [260] 0.9147914 0.9144819 0.9141679 0.9138494 0.9135266 0.9131993 0.9128676 [267] 0.9125316 0.9121911 0.9118462 0.9114970 0.9111434 0.9107855 0.9104233 [274] 0.9100567 0.9096858 0.9093106 0.9089311 0.9085474 0.9081593 0.9077671 [281] 0.9073706 0.9069698 0.9065649 0.9061557 0.9057424 0.9053248 0.9049032 [288] 0.9044773 0.9040474 0.9036133 0.9031751 0.9027328 0.9022864 0.9018360 [295] 0.9013815 0.9009230 0.9004605 0.8999940 0.8995234 0.8990489 0.8985705 [302] 0.8980881 0.8976017 0.8971115 0.8966174 0.8961193 0.8956175 0.8951117 [309] 0.8946022 0.8940888 0.8935716 0.8930506 0.8925259 0.8919974 0.8914652 [316] 0.8909293 0.8903897 0.8898464 0.8892994 0.8887488 0.8881946 0.8876367 [323] 0.8870753 0.8865103 0.8859417 0.8853696 0.8847940 0.8842149 0.8836323 [330] 0.8830462 0.8824567 0.8818638 0.8812674 0.8806677 0.8800646 0.8794581 [337] 0.8788483 0.8782352 0.8776188 0.8769991 0.8763762 0.8757500 0.8751206 [344] 0.8744880 0.8738522 0.8732133 0.8725712 0.8719261 0.8712778 0.8706264 [351] 0.8699720 0.8693145 0.8686540 0.8679905 0.8673240 0.8666546 0.8659822 [358] 0.8653069 0.8646287 0.8639477 0.8632637 0.8625770 0.8618874 0.8611950 [365] 0.8604998 0.8598019 0.8591012 0.8583978 0.8576917 0.8569830 0.8562716 [372] 0.8555575 0.8548408 0.8541216 0.8533998 0.8526754 0.8519485 0.8512190 [379] 0.8504871 0.8497527 0.8490159 0.8482766 0.8475349 0.8467909 0.8460444 [386] 0.8452957 0.8445446 0.8437912 0.8430355 0.8422775 0.8415173 0.8407549 [393] 0.8399902 0.8392234 0.8384545 0.8376834 0.8369101 0.8361348 0.8353574 [400] 0.8345779 0.8337964 > mx [1] 0.9250844 > mxli [1] -0.08 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1mv291323721271.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2aamm1323721271.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3oaju1323721271.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/45xq11323721271.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/5icji1323721271.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/6bkql1323721272.tab") > > try(system("convert tmp/1mv291323721271.ps tmp/1mv291323721271.png",intern=TRUE)) character(0) > try(system("convert tmp/2aamm1323721271.ps tmp/2aamm1323721271.png",intern=TRUE)) character(0) > try(system("convert tmp/3oaju1323721271.ps tmp/3oaju1323721271.png",intern=TRUE)) character(0) > try(system("convert tmp/45xq11323721271.ps tmp/45xq11323721271.png",intern=TRUE)) character(0) > try(system("convert tmp/5icji1323721271.ps tmp/5icji1323721271.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.478 0.291 1.796