|
|
|
 | :: Box-Cox Linearity Plot - Free Statistics Software (Calculator) :: | |
|
All rights reserved. The non-commercial (academic) use of this software is free of charge. The only thing that is asked in return is to cite this software when results are used in publications.
This free online software (calculator) computes the Box-Cox Linearity Plot. This analysis is used to identify a (quasi-)optimal Box-Cox transformation of the independent data series (x) in the linear relationship y = a + b x
Click here to edit the underlying code of this R Module.Enter (or paste) your data delimited by hard returns. Click here to edit the underlying code of this R Module.
| Cite this software as: | | Wessa P., (2008), Box-Cox Linearity Plot (v1.0.4) in Free Statistics Software (v1.1.22-r6), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ | | | The R code is based on : | | | NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/, 2006-10-03. | | | | | | | | | | | | | |
|
| Source code of R module | | 1 | n <- length(x) | | 2 | c <- array(NA,dim=c(401)) | | 3 | l <- array(NA,dim=c(401)) | | 4 | mx <- 0 | | 5 | mxli <- -999 | | 6 | for (i in 1:401) | | 7 | { | | 8 | l[i] <- (i-201)/100 | | 9 | if (l[i] != 0) | | 10 | { | | 11 | x1 <- (x^l[i] - 1) / l[i] | | 12 | } else { | | 13 | x1 <- log(x) | | 14 | } | | 15 | c[i] <- cor(x1,y) | | 16 | if (mx < abs(c[i])) | | 17 | { | | 18 | mx <- abs(c[i]) | | 19 | mxli <- l[i] | | 20 | } | | 21 | } | | 22 | c | | 23 | mx | | 24 | mxli | | 25 | if (mxli != 0) | | 26 | { | | 27 | x1 <- (x^mxli - 1) / mxli | | 28 | } else { | | 29 | x1 <- log(x) | | 30 | } | | 31 | r<-lm(y~x) | | 32 | se <- sqrt(var(r$residuals)) | | 33 | r1 <- lm(y~x1) | | 34 | se1 <- sqrt(var(r1$residuals)) | | 35 | bitmap(file="test1.png") | | 36 | plot(l,c,main="Box-Cox Linearity Plot",xlab="Lambda",ylab="correlation") | | 37 | grid() | | 38 | dev.off() | | 39 | bitmap(file="test2.png") | | 40 | plot(x,y,main="Linear Fit of Original Data",xlab="x",ylab="y") | | 41 | abline(r) | | 42 | grid() | | 43 | mtext(paste("Residual Standard Deviation = ",se)) | | 44 | dev.off() | | 45 | bitmap(file="test3.png") | | 46 | plot(x1,y,main="Linear Fit of Transformed Data",xlab="x",ylab="y") | | 47 | abline(r1) | | 48 | grid() | | 49 | mtext(paste("Residual Standard Deviation = ",se1)) | | 50 | dev.off() | | 51 | load(file="createtable") | | 52 | a<-table.start() | | 53 | a<-table.row.start(a) | | 54 | a<-table.element(a,"Box-Cox Linearity Plot",2,TRUE) | | 55 | a<-table.row.end(a) | | 56 | a<-table.row.start(a) | | 57 | a<-table.element(a,"# observations x",header=TRUE) | | 58 | a<-table.element(a,n) | | 59 | a<-table.row.end(a) | | 60 | a<-table.row.start(a) | | 61 | a<-table.element(a,"maximum correlation",header=TRUE) | | 62 | a<-table.element(a,mx) | | 63 | a<-table.row.end(a) | | 64 | a<-table.row.start(a) | | 65 | a<-table.element(a,"optimal lambda(x)",header=TRUE) | | 66 | a<-table.element(a,mxli) | | 67 | a<-table.row.end(a) | | 68 | a<-table.row.start(a) | | 69 | a<-table.element(a,"Residual SD (orginial)",header=TRUE) | | 70 | a<-table.element(a,se) | | 71 | a<-table.row.end(a) | | 72 | a<-table.row.start(a) | | 73 | a<-table.element(a,"Residual SD (transformed)",header=TRUE) | | 74 | a<-table.element(a,se1) | | 75 | a<-table.row.end(a) | | 76 | a<-table.end(a) | | 77 | table.save(a,file="mytable.tab") |
|
To cite Wessa.net in publications use: Wessa, P. (2008), Free Statistics Software, Office for Research Development and Education, version 1.1.22-r6, URL http://www.wessa.net/
© Resa
R&D, and the 'Office for Research, Development, and Education' - All rights reserved. Academic license for non-commercial use only. This website is an intellectual
and physical property of Resa R&D. This includes: html content,
graphical illustrations (gif files), computer software, online or electronic
documentation, associated media, and printed materials. The free use of the scientific content, services, and applications in this website is
granted for non commercial use only. In any case,
the source (url) should always be clearly displayed. Under no circumstances are
you allowed to reproduce, copy or redistribute the design, layout, or any
content of this website (for commercial use) including any materials contained
herein without the express written permission of Resa R&D or the Office for Research, Development, and Education.
Information provided
on this web site is provided "AS IS" without warranty of any kind, either
express or implied, including, without limitation, warranties of
merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information
and periodically update the information, and software without notice. However, Resa
R&D makes no warranties or representations
as to the accuracy or completeness of such information (or software), and it assumes no
liability or responsibility for errors or omissions in the content of this web
site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and
under no legal theory shall Resa R&D be liable to you or any other
person for any direct, indirect, special, incidental, exemplary, or
consequential damages arising from your access to, or use of, this web site.
Software Version : 1.1.22-r6 Algorithms & Software : Prof. dr. P. Wessa Facilities : Resa R&D - Office for Research, Development, and Education Server : www.wessa.net
Comments, Feedback & Errors | Privacy Policy | Statistics Resources | Wessa.net Home
|
|
|
|
|
|
|
|