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. > y <- c(449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430,424,433,456,459) > x <- c(162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137) > #'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.7888035 0.7888171 0.7888298 0.7888416 0.7888526 0.7888627 0.7888719 [8] 0.7888803 0.7888879 0.7888945 0.7889003 0.7889053 0.7889094 0.7889126 [15] 0.7889150 0.7889165 0.7889172 0.7889170 0.7889159 0.7889140 0.7889112 [22] 0.7889075 0.7889030 0.7888976 0.7888914 0.7888843 0.7888764 0.7888675 [29] 0.7888579 0.7888473 0.7888359 0.7888237 0.7888106 0.7887966 0.7887817 [36] 0.7887661 0.7887495 0.7887321 0.7887138 0.7886947 0.7886747 0.7886538 [43] 0.7886321 0.7886095 0.7885861 0.7885618 0.7885366 0.7885106 0.7884838 [50] 0.7884561 0.7884275 0.7883980 0.7883677 0.7883366 0.7883046 0.7882717 [57] 0.7882380 0.7882034 0.7881680 0.7881317 0.7880946 0.7880566 0.7880177 [64] 0.7879780 0.7879375 0.7878960 0.7878538 0.7878107 0.7877667 0.7877219 [71] 0.7876762 0.7876297 0.7875823 0.7875341 0.7874850 0.7874351 0.7873844 [78] 0.7873327 0.7872803 0.7872270 0.7871728 0.7871178 0.7870620 0.7870053 [85] 0.7869477 0.7868894 0.7868301 0.7867701 0.7867092 0.7866474 0.7865848 [92] 0.7865214 0.7864571 0.7863920 0.7863261 0.7862593 0.7861916 0.7861232 [99] 0.7860539 0.7859837 0.7859128 0.7858410 0.7857683 0.7856949 0.7856206 [106] 0.7855454 0.7854694 0.7853927 0.7853150 0.7852366 0.7851573 0.7850772 [113] 0.7849962 0.7849145 0.7848319 0.7847485 0.7846642 0.7845792 0.7844933 [120] 0.7844066 0.7843191 0.7842307 0.7841416 0.7840516 0.7839608 0.7838692 [127] 0.7837767 0.7836835 0.7835894 0.7834946 0.7833989 0.7833024 0.7832051 [134] 0.7831070 0.7830081 0.7829083 0.7828078 0.7827065 0.7826043 0.7825014 [141] 0.7823976 0.7822931 0.7821877 0.7820815 0.7819746 0.7818668 0.7817583 [148] 0.7816489 0.7815388 0.7814279 0.7813161 0.7812036 0.7810903 0.7809762 [155] 0.7808613 0.7807457 0.7806292 0.7805119 0.7803939 0.7802751 0.7801555 [162] 0.7800351 0.7799140 0.7797920 0.7796693 0.7795458 0.7794215 0.7792965 [169] 0.7791707 0.7790441 0.7789167 0.7787886 0.7786597 0.7785300 0.7783996 [176] 0.7782684 0.7781364 0.7780037 0.7778702 0.7777360 0.7776009 0.7774652 [183] 0.7773287 0.7771914 0.7770533 0.7769145 0.7767750 0.7766347 0.7764937 [190] 0.7763519 0.7762094 0.7760661 0.7759220 0.7757773 0.7756318 0.7754855 [197] 0.7753385 0.7751908 0.7750423 0.7748931 0.7747432 0.7745925 0.7744411 [204] 0.7742890 0.7741361 0.7739825 0.7738282 0.7736732 0.7735174 0.7733609 [211] 0.7732037 0.7730458 0.7728872 0.7727278 0.7725677 0.7724069 0.7722454 [218] 0.7720832 0.7719203 0.7717567 0.7715924 0.7714273 0.7712616 0.7710951 [225] 0.7709280 0.7707601 0.7705916 0.7704223 0.7702524 0.7700818 0.7699104 [232] 0.7697384 0.7695657 0.7693923 0.7692183 0.7690435 0.7688680 0.7686919 [239] 0.7685151 0.7683376 0.7681594 0.7679806 0.7678011 0.7676209 0.7674400 [246] 0.7672585 0.7670763 0.7668934 0.7667099 0.7665257 0.7663408 0.7661553 [253] 0.7659691 0.7657823 0.7655948 0.7654066 0.7652178 0.7650284 0.7648383 [260] 0.7646475 0.7644561 0.7642641 0.7640714 0.7638781 0.7636841 0.7634895 [267] 0.7632942 0.7630983 0.7629018 0.7627047 0.7625069 0.7623085 0.7621094 [274] 0.7619098 0.7617095 0.7615086 0.7613070 0.7611049 0.7609021 0.7606987 [281] 0.7604947 0.7602901 0.7600849 0.7598790 0.7596726 0.7594655 0.7592579 [288] 0.7590496 0.7588407 0.7586313 0.7584212 0.7582106 0.7579993 0.7577874 [295] 0.7575750 0.7573620 0.7571483 0.7569341 0.7567193 0.7565040 0.7562880 [302] 0.7560715 0.7558544 0.7556367 0.7554184 0.7551995 0.7549801 0.7547601 [309] 0.7545396 0.7543185 0.7540968 0.7538745 0.7536517 0.7534284 0.7532044 [316] 0.7529799 0.7527549 0.7525293 0.7523032 0.7520765 0.7518492 0.7516214 [323] 0.7513931 0.7511642 0.7509348 0.7507048 0.7504743 0.7502433 0.7500117 [330] 0.7497796 0.7495470 0.7493138 0.7490801 0.7488459 0.7486112 0.7483759 [337] 0.7481401 0.7479038 0.7476670 0.7474297 0.7471918 0.7469534 0.7467146 [344] 0.7464752 0.7462353 0.7459949 0.7457540 0.7455126 0.7452707 0.7450283 [351] 0.7447854 0.7445420 0.7442981 0.7440538 0.7438089 0.7435635 0.7433177 [358] 0.7430714 0.7428246 0.7425773 0.7423295 0.7420813 0.7418325 0.7415833 [365] 0.7413337 0.7410835 0.7408329 0.7405818 0.7403303 0.7400783 0.7398258 [372] 0.7395729 0.7393195 0.7390656 0.7388113 0.7385566 0.7383014 0.7380457 [379] 0.7377896 0.7375331 0.7372761 0.7370186 0.7367607 0.7365024 0.7362437 [386] 0.7359845 0.7357248 0.7354648 0.7352043 0.7349434 0.7346820 0.7344202 [393] 0.7341580 0.7338954 0.7336324 0.7333689 0.7331050 0.7328407 0.7325760 [400] 0.7323109 0.7320453 > mx [1] 0.7889172 > mxli [1] -1.84 > 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/1nkt81257759174.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/rcomp/tmp/2euth1257759174.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/rcomp/tmp/3ah6x1257759174.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/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/45u371257759174.tab") > > system("convert tmp/1nkt81257759174.ps tmp/1nkt81257759174.png") > system("convert tmp/2euth1257759174.ps tmp/2euth1257759174.png") > system("convert tmp/3ah6x1257759174.ps tmp/3ah6x1257759174.png") > > > proc.time() user system elapsed 0.840 0.620 1.562