R version 2.12.0 (2010-10-15) Copyright (C) 2010 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. > y <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132) > x <- c(1.262,1.743,1.964,3.258,4.966,4.944,5.907,5.561,5.321,3.582,1.757,1.894,1.442,2.238,2.179,3.218,5.139,4.990,4.914,6.084,5.672,3.548,1.793,2.086,1.376,2.202,2.683,3.303,5.202,5.231,4.880,7.998,4.977,3.531,2.025,2.205,1.504,2.090,2.702,2.939,4.500,6.208,6.415,5.657,5.964,3.163,1.997,2.422,1.507,1.992,2.487,3.490,4.647,5.594,5.611,5.788,6.204,3.013,1.931,2.549,1.580,2.111,2.192,3.601,4.665,4.876,5.813,5.589,5.331,3.075,2.002,2.306,1.594,2.467,2.222,3.607,4.685,4.962,5.770,5.480,5.000,3.228,1.993,2.288,1.351,2.218,2.461,3.028,4.784,4.975,4.607,6.249,4.809,3.157,1.910,2.228,1.169,2.154,2.249,2.687,4.359,5.382,4.459,6.398,4.596,3.024,1.887,2.070,1.511,2.059,2.635,2.867,4.403,5.720,4.502,5.749,5.627,2.846,1.762,2.429,1.579,2.146,2.462,3.695,4.831,5.134,6.250,5.760,6.249,2.917,1.741,2.359) > #'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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] 4.747123e-02 4.733538e-02 4.719884e-02 4.706161e-02 4.692370e-02 [6] 4.678511e-02 4.664585e-02 4.650591e-02 4.636531e-02 4.622404e-02 [11] 4.608211e-02 4.593952e-02 4.579628e-02 4.565238e-02 4.550784e-02 [16] 4.536265e-02 4.521682e-02 4.507035e-02 4.492325e-02 4.477552e-02 [21] 4.462717e-02 4.447819e-02 4.432860e-02 4.417839e-02 4.402758e-02 [26] 4.387616e-02 4.372413e-02 4.357151e-02 4.341830e-02 4.326449e-02 [31] 4.311011e-02 4.295514e-02 4.279959e-02 4.264348e-02 4.248679e-02 [36] 4.232955e-02 4.217175e-02 4.201339e-02 4.185448e-02 4.169503e-02 [41] 4.153504e-02 4.137452e-02 4.121346e-02 4.105188e-02 4.088978e-02 [46] 4.072717e-02 4.056404e-02 4.040041e-02 4.023627e-02 4.007164e-02 [51] 3.990652e-02 3.974091e-02 3.957483e-02 3.940826e-02 3.924123e-02 [56] 3.907373e-02 3.890577e-02 3.873736e-02 3.856849e-02 3.839918e-02 [61] 3.822944e-02 3.805926e-02 3.788865e-02 3.771761e-02 3.754617e-02 [66] 3.737430e-02 3.720204e-02 3.702937e-02 3.685630e-02 3.668285e-02 [71] 3.650901e-02 3.633479e-02 3.616020e-02 3.598524e-02 3.580992e-02 [76] 3.563424e-02 3.545821e-02 3.528184e-02 3.510513e-02 3.492808e-02 [81] 3.475071e-02 3.457301e-02 3.439500e-02 3.421668e-02 3.403805e-02 [86] 3.385912e-02 3.367990e-02 3.350040e-02 3.332061e-02 3.314055e-02 [91] 3.296022e-02 3.277962e-02 3.259877e-02 3.241766e-02 3.223631e-02 [96] 3.205471e-02 3.187289e-02 3.169083e-02 3.150856e-02 3.132606e-02 [101] 3.114336e-02 3.096045e-02 3.077734e-02 3.059404e-02 3.041055e-02 [106] 3.022688e-02 3.004303e-02 2.985902e-02 2.967484e-02 2.949050e-02 [111] 2.930602e-02 2.912138e-02 2.893661e-02 2.875171e-02 2.856667e-02 [116] 2.838151e-02 2.819624e-02 2.801086e-02 2.782537e-02 2.763978e-02 [121] 2.745410e-02 2.726833e-02 2.708248e-02 2.689656e-02 2.671056e-02 [126] 2.652450e-02 2.633838e-02 2.615221e-02 2.596600e-02 2.577974e-02 [131] 2.559344e-02 2.540712e-02 2.522077e-02 2.503440e-02 2.484802e-02 [136] 2.466163e-02 2.447524e-02 2.428885e-02 2.410247e-02 2.391610e-02 [141] 2.372976e-02 2.354344e-02 2.335715e-02 2.317090e-02 2.298468e-02 [146] 2.279852e-02 2.261241e-02 2.242635e-02 2.224036e-02 2.205443e-02 [151] 2.186858e-02 2.168281e-02 2.149712e-02 2.131152e-02 2.112601e-02 [156] 2.094060e-02 2.075529e-02 2.057010e-02 2.038501e-02 2.020005e-02 [161] 2.001521e-02 1.983050e-02 1.964592e-02 1.946147e-02 1.927717e-02 [166] 1.909302e-02 1.890902e-02 1.872518e-02 1.854150e-02 1.835798e-02 [171] 1.817464e-02 1.799147e-02 1.780848e-02 1.762568e-02 1.744306e-02 [176] 1.726063e-02 1.707841e-02 1.689638e-02 1.671456e-02 1.653295e-02 [181] 1.635155e-02 1.617038e-02 1.598942e-02 1.580869e-02 1.562819e-02 [186] 1.544793e-02 1.526790e-02 1.508812e-02 1.490858e-02 1.472929e-02 [191] 1.455026e-02 1.437148e-02 1.419296e-02 1.401471e-02 1.383673e-02 [196] 1.365902e-02 1.348158e-02 1.330443e-02 1.312755e-02 1.295096e-02 [201] 1.277466e-02 1.259866e-02 1.242295e-02 1.224753e-02 1.207242e-02 [206] 1.189762e-02 1.172312e-02 1.154893e-02 1.137506e-02 1.120151e-02 [211] 1.102828e-02 1.085537e-02 1.068278e-02 1.051053e-02 1.033860e-02 [216] 1.016701e-02 9.995759e-03 9.824846e-03 9.654275e-03 9.484048e-03 [221] 9.314169e-03 9.144639e-03 8.975461e-03 8.806637e-03 8.638170e-03 [226] 8.470062e-03 8.302315e-03 8.134932e-03 7.967914e-03 7.801263e-03 [231] 7.634983e-03 7.469074e-03 7.303538e-03 7.138378e-03 6.973596e-03 [236] 6.809193e-03 6.645171e-03 6.481532e-03 6.318277e-03 6.155409e-03 [241] 5.992929e-03 5.830838e-03 5.669139e-03 5.507832e-03 5.346919e-03 [246] 5.186401e-03 5.026281e-03 4.866558e-03 4.707236e-03 4.548314e-03 [251] 4.389794e-03 4.231677e-03 4.073965e-03 3.916659e-03 3.759759e-03 [256] 3.603266e-03 3.447183e-03 3.291508e-03 3.136245e-03 2.981393e-03 [261] 2.826953e-03 2.672926e-03 2.519313e-03 2.366114e-03 2.213331e-03 [266] 2.060963e-03 1.909012e-03 1.757478e-03 1.606362e-03 1.455664e-03 [271] 1.305385e-03 1.155525e-03 1.006084e-03 8.570629e-04 7.084622e-04 [276] 5.602820e-04 4.125226e-04 2.651842e-04 1.182670e-04 -2.822878e-05 [281] -1.743031e-04 -3.199557e-04 -4.651867e-04 -6.099959e-04 -7.543834e-04 [286] -8.983492e-04 -1.041893e-03 -1.185016e-03 -1.327717e-03 -1.469997e-03 [291] -1.611855e-03 -1.753293e-03 -1.894310e-03 -2.034907e-03 -2.175083e-03 [296] -2.314840e-03 -2.454177e-03 -2.593095e-03 -2.731595e-03 -2.869676e-03 [301] -3.007339e-03 -3.144586e-03 -3.281415e-03 -3.417829e-03 -3.553826e-03 [306] -3.689409e-03 -3.824577e-03 -3.959332e-03 -4.093673e-03 -4.227602e-03 [311] -4.361120e-03 -4.494226e-03 -4.626922e-03 -4.759209e-03 -4.891087e-03 [316] -5.022558e-03 -5.153622e-03 -5.284280e-03 -5.414532e-03 -5.544381e-03 [321] -5.673826e-03 -5.802869e-03 -5.931511e-03 -6.059753e-03 -6.187596e-03 [326] -6.315040e-03 -6.442087e-03 -6.568739e-03 -6.694995e-03 -6.820858e-03 [331] -6.946328e-03 -7.071407e-03 -7.196095e-03 -7.320394e-03 -7.444306e-03 [336] -7.567831e-03 -7.690971e-03 -7.813726e-03 -7.936099e-03 -8.058090e-03 [341] -8.179701e-03 -8.300933e-03 -8.421788e-03 -8.542266e-03 -8.662370e-03 [346] -8.782101e-03 -8.901459e-03 -9.020447e-03 -9.139065e-03 -9.257316e-03 [351] -9.375201e-03 -9.492721e-03 -9.609878e-03 -9.726673e-03 -9.843107e-03 [356] -9.959183e-03 -1.007490e-02 -1.019026e-02 -1.030527e-02 -1.041993e-02 [361] -1.053423e-02 -1.064819e-02 -1.076180e-02 -1.087506e-02 -1.098798e-02 [366] -1.110055e-02 -1.121278e-02 -1.132468e-02 -1.143623e-02 -1.154745e-02 [371] -1.165833e-02 -1.176888e-02 -1.187910e-02 -1.198899e-02 -1.209855e-02 [376] -1.220778e-02 -1.231669e-02 -1.242528e-02 -1.253355e-02 -1.264149e-02 [381] -1.274912e-02 -1.285643e-02 -1.296343e-02 -1.307011e-02 -1.317649e-02 [386] -1.328255e-02 -1.338831e-02 -1.349376e-02 -1.359891e-02 -1.370375e-02 [391] -1.380830e-02 -1.391255e-02 -1.401650e-02 -1.412015e-02 -1.422351e-02 [396] -1.432658e-02 -1.442936e-02 -1.453185e-02 -1.463406e-02 -1.473598e-02 [401] -1.483762e-02 > mx [1] 0.04747123 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > r<-lm(y~x) > se <- sqrt(var(r$residuals)) > r1 <- lm(y~x1) > se1 <- sqrt(var(r1$residuals)) > postscript(file="/var/www/rcomp/tmp/1e9wf1323898971.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/28iu11323898971.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') > abline(r) > grid() > mtext(paste('Residual Standard Deviation = ',se)) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3xf881323898971.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') > abline(r1) > grid() > mtext(paste('Residual Standard Deviation = ',se1)) > 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 Linearity 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(x)',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (orginial)',header=TRUE) > a<-table.element(a,se) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (transformed)',header=TRUE) > a<-table.element(a,se1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/4x0sl1323898971.tab") > > try(system("convert tmp/1e9wf1323898971.ps tmp/1e9wf1323898971.png",intern=TRUE)) character(0) > try(system("convert tmp/28iu11323898971.ps tmp/28iu11323898971.png",intern=TRUE)) character(0) > try(system("convert tmp/3xf881323898971.ps tmp/3xf881323898971.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.750 0.120 1.852