R version 2.8.0 (2008-10-20) 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(562000,561000,555000,544000,537000,543000,594000,611000,613000,611000,594000,595000,591000,589000,584000,573000,567000,569000,621000,629000,628000,612000,595000,597000,593000,590000,580000,574000,573000,573000,620000,626000,620000,588000,566000,557000,561000,549000,532000,526000,511000,499000,555000,565000,542000,527000,510000,514000,517000,508000,493000,490000,469000,478000,528000,534000,518000,506000,502000,516000) > x <- c(1.6,1.8,1.6,1.5,1.5,1.3,1.4,1.4,1.3,1.3,1.2,1.1,1.4,1.2,1.5,1.1,1.3,1.5,1.1,1.4,1.3,1.5,1.6,1.7,1.1,1.6,1.3,1.7,1.6,1.7,1.9,1.8,1.9,1.6,1.5,1.6,1.6,1.7,2,2,1.9,1.7,1.8,1.9,1.7,2,2.1,2.4,2.5,2.5,2.6,2.2,2.5,2.8,2.8,2.9,3,3.1,2.9,2.7) > #'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.6730571 -0.6735056 -0.6739529 -0.6743991 -0.6748442 -0.6752880 [7] -0.6757307 -0.6761722 -0.6766125 -0.6770516 -0.6774895 -0.6779261 [13] -0.6783615 -0.6787957 -0.6792286 -0.6796603 -0.6800906 -0.6805198 [19] -0.6809476 -0.6813741 -0.6817993 -0.6822233 -0.6826459 -0.6830671 [25] -0.6834871 -0.6839056 -0.6843229 -0.6847387 -0.6851532 -0.6855663 [31] -0.6859781 -0.6863884 -0.6867973 -0.6872048 -0.6876109 -0.6880156 [37] -0.6884188 -0.6888206 -0.6892209 -0.6896198 -0.6900171 -0.6904130 [43] -0.6908075 -0.6912004 -0.6915918 -0.6919817 -0.6923701 -0.6927570 [49] -0.6931423 -0.6935261 -0.6939083 -0.6942890 -0.6946681 -0.6950456 [55] -0.6954215 -0.6957959 -0.6961686 -0.6965398 -0.6969093 -0.6972772 [61] -0.6976435 -0.6980081 -0.6983711 -0.6987325 -0.6990922 -0.6994502 [67] -0.6998065 -0.7001612 -0.7005142 -0.7008655 -0.7012151 -0.7015629 [73] -0.7019091 -0.7022535 -0.7025962 -0.7029372 -0.7032764 -0.7036139 [79] -0.7039496 -0.7042835 -0.7046157 -0.7049461 -0.7052747 -0.7056015 [85] -0.7059265 -0.7062497 -0.7065711 -0.7068907 -0.7072085 -0.7075244 [91] -0.7078385 -0.7081507 -0.7084611 -0.7087697 -0.7090763 -0.7093811 [97] -0.7096841 -0.7099851 -0.7102843 -0.7105816 -0.7108770 -0.7111705 [103] -0.7114621 -0.7117517 -0.7120395 -0.7123253 -0.7126092 -0.7128911 [109] -0.7131712 -0.7134492 -0.7137254 -0.7139995 -0.7142717 -0.7145420 [115] -0.7148102 -0.7150765 -0.7153409 -0.7156032 -0.7158635 -0.7161219 [121] -0.7163782 -0.7166326 -0.7168849 -0.7171352 -0.7173835 -0.7176298 [127] -0.7178741 -0.7181163 -0.7183565 -0.7185947 -0.7188308 -0.7190649 [133] -0.7192969 -0.7195269 -0.7197548 -0.7199807 -0.7202045 -0.7204262 [139] -0.7206459 -0.7208635 -0.7210790 -0.7212925 -0.7215038 -0.7217131 [145] -0.7219203 -0.7221254 -0.7223284 -0.7225293 -0.7227281 -0.7229248 [151] -0.7231194 -0.7233119 -0.7235023 -0.7236906 -0.7238767 -0.7240608 [157] -0.7242427 -0.7244225 -0.7246002 -0.7247757 -0.7249492 -0.7251205 [163] -0.7252897 -0.7254567 -0.7256216 -0.7257844 -0.7259450 -0.7261035 [169] -0.7262599 -0.7264141 -0.7265662 -0.7267162 -0.7268640 -0.7270096 [175] -0.7271531 -0.7272945 -0.7274337 -0.7275708 -0.7277057 -0.7278385 [181] -0.7279691 -0.7280976 -0.7282239 -0.7283481 -0.7284702 -0.7285901 [187] -0.7287078 -0.7288234 -0.7289368 -0.7290481 -0.7291572 -0.7292642 [193] -0.7293691 -0.7294718 -0.7295723 -0.7296707 -0.7297670 -0.7298611 [199] -0.7299530 -0.7300429 -0.7301306 -0.7302161 -0.7302995 -0.7303807 [205] -0.7304599 -0.7305368 -0.7306117 -0.7306844 -0.7307550 -0.7308234 [211] -0.7308898 -0.7309539 -0.7310160 -0.7310760 -0.7311338 -0.7311895 [217] -0.7312430 -0.7312945 -0.7313439 -0.7313911 -0.7314362 -0.7314792 [223] -0.7315202 -0.7315590 -0.7315957 -0.7316303 -0.7316628 -0.7316932 [229] -0.7317216 -0.7317478 -0.7317720 -0.7317941 -0.7318141 -0.7318320 [235] -0.7318478 -0.7318616 -0.7318734 -0.7318830 -0.7318906 -0.7318962 [241] -0.7318997 -0.7319011 -0.7319005 -0.7318979 -0.7318932 -0.7318865 [247] -0.7318777 -0.7318669 -0.7318542 -0.7318393 -0.7318225 -0.7318037 [253] -0.7317828 -0.7317600 -0.7317351 -0.7317083 -0.7316795 -0.7316486 [259] -0.7316158 -0.7315811 -0.7315443 -0.7315056 -0.7314649 -0.7314223 [265] -0.7313777 -0.7313312 -0.7312827 -0.7312323 -0.7311799 -0.7311256 [271] -0.7310694 -0.7310113 -0.7309512 -0.7308893 -0.7308254 -0.7307597 [277] -0.7306920 -0.7306225 -0.7305511 -0.7304778 -0.7304026 -0.7303255 [283] -0.7302466 -0.7301659 -0.7300833 -0.7299988 -0.7299125 -0.7298244 [289] -0.7297344 -0.7296426 -0.7295490 -0.7294536 -0.7293564 -0.7292574 [295] -0.7291566 -0.7290540 -0.7289496 -0.7288435 -0.7287355 -0.7286259 [301] -0.7285144 -0.7284012 -0.7282863 -0.7281696 -0.7280512 -0.7279310 [307] -0.7278092 -0.7276856 -0.7275603 -0.7274333 -0.7273046 -0.7271742 [313] -0.7270422 -0.7269085 -0.7267731 -0.7266360 -0.7264973 -0.7263569 [319] -0.7262149 -0.7260712 -0.7259259 -0.7257790 -0.7256305 -0.7254803 [325] -0.7253286 -0.7251753 -0.7250203 -0.7248638 -0.7247057 -0.7245460 [331] -0.7243848 -0.7242220 -0.7240577 -0.7238918 -0.7237244 -0.7235554 [337] -0.7233850 -0.7232130 -0.7230395 -0.7228645 -0.7226880 -0.7225100 [343] -0.7223305 -0.7221496 -0.7219671 -0.7217833 -0.7215979 -0.7214112 [349] -0.7212230 -0.7210333 -0.7208422 -0.7206497 -0.7204558 -0.7202605 [355] -0.7200638 -0.7198657 -0.7196662 -0.7194653 -0.7192631 -0.7190595 [361] -0.7188546 -0.7186483 -0.7184406 -0.7182316 -0.7180213 -0.7178097 [367] -0.7175967 -0.7173825 -0.7171669 -0.7169501 -0.7167320 -0.7165126 [373] -0.7162919 -0.7160700 -0.7158468 -0.7156223 -0.7153966 -0.7151697 [379] -0.7149415 -0.7147121 -0.7144815 -0.7142497 -0.7140167 -0.7137825 [385] -0.7135472 -0.7133106 -0.7130729 -0.7128340 -0.7125939 -0.7123527 [391] -0.7121103 -0.7118668 -0.7116222 -0.7113764 -0.7111296 -0.7108816 [397] -0.7106325 -0.7103823 -0.7101311 -0.7098787 -0.7096253 > mx [1] 0.7319011 > mxli [1] 0.41 > 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/freestat/rcomp/tmp/1jx1f1258039857.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/freestat/rcomp/tmp/20knt1258039857.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/freestat/rcomp/tmp/3t8ri1258039857.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/48f4c1258039857.tab") > > system("convert tmp/1jx1f1258039857.ps tmp/1jx1f1258039857.png") > system("convert tmp/20knt1258039857.ps tmp/20knt1258039857.png") > system("convert tmp/3t8ri1258039857.ps tmp/3t8ri1258039857.png") > > > proc.time() user system elapsed 1.182 0.779 1.346