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(188.5,188.6,191.9,193.5,194.9,194.9,196.2,196.2,198,198.6,201.3,203.5,204.1,204.8,206.5,207.8,208.6,209.7,210,211.7,212.4,213.7,214.8,216.4,217.5,218.6,220.4,221.8,222.5,223.4,225.5,226.5,227.8,228.5,229.1,229.9,230.8,231.9,236,237.5) > x <- c(124.1,124.4,115.7,108.3,102.3,104.6,104,103.5,96,96.6,95.4,92.1,93,90.4,93.3,97.1,111,114.1,113.3,111,107.2,118.3,134.1,139,116.7,112.5,122.8,130,125.6,123.8,135.8,136.4,135.3,149.5,159.6,161.4,175.2,199.5,245,257.8) > #'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.7482707 0.7485276 0.7487831 0.7490372 0.7492899 0.7495413 0.7497912 [8] 0.7500397 0.7502868 0.7505324 0.7507766 0.7510194 0.7512607 0.7515005 [15] 0.7517389 0.7519758 0.7522111 0.7524450 0.7526773 0.7529082 0.7531374 [22] 0.7533652 0.7535914 0.7538160 0.7540390 0.7542605 0.7544804 0.7546987 [29] 0.7549153 0.7551304 0.7553438 0.7555556 0.7557657 0.7559742 0.7561810 [36] 0.7563861 0.7565896 0.7567913 0.7569913 0.7571897 0.7573863 0.7575811 [43] 0.7577743 0.7579656 0.7581553 0.7583431 0.7585292 0.7587134 0.7588959 [50] 0.7590765 0.7592554 0.7594324 0.7596076 0.7597809 0.7599524 0.7601220 [57] 0.7602897 0.7604555 0.7606195 0.7607815 0.7609417 0.7610999 0.7612562 [64] 0.7614105 0.7615629 0.7617133 0.7618618 0.7620082 0.7621527 0.7622952 [71] 0.7624357 0.7625742 0.7627106 0.7628450 0.7629774 0.7631077 0.7632360 [78] 0.7633622 0.7634863 0.7636083 0.7637282 0.7638461 0.7639618 0.7640753 [85] 0.7641868 0.7642961 0.7644033 0.7645083 0.7646111 0.7647117 0.7648102 [92] 0.7649065 0.7650006 0.7650924 0.7651821 0.7652695 0.7653547 0.7654376 [99] 0.7655183 0.7655967 0.7656728 0.7657467 0.7658183 0.7658876 0.7659546 [106] 0.7660193 0.7660816 0.7661417 0.7661994 0.7662547 0.7663077 0.7663584 [113] 0.7664067 0.7664526 0.7664961 0.7665373 0.7665760 0.7666124 0.7666463 [120] 0.7666779 0.7667070 0.7667336 0.7667579 0.7667797 0.7667990 0.7668159 [127] 0.7668303 0.7668422 0.7668517 0.7668587 0.7668631 0.7668651 0.7668646 [134] 0.7668616 0.7668560 0.7668479 0.7668373 0.7668242 0.7668085 0.7667903 [141] 0.7667695 0.7667461 0.7667202 0.7666917 0.7666607 0.7666270 0.7665908 [148] 0.7665520 0.7665106 0.7664665 0.7664199 0.7663707 0.7663188 0.7662644 [155] 0.7662073 0.7661475 0.7660852 0.7660202 0.7659525 0.7658822 0.7658093 [162] 0.7657337 0.7656554 0.7655745 0.7654909 0.7654046 0.7653157 0.7652241 [169] 0.7651298 0.7650328 0.7649331 0.7648308 0.7647257 0.7646180 0.7645076 [176] 0.7643944 0.7642786 0.7641600 0.7640388 0.7639148 0.7637882 0.7636588 [183] 0.7635267 0.7633919 0.7632543 0.7631141 0.7629711 0.7628254 0.7626770 [190] 0.7625259 0.7623720 0.7622154 0.7620561 0.7618940 0.7617293 0.7615618 [197] 0.7613915 0.7612186 0.7610429 0.7608645 0.7606834 0.7604995 0.7603129 [204] 0.7601236 0.7599316 0.7597368 0.7595393 0.7593391 0.7591362 0.7589306 [211] 0.7587222 0.7585111 0.7582973 0.7580808 0.7578616 0.7576397 0.7574151 [218] 0.7571878 0.7569577 0.7567250 0.7564896 0.7562515 0.7560106 0.7557672 [225] 0.7555210 0.7552721 0.7550206 0.7547664 0.7545095 0.7542500 0.7539878 [232] 0.7537229 0.7534554 0.7531852 0.7529124 0.7526370 0.7523589 0.7520782 [239] 0.7517949 0.7515089 0.7512204 0.7509292 0.7506354 0.7503390 0.7500400 [246] 0.7497385 0.7494343 0.7491276 0.7488183 0.7485065 0.7481921 0.7478751 [253] 0.7475556 0.7472336 0.7469090 0.7465819 0.7462523 0.7459202 0.7455856 [260] 0.7452485 0.7449089 0.7445668 0.7442223 0.7438753 0.7435258 0.7431739 [267] 0.7428195 0.7424628 0.7421036 0.7417420 0.7413779 0.7410115 0.7406427 [274] 0.7402716 0.7398980 0.7395221 0.7391439 0.7387633 0.7383804 0.7379951 [281] 0.7376076 0.7372177 0.7368256 0.7364311 0.7360344 0.7356355 0.7352343 [288] 0.7348308 0.7344251 0.7340172 0.7336071 0.7331948 0.7327803 0.7323636 [295] 0.7319448 0.7315238 0.7311007 0.7306754 0.7302480 0.7298185 0.7293869 [302] 0.7289532 0.7285175 0.7280797 0.7276398 0.7271979 0.7267540 0.7263081 [309] 0.7258601 0.7254102 0.7249583 0.7245044 0.7240486 0.7235908 0.7231312 [316] 0.7226696 0.7222061 0.7217407 0.7212734 0.7208043 0.7203333 0.7198605 [323] 0.7193859 0.7189095 0.7184312 0.7179512 0.7174694 0.7169859 0.7165006 [330] 0.7160136 0.7155249 0.7150344 0.7145423 0.7140485 0.7135531 0.7130560 [337] 0.7125573 0.7120569 0.7115550 0.7110514 0.7105463 0.7100397 0.7095314 [344] 0.7090217 0.7085104 0.7079976 0.7074834 0.7069676 0.7064504 0.7059317 [351] 0.7054117 0.7048901 0.7043672 0.7038429 0.7033173 0.7027902 0.7022618 [358] 0.7017321 0.7012011 0.7006687 0.7001351 0.6996002 0.6990641 0.6985267 [365] 0.6979881 0.6974482 0.6969072 0.6963650 0.6958216 0.6952770 0.6947313 [372] 0.6941845 0.6936366 0.6930875 0.6925374 0.6919863 0.6914340 0.6908808 [379] 0.6903265 0.6897712 0.6892149 0.6886577 0.6880994 0.6875403 0.6869801 [386] 0.6864191 0.6858572 0.6852944 0.6847307 0.6841661 0.6836007 0.6830344 [393] 0.6824674 0.6818995 0.6813309 0.6807615 0.6801913 0.6796204 0.6790487 [400] 0.6784763 0.6779032 > mx [1] 0.7668651 > mxli [1] -0.69 > 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/1mq6w1229252065.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/2e35e1229252065.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/3l60i1229252065.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/4nu7c1229252065.tab") > > system("convert tmp/1mq6w1229252065.ps tmp/1mq6w1229252065.png") > system("convert tmp/2e35e1229252065.ps tmp/2e35e1229252065.png") > system("convert tmp/3l60i1229252065.ps tmp/3l60i1229252065.png") > > > proc.time() user system elapsed 0.792 0.522 1.003