R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(122302.01 + ,109264.65 + ,103674.75 + ,103890.3 + ,75512.66 + ,83121.3 + ,125096.81 + ,74206.73 + ,88481.63 + ,111598.17 + ,146919.48 + ,150790.85 + ,113780.5 + ,110870.76 + ,118785.32 + ,112820.5 + ,102188.92 + ,97092.73 + ,114067.82 + ,89690.15 + ,89267.9 + ,96198.64 + ,129599.75 + ,169424.7 + ,152510.91 + ,121850.2 + ,144737.64 + ,121381.88 + ,106894.86 + ,94305.06 + ,116800.42 + ,77584.28 + ,100680.88 + ,106634.05 + ,168390.77 + ,211971.89 + ,136163.28 + ,168950.25 + ,89816.88 + ,85406.93 + ,66055.52 + ,73311.68 + ,85674.51 + ,82822.59 + ,94277.63 + ,100991.65 + ,149245.88 + ,208517.17 + ,40733.51 + ,121352.23 + ,104020.11 + ,99566.82 + ,101352.17 + ,106628.41 + ,109696.95 + ,248696.37 + ,105628.33 + ,120449.17 + ,136547.7 + ,140896.42 + ,131509.91 + ,95450.31 + ,133592.64 + ,110332.9 + ,88110.54 + ,64931.25 + ,98446.22 + ,84212.38 + ,77519.55 + ,124806.02 + ,102185.94 + ,151348.79 + ,124378.28 + ,101433.13 + ,126724.22 + ,87461.88 + ,95288.27 + ,129055.33 + ,107753.06 + ,96364.03 + ,71662.75 + ,125666.24 + ,456841.51 + ,167642.32 + ,167154.73 + ,139685.18 + ,119275.2 + ,122746.05 + ,107337.43 + ,112584.89 + ,133183.08 + ,121152.57 + ,119815.6 + ,122858.44 + ,152077.17 + ,157221.96 + ,140435.08 + ,101455.09 + ,104791.29 + ,77226.59 + ,84477.43 + ,66227.74 + ,89076.23 + ,108924.43 + ,83926.11 + ,91764.8 + ,120892.76 + ,129952.42 + ,135865.14 + ,105512.77 + ,96486.62 + ,78064.88 + ,92370.22 + ,98454.46 + ,96703.93 + ,83170.95) > x <- c(589,606,566,487,442,463,547,432,513,602,637,913,576,634,563,513,483,477,524,470,427,537,662,1079,816,705,653,584,508,446,604,446,512,533,791,1206,783,567,473,412,314,323,438,429,468,518,555,816,673,593,569,505,447,433,549,553,505,601,706,852,643,448,551,476,416,331,435,395,405,619,596,889,668,555,620,472,460,417,582,525,507,750,899,1075,993,777,675,655,535,491,686,637,652,794,859,1049,1022,762,762,563,573,473,527,710,630,706,870,1069,1021,799,694,521,622,614,661,630) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Linearity Plot (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.4912073 0.4916518 0.4920953 0.4925378 0.4929792 0.4934196 0.4938589 [8] 0.4942971 0.4947342 0.4951703 0.4956052 0.4960391 0.4964719 0.4969035 [15] 0.4973340 0.4977634 0.4981917 0.4986188 0.4990447 0.4994696 0.4998932 [22] 0.5003157 0.5007370 0.5011571 0.5015760 0.5019937 0.5024103 0.5028256 [29] 0.5032397 0.5036526 0.5040642 0.5044746 0.5048838 0.5052917 0.5056983 [36] 0.5061037 0.5065079 0.5069107 0.5073123 0.5077125 0.5081115 0.5085092 [43] 0.5089056 0.5093006 0.5096944 0.5100868 0.5104778 0.5108676 0.5112560 [50] 0.5116430 0.5120287 0.5124130 0.5127960 0.5131775 0.5135577 0.5139365 [57] 0.5143139 0.5146899 0.5150645 0.5154377 0.5158095 0.5161799 0.5165488 [64] 0.5169163 0.5172823 0.5176469 0.5180101 0.5183718 0.5187320 0.5190908 [71] 0.5194481 0.5198039 0.5201583 0.5205111 0.5208624 0.5212123 0.5215606 [78] 0.5219075 0.5222528 0.5225966 0.5229389 0.5232796 0.5236188 0.5239565 [85] 0.5242926 0.5246272 0.5249602 0.5252916 0.5256215 0.5259498 0.5262765 [92] 0.5266017 0.5269253 0.5272473 0.5275676 0.5278864 0.5282036 0.5285192 [99] 0.5288332 0.5291455 0.5294562 0.5297653 0.5300728 0.5303787 0.5306829 [106] 0.5309854 0.5312863 0.5315856 0.5318832 0.5321791 0.5324734 0.5327660 [113] 0.5330570 0.5333463 0.5336338 0.5339198 0.5342040 0.5344865 0.5347673 [120] 0.5350465 0.5353239 0.5355997 0.5358737 0.5361460 0.5364166 0.5366855 [127] 0.5369527 0.5372181 0.5374818 0.5377438 0.5380040 0.5382625 0.5385193 [134] 0.5387743 0.5390276 0.5392791 0.5395288 0.5397768 0.5400231 0.5402676 [141] 0.5405103 0.5407513 0.5409904 0.5412279 0.5414635 0.5416973 0.5419294 [148] 0.5421597 0.5423882 0.5426149 0.5428399 0.5430630 0.5432843 0.5435039 [155] 0.5437216 0.5439376 0.5441517 0.5443640 0.5445746 0.5447833 0.5449902 [162] 0.5451953 0.5453985 0.5456000 0.5457996 0.5459974 0.5461934 0.5463876 [169] 0.5465799 0.5467704 0.5469591 0.5471460 0.5473310 0.5475142 0.5476956 [176] 0.5478751 0.5480528 0.5482286 0.5484026 0.5485748 0.5487451 0.5489136 [183] 0.5490802 0.5492450 0.5494079 0.5495690 0.5497283 0.5498857 0.5500412 [190] 0.5501950 0.5503468 0.5504968 0.5506450 0.5507913 0.5509357 0.5510783 [197] 0.5512191 0.5513580 0.5514950 0.5516302 0.5517635 0.5518950 0.5520246 [204] 0.5521524 0.5522783 0.5524024 0.5525246 0.5526449 0.5527634 0.5528801 [211] 0.5529949 0.5531078 0.5532189 0.5533282 0.5534355 0.5535411 0.5536448 [218] 0.5537466 0.5538466 0.5539447 0.5540410 0.5541354 0.5542280 0.5543188 [225] 0.5544077 0.5544947 0.5545799 0.5546633 0.5547448 0.5548245 0.5549024 [232] 0.5549784 0.5550525 0.5551249 0.5551954 0.5552640 0.5553309 0.5553959 [239] 0.5554591 0.5555204 0.5555799 0.5556376 0.5556935 0.5557476 0.5557998 [246] 0.5558502 0.5558988 0.5559456 0.5559906 0.5560338 0.5560751 0.5561147 [253] 0.5561524 0.5561884 0.5562225 0.5562548 0.5562854 0.5563141 0.5563411 [260] 0.5563663 0.5563897 0.5564113 0.5564311 0.5564491 0.5564654 0.5564799 [267] 0.5564926 0.5565035 0.5565127 0.5565201 0.5565258 0.5565297 0.5565318 [274] 0.5565322 0.5565308 0.5565277 0.5565229 0.5565163 0.5565079 0.5564978 [281] 0.5564860 0.5564725 0.5564572 0.5564403 0.5564215 0.5564011 0.5563790 [288] 0.5563551 0.5563296 0.5563023 0.5562734 0.5562427 0.5562104 0.5561763 [295] 0.5561406 0.5561032 0.5560641 0.5560234 0.5559809 0.5559368 0.5558911 [302] 0.5558436 0.5557946 0.5557438 0.5556915 0.5556374 0.5555818 0.5555245 [309] 0.5554655 0.5554050 0.5553428 0.5552790 0.5552135 0.5551465 0.5550778 [316] 0.5550076 0.5549357 0.5548623 0.5547872 0.5547106 0.5546324 0.5545526 [323] 0.5544713 0.5543883 0.5543038 0.5542178 0.5541302 0.5540410 0.5539503 [330] 0.5538580 0.5537642 0.5536689 0.5535721 0.5534737 0.5533738 0.5532724 [337] 0.5531694 0.5530650 0.5529591 0.5528517 0.5527428 0.5526324 0.5525205 [344] 0.5524071 0.5522923 0.5521760 0.5520582 0.5519390 0.5518184 0.5516963 [351] 0.5515727 0.5514477 0.5513213 0.5511935 0.5510642 0.5509335 0.5508014 [358] 0.5506679 0.5505330 0.5503967 0.5502591 0.5501200 0.5499796 0.5498377 [365] 0.5496945 0.5495500 0.5494041 0.5492568 0.5491082 0.5489583 0.5488070 [372] 0.5486544 0.5485004 0.5483452 0.5481886 0.5480307 0.5478715 0.5477110 [379] 0.5475492 0.5473862 0.5472218 0.5470562 0.5468893 0.5467211 0.5465517 [386] 0.5463810 0.5462091 0.5460359 0.5458615 0.5456859 0.5455090 0.5453310 [393] 0.5451517 0.5449712 0.5447894 0.5446065 0.5444224 0.5442371 0.5440507 [400] 0.5438630 0.5436742 > mx [1] 0.5565322 > mxli [1] 0.73 > 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/18j4l1196676290.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/2jng71196676290.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/31t0e1196676290.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 > 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/4qwq11196676290.tab") > > system("convert tmp/18j4l1196676290.ps tmp/18j4l1196676290.png") > system("convert tmp/2jng71196676290.ps tmp/2jng71196676290.png") > system("convert tmp/31t0e1196676290.ps tmp/31t0e1196676290.png") > > > proc.time() user system elapsed 1.059 0.524 1.216