R version 2.9.0 (2009-04-17) Copyright (C) 2009 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,108,125,109,92,126,63,51,129,115,96,101,106,93,120,96,99,129,62,56,119,92,90,105,102,99,107,90,90,108,62,53,97,96,103,88,100,95,109,92,96,100,62,64,110,119,93,84,101,92,91,110,85,120,74,59,121,124,100,121) > #'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] 4.786941e-03 4.620180e-03 4.453453e-03 4.286763e-03 4.120110e-03 [6] 3.953496e-03 3.786922e-03 3.620389e-03 3.453898e-03 3.287450e-03 [11] 3.121046e-03 2.954689e-03 2.788378e-03 2.622116e-03 2.455903e-03 [16] 2.289740e-03 2.123629e-03 1.957571e-03 1.791567e-03 1.625619e-03 [21] 1.459727e-03 1.293893e-03 1.128117e-03 9.624025e-04 7.967490e-04 [26] 6.311582e-04 4.656313e-04 3.001696e-04 1.347742e-04 -3.055362e-05 [31] -1.958126e-04 -3.610015e-04 -5.261191e-04 -6.911641e-04 -8.561353e-04 [36] -1.021032e-03 -1.185851e-03 -1.350594e-03 -1.515257e-03 -1.679841e-03 [41] -1.844343e-03 -2.008763e-03 -2.173098e-03 -2.337349e-03 -2.501513e-03 [46] -2.665590e-03 -2.829578e-03 -2.993476e-03 -3.157282e-03 -3.320996e-03 [51] -3.484615e-03 -3.648140e-03 -3.811568e-03 -3.974898e-03 -4.138129e-03 [56] -4.301260e-03 -4.464289e-03 -4.627215e-03 -4.790037e-03 -4.952754e-03 [61] -5.115363e-03 -5.277865e-03 -5.440257e-03 -5.602539e-03 -5.764709e-03 [66] -5.926766e-03 -6.088708e-03 -6.250535e-03 -6.412244e-03 -6.573835e-03 [71] -6.735306e-03 -6.896657e-03 -7.057885e-03 -7.218990e-03 -7.379969e-03 [76] -7.540823e-03 -7.701549e-03 -7.862147e-03 -8.022614e-03 -8.182950e-03 [81] -8.343154e-03 -8.503223e-03 -8.663157e-03 -8.822955e-03 -8.982615e-03 [86] -9.142136e-03 -9.301516e-03 -9.460755e-03 -9.619851e-03 -9.778802e-03 [91] -9.937607e-03 -1.009627e-02 -1.025478e-02 -1.041314e-02 -1.057135e-02 [96] -1.072941e-02 -1.088731e-02 -1.104506e-02 -1.120265e-02 -1.136009e-02 [101] -1.151737e-02 -1.167449e-02 -1.183144e-02 -1.198824e-02 -1.214487e-02 [106] -1.230133e-02 -1.245763e-02 -1.261376e-02 -1.276973e-02 -1.292552e-02 [111] -1.308114e-02 -1.323659e-02 -1.339186e-02 -1.354696e-02 -1.370188e-02 [116] -1.385663e-02 -1.401119e-02 -1.416557e-02 -1.431978e-02 -1.447380e-02 [121] -1.462763e-02 -1.478128e-02 -1.493474e-02 -1.508802e-02 -1.524110e-02 [126] -1.539400e-02 -1.554670e-02 -1.569921e-02 -1.585152e-02 -1.600364e-02 [131] -1.615556e-02 -1.630729e-02 -1.645881e-02 -1.661014e-02 -1.676126e-02 [136] -1.691218e-02 -1.706289e-02 -1.721340e-02 -1.736370e-02 -1.751380e-02 [141] -1.766368e-02 -1.781335e-02 -1.796281e-02 -1.811206e-02 -1.826110e-02 [146] -1.840992e-02 -1.855852e-02 -1.870690e-02 -1.885507e-02 -1.900301e-02 [151] -1.915074e-02 -1.929824e-02 -1.944552e-02 -1.959257e-02 -1.973939e-02 [156] -1.988599e-02 -2.003236e-02 -2.017850e-02 -2.032441e-02 -2.047009e-02 [161] -2.061553e-02 -2.076074e-02 -2.090572e-02 -2.105045e-02 -2.119495e-02 [166] -2.133921e-02 -2.148323e-02 -2.162701e-02 -2.177054e-02 -2.191384e-02 [171] -2.205688e-02 -2.219969e-02 -2.234224e-02 -2.248455e-02 -2.262661e-02 [176] -2.276841e-02 -2.290997e-02 -2.305127e-02 -2.319232e-02 -2.333312e-02 [181] -2.347366e-02 -2.361394e-02 -2.375397e-02 -2.389374e-02 -2.403324e-02 [186] -2.417249e-02 -2.431147e-02 -2.445019e-02 -2.458865e-02 -2.472684e-02 [191] -2.486477e-02 -2.500242e-02 -2.513982e-02 -2.527694e-02 -2.541379e-02 [196] -2.555037e-02 -2.568667e-02 -2.582271e-02 -2.595847e-02 -2.609395e-02 [201] -2.622916e-02 -2.636410e-02 -2.649875e-02 -2.663312e-02 -2.676722e-02 [206] -2.690103e-02 -2.703457e-02 -2.716782e-02 -2.730078e-02 -2.743347e-02 [211] -2.756586e-02 -2.769797e-02 -2.782980e-02 -2.796133e-02 -2.809258e-02 [216] -2.822354e-02 -2.835420e-02 -2.848458e-02 -2.861466e-02 -2.874445e-02 [221] -2.887394e-02 -2.900314e-02 -2.913205e-02 -2.926066e-02 -2.938897e-02 [226] -2.951698e-02 -2.964469e-02 -2.977211e-02 -2.989922e-02 -3.002603e-02 [231] -3.015254e-02 -3.027875e-02 -3.040466e-02 -3.053026e-02 -3.065555e-02 [236] -3.078054e-02 -3.090522e-02 -3.102960e-02 -3.115367e-02 -3.127742e-02 [241] -3.140087e-02 -3.152401e-02 -3.164684e-02 -3.176936e-02 -3.189157e-02 [246] -3.201346e-02 -3.213504e-02 -3.225631e-02 -3.237726e-02 -3.249790e-02 [251] -3.261822e-02 -3.273822e-02 -3.285791e-02 -3.297728e-02 -3.309633e-02 [256] -3.321507e-02 -3.333348e-02 -3.345158e-02 -3.356935e-02 -3.368680e-02 [261] -3.380394e-02 -3.392075e-02 -3.403723e-02 -3.415340e-02 -3.426924e-02 [266] -3.438476e-02 -3.449995e-02 -3.461482e-02 -3.472936e-02 -3.484358e-02 [271] -3.495747e-02 -3.507104e-02 -3.518427e-02 -3.529718e-02 -3.540977e-02 [276] -3.552202e-02 -3.563394e-02 -3.574554e-02 -3.585681e-02 -3.596774e-02 [281] -3.607835e-02 -3.618863e-02 -3.629857e-02 -3.640818e-02 -3.651747e-02 [286] -3.662642e-02 -3.673503e-02 -3.684332e-02 -3.695127e-02 -3.705889e-02 [291] -3.716618e-02 -3.727313e-02 -3.737975e-02 -3.748604e-02 -3.759199e-02 [296] -3.769760e-02 -3.780288e-02 -3.790783e-02 -3.801244e-02 -3.811672e-02 [301] -3.822066e-02 -3.832426e-02 -3.842753e-02 -3.853046e-02 -3.863306e-02 [306] -3.873532e-02 -3.883724e-02 -3.893883e-02 -3.904008e-02 -3.914100e-02 [311] -3.924157e-02 -3.934181e-02 -3.944171e-02 -3.954128e-02 -3.964051e-02 [316] -3.973940e-02 -3.983795e-02 -3.993617e-02 -4.003405e-02 -4.013159e-02 [321] -4.022879e-02 -4.032566e-02 -4.042219e-02 -4.051838e-02 -4.061423e-02 [326] -4.070975e-02 -4.080493e-02 -4.089977e-02 -4.099428e-02 -4.108845e-02 [331] -4.118228e-02 -4.127577e-02 -4.136893e-02 -4.146175e-02 -4.155423e-02 [336] -4.164638e-02 -4.173819e-02 -4.182967e-02 -4.192080e-02 -4.201161e-02 [341] -4.210207e-02 -4.219221e-02 -4.228200e-02 -4.237146e-02 -4.246059e-02 [346] -4.254938e-02 -4.263783e-02 -4.272595e-02 -4.281374e-02 -4.290120e-02 [351] -4.298832e-02 -4.307510e-02 -4.316155e-02 -4.324767e-02 -4.333346e-02 [356] -4.341892e-02 -4.350404e-02 -4.358883e-02 -4.367329e-02 -4.375742e-02 [361] -4.384121e-02 -4.392468e-02 -4.400782e-02 -4.409062e-02 -4.417310e-02 [366] -4.425525e-02 -4.433707e-02 -4.441856e-02 -4.449972e-02 -4.458056e-02 [371] -4.466107e-02 -4.474125e-02 -4.482110e-02 -4.490063e-02 -4.497984e-02 [376] -4.505871e-02 -4.513727e-02 -4.521550e-02 -4.529340e-02 -4.537099e-02 [381] -4.544825e-02 -4.552518e-02 -4.560180e-02 -4.567809e-02 -4.575407e-02 [386] -4.582972e-02 -4.590505e-02 -4.598007e-02 -4.605476e-02 -4.612914e-02 [391] -4.620320e-02 -4.627694e-02 -4.635036e-02 -4.642347e-02 -4.649627e-02 [396] -4.656875e-02 -4.664091e-02 -4.671276e-02 -4.678430e-02 -4.685552e-02 [401] -4.692644e-02 > mx [1] 0.004786941 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1wtyk1258116988.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/23yim1258116988.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/31ec21258116988.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/4h60l1258116988.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/5wadz1258116988.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/6iiip1258116988.tab") > > system("convert tmp/1wtyk1258116988.ps tmp/1wtyk1258116988.png") > system("convert tmp/23yim1258116988.ps tmp/23yim1258116988.png") > system("convert tmp/31ec21258116988.ps tmp/31ec21258116988.png") > system("convert tmp/4h60l1258116988.ps tmp/4h60l1258116988.png") > system("convert tmp/5wadz1258116988.ps tmp/5wadz1258116988.png") > > > proc.time() user system elapsed 1.065 0.761 1.288