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(74.8,93.1,103.9,83.9,77.7,141.5,58.9,75.3,108.4,91,84.6,179.8,85.6,76.4,109.7,99.1,86.7,111.4,78.4,76.7,114.2,99.7,94.2,173.5,83.1,88.9,132,122.1,105.1,133.7,63.6,112.7,120.5,112,126.2,209.2,91,116.7,137.6,108.1,136.6,152.3,114.3,120.7,131.8,129.4,187.5,189.5,109.2,158.1,176.2,125.5,155,170.3,99.4,139.2,169.6,136.1,168.2,318.6,154.1,161.4,183.4,167.2,205.3) > x <- c(89.3,87.5,106.7,102.5,109.2,123.7,83.1,97,119.1,125.1,113.6,122.4,92.8,97.2,115.6,111.3,114.6,137.5,83.7,106,123.4,126.5,120,141.6,90.5,96.5,113.5,120.1,123.9,144.4,90.8,114.2,138.1,135,131.3,144.6,101.7,108.7,135.3,124.3,138.3,158.2,93.5,124.8,154.4,152.8,148.9,170.3,124.8,134.4,154,147.9,168.1,175.7,116.7,140.8,164.2,173.8,167.8,166.6,135.1,158.1,151.8,168.7,166.9) > #'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.7269233 0.7272170 0.7275102 0.7278027 0.7280947 0.7283861 0.7286769 [8] 0.7289670 0.7292566 0.7295456 0.7298340 0.7301218 0.7304089 0.7306954 [15] 0.7309814 0.7312667 0.7315514 0.7318354 0.7321188 0.7324016 0.7326838 [22] 0.7329653 0.7332462 0.7335265 0.7338061 0.7340850 0.7343633 0.7346410 [29] 0.7349180 0.7351944 0.7354700 0.7357451 0.7360194 0.7362931 0.7365662 [36] 0.7368385 0.7371102 0.7373812 0.7376515 0.7379212 0.7381901 0.7384584 [43] 0.7387260 0.7389929 0.7392591 0.7395245 0.7397893 0.7400534 0.7403168 [50] 0.7405795 0.7408415 0.7411027 0.7413633 0.7416231 0.7418822 0.7421406 [57] 0.7423983 0.7426552 0.7429114 0.7431669 0.7434216 0.7436756 0.7439289 [64] 0.7441814 0.7444332 0.7446842 0.7449345 0.7451841 0.7454329 0.7456809 [71] 0.7459282 0.7461747 0.7464204 0.7466654 0.7469097 0.7471531 0.7473958 [78] 0.7476377 0.7478789 0.7481192 0.7483588 0.7485976 0.7488356 0.7490729 [85] 0.7493093 0.7495450 0.7497798 0.7500139 0.7502472 0.7504796 0.7507113 [92] 0.7509422 0.7511723 0.7514015 0.7516300 0.7518576 0.7520845 0.7523105 [99] 0.7525357 0.7527601 0.7529836 0.7532064 0.7534283 0.7536494 0.7538696 [106] 0.7540891 0.7543077 0.7545254 0.7547424 0.7549585 0.7551737 0.7553881 [113] 0.7556017 0.7558144 0.7560263 0.7562373 0.7564475 0.7566569 0.7568653 [120] 0.7570730 0.7572797 0.7574856 0.7576907 0.7578949 0.7580982 0.7583006 [127] 0.7585022 0.7587029 0.7589028 0.7591018 0.7592999 0.7594971 0.7596935 [134] 0.7598890 0.7600836 0.7602773 0.7604701 0.7606621 0.7608531 0.7610433 [141] 0.7612326 0.7614210 0.7616085 0.7617951 0.7619809 0.7621657 0.7623496 [148] 0.7625327 0.7627148 0.7628960 0.7630764 0.7632558 0.7634343 0.7636119 [155] 0.7637887 0.7639645 0.7641394 0.7643133 0.7644864 0.7646586 0.7648298 [162] 0.7650002 0.7651696 0.7653381 0.7655057 0.7656723 0.7658381 0.7660029 [169] 0.7661668 0.7663297 0.7664918 0.7666529 0.7668131 0.7669724 0.7671307 [176] 0.7672881 0.7674446 0.7676002 0.7677548 0.7679085 0.7680612 0.7682130 [183] 0.7683639 0.7685138 0.7686628 0.7688109 0.7689580 0.7691042 0.7692495 [190] 0.7693938 0.7695372 0.7696796 0.7698211 0.7699616 0.7701012 0.7702398 [197] 0.7703775 0.7705143 0.7706501 0.7707850 0.7709189 0.7710518 0.7711839 [204] 0.7713149 0.7714450 0.7715742 0.7717024 0.7718297 0.7719560 0.7720813 [211] 0.7722057 0.7723292 0.7724517 0.7725732 0.7726938 0.7728135 0.7729322 [218] 0.7730499 0.7731667 0.7732825 0.7733973 0.7735112 0.7736242 0.7737362 [225] 0.7738472 0.7739573 0.7740664 0.7741746 0.7742818 0.7743880 0.7744933 [232] 0.7745976 0.7747010 0.7748034 0.7749049 0.7750054 0.7751049 0.7752035 [239] 0.7753012 0.7753978 0.7754935 0.7755883 0.7756821 0.7757749 0.7758668 [246] 0.7759577 0.7760477 0.7761367 0.7762248 0.7763119 0.7763980 0.7764832 [253] 0.7765674 0.7766507 0.7767330 0.7768144 0.7768948 0.7769742 0.7770527 [260] 0.7771303 0.7772069 0.7772825 0.7773572 0.7774309 0.7775037 0.7775755 [267] 0.7776464 0.7777163 0.7777853 0.7778533 0.7779204 0.7779865 0.7780517 [274] 0.7781159 0.7781792 0.7782415 0.7783029 0.7783633 0.7784228 0.7784814 [281] 0.7785390 0.7785956 0.7786514 0.7787061 0.7787600 0.7788129 0.7788648 [288] 0.7789158 0.7789659 0.7790151 0.7790633 0.7791105 0.7791569 0.7792022 [295] 0.7792467 0.7792902 0.7793328 0.7793745 0.7794152 0.7794550 0.7794939 [302] 0.7795318 0.7795689 0.7796050 0.7796401 0.7796744 0.7797077 0.7797401 [309] 0.7797715 0.7798021 0.7798317 0.7798604 0.7798882 0.7799151 0.7799411 [316] 0.7799661 0.7799903 0.7800135 0.7800358 0.7800572 0.7800777 0.7800973 [323] 0.7801160 0.7801337 0.7801506 0.7801666 0.7801816 0.7801958 0.7802091 [330] 0.7802214 0.7802329 0.7802435 0.7802531 0.7802619 0.7802698 0.7802768 [337] 0.7802829 0.7802881 0.7802925 0.7802959 0.7802985 0.7803002 0.7803009 [344] 0.7803009 0.7802999 0.7802981 0.7802953 0.7802917 0.7802873 0.7802819 [351] 0.7802757 0.7802687 0.7802607 0.7802519 0.7802422 0.7802317 0.7802203 [358] 0.7802080 0.7801949 0.7801809 0.7801661 0.7801504 0.7801338 0.7801164 [365] 0.7800982 0.7800791 0.7800591 0.7800384 0.7800167 0.7799943 0.7799709 [372] 0.7799468 0.7799218 0.7798960 0.7798693 0.7798418 0.7798135 0.7797843 [379] 0.7797544 0.7797236 0.7796919 0.7796595 0.7796262 0.7795921 0.7795572 [386] 0.7795215 0.7794849 0.7794476 0.7794094 0.7793705 0.7793307 0.7792901 [393] 0.7792487 0.7792065 0.7791635 0.7791198 0.7790752 0.7790298 0.7789836 [400] 0.7789367 0.7788889 > mx [1] 0.780301 > mxli [1] 1.42 > 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/154ce1226338621.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/2zog51226338621.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/308r01226338621.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/4pgtm1226338621.tab") > > system("convert tmp/154ce1226338621.ps tmp/154ce1226338621.png") > system("convert tmp/2zog51226338621.ps tmp/2zog51226338621.png") > system("convert tmp/308r01226338621.ps tmp/308r01226338621.png") > > > proc.time() user system elapsed 1.259 0.837 1.518