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. > y <- c(58.972,59.249,63.955,53.785,52.760,44.795,37.348,32.370,32.717,40.974,33.591,21.124,58.608,46.865,51.378,46.235,47.206,45.382,41.227,33.795,31.295,42.625,33.625,21.538,56.421,53.152,53.536,52.408,41.454,38.271,35.306,26.414,31.917,38.030,27.534,18.387,50.556,43.901,48.572,43.899,37.532,40.357,35.489,29.027,34.485,42.598,30.306,26.451,47.460,50.104,61.465,53.726,39.477,43.895,31.481,29.896,33.842,39.120,33.702,25.094) > x <- c(54.281,63.654,68.918,58.686,67.074,60.183,54.326,54.085,53.564,60.873,53.398,45.164,59.672,56.298,62.361,56.930,62.954,62.431,52.528,54.060,53.093,52.695,52.333,41.747,58.576,57.851,63.721,63.384,61.141,59.231,63.472,49.214,55.816,61.713,48.664,45.351,57.888,54.091,59.098,58.962,55.433,60.403,60.721,48.440,57.981,60.258,47.312,46.980,54.846,56.824,67.744,62.849,54.691,65.461,53.724,54.560,57.722,55.458,48.490,46.362) > #'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] 0.7642425 0.7643141 0.7643853 0.7644561 0.7645266 0.7645967 0.7646664 [8] 0.7647357 0.7648047 0.7648733 0.7649415 0.7650093 0.7650768 0.7651439 [15] 0.7652106 0.7652770 0.7653429 0.7654086 0.7654738 0.7655387 0.7656031 [22] 0.7656673 0.7657310 0.7657944 0.7658574 0.7659200 0.7659822 0.7660441 [29] 0.7661056 0.7661667 0.7662275 0.7662879 0.7663479 0.7664075 0.7664668 [36] 0.7665257 0.7665842 0.7666423 0.7667001 0.7667575 0.7668145 0.7668712 [43] 0.7669274 0.7669833 0.7670389 0.7670940 0.7671488 0.7672032 0.7672573 [50] 0.7673109 0.7673642 0.7674171 0.7674697 0.7675218 0.7675736 0.7676250 [57] 0.7676761 0.7677268 0.7677771 0.7678270 0.7678765 0.7679257 0.7679745 [64] 0.7680230 0.7680710 0.7681187 0.7681660 0.7682130 0.7682595 0.7683057 [71] 0.7683516 0.7683970 0.7684421 0.7684868 0.7685311 0.7685751 0.7686187 [78] 0.7686619 0.7687047 0.7687472 0.7687893 0.7688310 0.7688724 0.7689134 [85] 0.7689540 0.7689942 0.7690341 0.7690736 0.7691127 0.7691515 0.7691899 [92] 0.7692279 0.7692655 0.7693028 0.7693397 0.7693762 0.7694124 0.7694481 [99] 0.7694836 0.7695186 0.7695533 0.7695876 0.7696215 0.7696551 0.7696882 [106] 0.7697211 0.7697535 0.7697856 0.7698173 0.7698486 0.7698796 0.7699102 [113] 0.7699404 0.7699703 0.7699998 0.7700289 0.7700577 0.7700861 0.7701141 [120] 0.7701417 0.7701690 0.7701959 0.7702225 0.7702487 0.7702745 0.7702999 [127] 0.7703250 0.7703497 0.7703740 0.7703980 0.7704216 0.7704448 0.7704677 [134] 0.7704902 0.7705124 0.7705341 0.7705555 0.7705766 0.7705973 0.7706176 [141] 0.7706375 0.7706571 0.7706763 0.7706951 0.7707136 0.7707317 0.7707495 [148] 0.7707669 0.7707839 0.7708006 0.7708169 0.7708328 0.7708484 0.7708636 [155] 0.7708784 0.7708929 0.7709070 0.7709208 0.7709342 0.7709472 0.7709599 [162] 0.7709722 0.7709841 0.7709957 0.7710069 0.7710178 0.7710283 0.7710385 [169] 0.7710482 0.7710577 0.7710667 0.7710754 0.7710838 0.7710917 0.7710994 [176] 0.7711066 0.7711135 0.7711201 0.7711263 0.7711321 0.7711376 0.7711427 [183] 0.7711474 0.7711518 0.7711559 0.7711596 0.7711629 0.7711659 0.7711685 [190] 0.7711708 0.7711727 0.7711742 0.7711754 0.7711762 0.7711767 0.7711769 [197] 0.7711766 0.7711761 0.7711751 0.7711738 0.7711722 0.7711702 0.7711679 [204] 0.7711652 0.7711621 0.7711587 0.7711550 0.7711509 0.7711464 0.7711416 [211] 0.7711365 0.7711310 0.7711251 0.7711189 0.7711124 0.7711054 0.7710982 [218] 0.7710906 0.7710826 0.7710743 0.7710657 0.7710567 0.7710474 0.7710377 [225] 0.7710276 0.7710173 0.7710065 0.7709954 0.7709840 0.7709723 0.7709601 [232] 0.7709477 0.7709349 0.7709217 0.7709083 0.7708944 0.7708803 0.7708657 [239] 0.7708509 0.7708357 0.7708201 0.7708042 0.7707880 0.7707714 0.7707545 [246] 0.7707373 0.7707197 0.7707017 0.7706835 0.7706649 0.7706459 0.7706266 [253] 0.7706070 0.7705870 0.7705667 0.7705461 0.7705251 0.7705038 0.7704821 [260] 0.7704601 0.7704378 0.7704151 0.7703921 0.7703688 0.7703452 0.7703212 [267] 0.7702968 0.7702722 0.7702472 0.7702218 0.7701962 0.7701702 0.7701438 [274] 0.7701172 0.7700902 0.7700628 0.7700352 0.7700072 0.7699789 0.7699502 [281] 0.7699213 0.7698920 0.7698623 0.7698324 0.7698021 0.7697715 0.7697405 [288] 0.7697093 0.7696777 0.7696458 0.7696135 0.7695809 0.7695480 0.7695148 [295] 0.7694813 0.7694474 0.7694132 0.7693787 0.7693439 0.7693087 0.7692732 [302] 0.7692374 0.7692013 0.7691648 0.7691281 0.7690910 0.7690536 0.7690159 [309] 0.7689778 0.7689394 0.7689008 0.7688618 0.7688224 0.7687828 0.7687429 [316] 0.7687026 0.7686620 0.7686211 0.7685799 0.7685384 0.7684965 0.7684544 [323] 0.7684119 0.7683691 0.7683260 0.7682826 0.7682389 0.7681949 0.7681505 [330] 0.7681059 0.7680609 0.7680156 0.7679700 0.7679241 0.7678779 0.7678314 [337] 0.7677846 0.7677375 0.7676900 0.7676423 0.7675942 0.7675459 0.7674972 [344] 0.7674483 0.7673990 0.7673494 0.7672995 0.7672494 0.7671989 0.7671481 [351] 0.7670970 0.7670456 0.7669939 0.7669419 0.7668896 0.7668370 0.7667841 [358] 0.7667309 0.7666774 0.7666237 0.7665696 0.7665152 0.7664605 0.7664055 [365] 0.7663502 0.7662947 0.7662388 0.7661826 0.7661262 0.7660694 0.7660124 [372] 0.7659550 0.7658974 0.7658395 0.7657812 0.7657227 0.7656639 0.7656048 [379] 0.7655455 0.7654858 0.7654258 0.7653656 0.7653050 0.7652442 0.7651831 [386] 0.7651217 0.7650600 0.7649980 0.7649358 0.7648732 0.7648104 0.7647473 [393] 0.7646839 0.7646202 0.7645562 0.7644920 0.7644274 0.7643626 0.7642975 [400] 0.7642321 0.7641665 > mx [1] 0.7711769 > mxli [1] -0.05 > 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/html/rcomp/tmp/1fkxp1226415090.ps",horizontal=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/html/rcomp/tmp/2ea1t1226415090.ps",horizontal=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/html/rcomp/tmp/37ffm1226415090.ps",horizontal=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/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 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/html/rcomp/tmp/43jt21226415090.tab") > > system("convert tmp/1fkxp1226415090.ps tmp/1fkxp1226415090.png") > system("convert tmp/2ea1t1226415090.ps tmp/2ea1t1226415090.png") > system("convert tmp/37ffm1226415090.ps tmp/37ffm1226415090.png") > > > proc.time() user system elapsed 1.876 0.841 1.996