Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
33 39 45 46 45 45 49 50 54 59 58 56 48 50 52 53 55 43 42 38 41 41 39 34 27 15 14 31 41 43 46 42 45 45 40 35 36 38 39 32 24 21 12 29 36 31 28 30 38 27 40 40 44 47 45 42 38 46 37 41 40 33 34 36 36 38 42 35 25 24 22 27 17 30 30 34 37 36 33 33 33 37 40 35 37 43 42 33 39 40 37 44 42 43 40 30 30 31 18 24 22 26 28 23 17 12 9 19 21 18 18 15 24 18 19 30 33 35 36 47 46
Data Y:
62 64 62 64 64 69 69 65 56 58 53 62 55 60 59 58 53 57 57 53 54 53 57 57 55 49 50 49 54 58 58 52 56 52 59 53 52 53 51 50 56 52 46 48 46 48 48 49 53 48 51 48 50 55 52 53 52 55 53 53 56 54 52 55 54 59 56 56 51 53 52 51 46 49 46 55 57 53 52 53 50 54 53 50 51 52 47 51 49 53 52 45 53 51 48 48 48 48 40 43 40 39 39 36 41 39 40 39 46 40 37 37 44 41 40 36 38 43 42 45 46
Sample Range:
(leave blank to include all observations)
From:
To:
Chart options
Label y-axis:
Label x-axis:
R Code
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 mx mxli 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)) bitmap(file='test1.png') plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') grid() dev.off() bitmap(file='test2.png') plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') abline(r) grid() mtext(paste('Residual Standard Deviation = ',se)) dev.off() bitmap(file='test3.png') plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') abline(r1) grid() mtext(paste('Residual Standard Deviation = ',se1)) dev.off() load(file='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='mytable.tab')
Compute
Summary of computational transaction
Raw Input
view raw input (R code)
Raw Output
view raw output of R engine
Computing time
0 seconds
R Server
Big Analytics Cloud Computing Center
Click here to blog (archive) this computation