R version 2.8.1 (2008-12-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(100,96.21064363,96.31280765,107.1793443,114.9066592,92.56060184,114.9995356,107.1236185,117.7765394,107.3650971,106.2970187,114.5072908,98.0031578,103.0649206,100.2879168,104.6066685,111.1544534,104.9874617,109.9284852,111.5352466,132.4974459,100.3436426,123.0983561,114.2379493,104.569518,109.0833101,106.9843039,133.6769759,124.8537197,122.5132349,116.8013374,116.0118882,129.7575926,125.1973623,143.7912139,127.9465032,130.2962757,108.4424631,129.3675118,143.6797622,131.8844618,117.6186496,118.9560695,104.8202842,134.624315,140.401226,143.8005015,153.4317823,153.2924677,127.3149438,153.5525216,136.9276493,131.7730101,144.3391845,107.4208229,113.6249652,124.2221603,102.0618557,96.36853348,111.6838488) > #'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.4698732 0.4698889 0.4699044 0.4699197 0.4699348 0.4699498 0.4699645 [8] 0.4699791 0.4699935 0.4700078 0.4700218 0.4700357 0.4700493 0.4700628 [15] 0.4700761 0.4700892 0.4701022 0.4701149 0.4701275 0.4701399 0.4701520 [22] 0.4701641 0.4701759 0.4701875 0.4701990 0.4702102 0.4702213 0.4702322 [29] 0.4702429 0.4702534 0.4702638 0.4702739 0.4702839 0.4702936 0.4703032 [36] 0.4703126 0.4703218 0.4703308 0.4703397 0.4703483 0.4703568 0.4703651 [43] 0.4703731 0.4703810 0.4703887 0.4703963 0.4704036 0.4704107 0.4704177 [50] 0.4704244 0.4704310 0.4704374 0.4704436 0.4704496 0.4704554 0.4704610 [57] 0.4704665 0.4704717 0.4704768 0.4704816 0.4704863 0.4704908 0.4704951 [64] 0.4704992 0.4705031 0.4705068 0.4705103 0.4705137 0.4705168 0.4705198 [71] 0.4705225 0.4705251 0.4705275 0.4705297 0.4705317 0.4705335 0.4705351 [78] 0.4705365 0.4705377 0.4705388 0.4705396 0.4705403 0.4705407 0.4705410 [85] 0.4705410 0.4705409 0.4705406 0.4705401 0.4705394 0.4705385 0.4705374 [92] 0.4705361 0.4705347 0.4705330 0.4705311 0.4705291 0.4705268 0.4705244 [99] 0.4705217 0.4705189 0.4705159 0.4705126 0.4705092 0.4705056 0.4705018 [106] 0.4704978 0.4704936 0.4704892 0.4704846 0.4704798 0.4704749 0.4704697 [113] 0.4704643 0.4704588 0.4704530 0.4704470 0.4704409 0.4704345 0.4704280 [120] 0.4704213 0.4704143 0.4704072 0.4703999 0.4703923 0.4703846 0.4703767 [127] 0.4703686 0.4703603 0.4703518 0.4703431 0.4703342 0.4703251 0.4703158 [134] 0.4703063 0.4702966 0.4702868 0.4702767 0.4702664 0.4702559 0.4702453 [141] 0.4702344 0.4702233 0.4702121 0.4702006 0.4701890 0.4701771 0.4701651 [148] 0.4701528 0.4701404 0.4701277 0.4701149 0.4701019 0.4700886 0.4700752 [155] 0.4700616 0.4700477 0.4700337 0.4700195 0.4700051 0.4699905 0.4699756 [162] 0.4699606 0.4699454 0.4699300 0.4699144 0.4698986 0.4698826 0.4698664 [169] 0.4698500 0.4698334 0.4698166 0.4697996 0.4697824 0.4697650 0.4697474 [176] 0.4697296 0.4697116 0.4696934 0.4696751 0.4696565 0.4696377 0.4696187 [183] 0.4695995 0.4695802 0.4695606 0.4695408 0.4695208 0.4695007 0.4694803 [190] 0.4694597 0.4694390 0.4694180 0.4693968 0.4693755 0.4693539 0.4693322 [197] 0.4693102 0.4692880 0.4692657 0.4692431 0.4692204 0.4691974 0.4691743 [204] 0.4691509 0.4691274 0.4691036 0.4690797 0.4690556 0.4690312 0.4690067 [211] 0.4689820 0.4689570 0.4689319 0.4689066 0.4688810 0.4688553 0.4688294 [218] 0.4688032 0.4687769 0.4687504 0.4687237 0.4686968 0.4686696 0.4686423 [225] 0.4686148 0.4685871 0.4685592 0.4685311 0.4685028 0.4684743 0.4684456 [232] 0.4684167 0.4683876 0.4683583 0.4683288 0.4682991 0.4682692 0.4682391 [239] 0.4682088 0.4681783 0.4681477 0.4681168 0.4680857 0.4680544 0.4680230 [246] 0.4679913 0.4679594 0.4679274 0.4678951 0.4678626 0.4678300 0.4677971 [253] 0.4677641 0.4677308 0.4676974 0.4676638 0.4676299 0.4675959 0.4675617 [260] 0.4675272 0.4674926 0.4674578 0.4674228 0.4673876 0.4673521 0.4673165 [267] 0.4672807 0.4672447 0.4672085 0.4671721 0.4671356 0.4670988 0.4670618 [274] 0.4670246 0.4669872 0.4669497 0.4669119 0.4668740 0.4668358 0.4667975 [281] 0.4667589 0.4667202 0.4666812 0.4666421 0.4666028 0.4665633 0.4665235 [288] 0.4664836 0.4664435 0.4664032 0.4663627 0.4663220 0.4662812 0.4662401 [295] 0.4661988 0.4661574 0.4661157 0.4660738 0.4660318 0.4659896 0.4659471 [302] 0.4659045 0.4658617 0.4658187 0.4657755 0.4657321 0.4656885 0.4656447 [309] 0.4656007 0.4655565 0.4655122 0.4654676 0.4654229 0.4653779 0.4653328 [316] 0.4652875 0.4652419 0.4651962 0.4651503 0.4651042 0.4650579 0.4650115 [323] 0.4649648 0.4649179 0.4648709 0.4648237 0.4647762 0.4647286 0.4646808 [330] 0.4646328 0.4645846 0.4645362 0.4644876 0.4644389 0.4643899 0.4643408 [337] 0.4642915 0.4642419 0.4641922 0.4641423 0.4640922 0.4640420 0.4639915 [344] 0.4639408 0.4638900 0.4638390 0.4637877 0.4637363 0.4636847 0.4636330 [351] 0.4635810 0.4635288 0.4634765 0.4634239 0.4633712 0.4633183 0.4632652 [358] 0.4632119 0.4631585 0.4631048 0.4630510 0.4629970 0.4629427 0.4628884 [365] 0.4628338 0.4627790 0.4627240 0.4626689 0.4626136 0.4625581 0.4625024 [372] 0.4624465 0.4623904 0.4623342 0.4622778 0.4622212 0.4621644 0.4621074 [379] 0.4620502 0.4619929 0.4619353 0.4618776 0.4618197 0.4617616 0.4617034 [386] 0.4616449 0.4615863 0.4615275 0.4614685 0.4614093 0.4613500 0.4612905 [393] 0.4612307 0.4611708 0.4611108 0.4610505 0.4609901 0.4609295 0.4608687 [400] 0.4608077 0.4607465 > mx [1] 0.470541 > mxli [1] -1.16 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1sayp1257797636.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/rcomp/tmp/277bh1257797636.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/rcomp/tmp/3wh2x1257797636.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/rcomp/tmp/4sbp01257797636.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/rcomp/tmp/5anf21257797636.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/685411257797636.tab") > > system("convert tmp/1sayp1257797636.ps tmp/1sayp1257797636.png") > system("convert tmp/277bh1257797636.ps tmp/277bh1257797636.png") > system("convert tmp/3wh2x1257797636.ps tmp/3wh2x1257797636.png") > system("convert tmp/4sbp01257797636.ps tmp/4sbp01257797636.png") > system("convert tmp/5anf21257797636.ps tmp/5anf21257797636.png") > > > proc.time() user system elapsed 1.340 1.220 2.371