Free Statistics

of Irreproducible Research!

Author's title

Author*Unverified author*
R Software Modulerwasp_boxcoxlin.wasp
Title produced by softwareBox-Cox Linearity Plot
Date of computationWed, 12 Nov 2008 01:10:27 -0700
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2008/Nov/12/t12264775420nyrnx9pxr9ndz6.htm/, Retrieved Sun, 19 May 2024 08:47:52 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=24014, Retrieved Sun, 19 May 2024 08:47:52 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact223
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
F       [Box-Cox Linearity Plot] [Box-cox plot Opdr...] [2008-11-12 08:10:27] [20dfa2578b2b18ce36fdb36ac12aedd7] [Current]
Feedback Forum
2008-11-15 15:20:17 [Maarten Van Gucht] [reply
de student geeft een goede beschrijving van een box-cox plot: de Box-cox transformatie is om de X variabele te transformeren zodat de correlatie met de Y variabele maximaal wordt.In de box-cox linearity plot krijg je ofwel een stijgende of een dalende lijn.
In een scatterplot krijg je meestal 1 rechte door de waarnemingen heen. Deze is de regressilijn (de optimale lijn door de punten) maar deze is altijd recht. De box-cox transponeert! => voor een beter verband. Wat we meestal hopen te zien is een stijgende kromme. Dit wil zeggen dat er een maximum is (meestal in 2),maar in dit geval is de lambda 0 (max). De student trekt uit deze waarneming goede besluiten: De correlatie tussen de data zou hier dus maximaal zijn als lambda 0 is.
De waarden op de X-as varieren tussen de -2 en de 2. Op de Y-as staat de correlatie. hoe kleiner de correlatie, des te minder wijziging in de getransponeerde scatterplot. ook in het voorbeeld van deze studente is de correlatie zeer klein dus de wijziging in de getransponeerde scatterplot is ook zeer klein.
2008-11-19 16:56:14 [Steven Vercammen] [reply
Deze vraag werd goed beantwoord.In het e-hanboek vinden we dat het doel van de Box-cox transformatie is om de X variabele te transformeren zodat de correlatie met de Y variabele maximaal wordt. “Transformations can often significantly improve a fit. The Box-Cox linearity plot provides a convenient way to find a suitable transformation without engaging in a lot of trial and error fitting.” De formule die wordt toegepast is T(X) = (X^lambda -1) / lambda. Waarbij X de variabele is die getransformeerd wordt en lambda de transformatieparameter. Als lambda echter 0 is dan wordt ipv deze formule de natuurlijke logaritme van data gebruikt. De box-coxlinearity plot geeft aan welke waarde van lambda nodig is opdat de transformatie een optimaal effect heeft. Men moet echter ook kijken naar het verschil in correlatie voor en na transformatie. Dit kunnen we nagaan door de scatterplots voor en na transformatie te vergelijken.

Post a new message
Dataseries X:
104,8
105,6
118,3
89,9
90,2
107
64,5
92,6
95,8
94,3
91,2
86,3
77,6
82,5
97,7
83,3
84,2
92,8
77,4
72,5
88,8
93,4
92,6
90,7
81,6
84,1
88,1
85,3
82,9
84,8
71,2
68,9
94,3
97,6
85,6
91,9
75,8
79,8
99
88,5
86,7
97,9
94,3
72,9
91,8
93,2
86,5
98,9
77,2
79,4
90,4
81,4
85,8
103,6
73,6
75,7
99,2
88,7
94,6
98,7
84,2
87,7
103,3
88,2
93,4
106,3
73,1
78,6
101,6
101,4
98,5
99
89,5
83,5
97,4
87,8
90,4
101,6
80
81,7
96,4
110,2
101,1
89,3
Dataseries Y:
106,7
110,2
125,9
100,1
106,4
114,8
81,3
87
104,2
108
105
94,5
92
95,9
108,8
103,4
102,1
110,1
83,2
82,7
106,8
113,7
102,5
96,6
92,1
95,6
102,3
98,6
98,2
104,5
84
73,8
103,9
106
97,2
102,6
89
93,8
116,7
106,8
98,5
118,7
90
91,9
113,3
113,1
104,1
108,7
96,7
101
116,9
105,8
99
129,4
83
88,9
115,9
104,2
113,4
112,2
100,8
107,3
126,6
102,9
117,9
128,8
87,5
93,8
122,7
126,2
124,6
116,7
115,2
111,1
129,9
113,3
118,5
137,9
103,6
101,7
127,4
137,5
128,3
118,2




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 5 seconds \tabularnewline
R Server & 'Gwilym Jenkins' @ 72.249.127.135 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=24014&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]5 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gwilym Jenkins' @ 72.249.127.135[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=24014&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=24014&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135







Box-Cox Linearity Plot
# observations x84
maximum correlation0.824708891261322
optimal lambda(x)0
Residual SD (orginial)7.71384115121662
Residual SD (transformed)7.6604466545498

\begin{tabular}{lllllllll}
\hline
Box-Cox Linearity Plot \tabularnewline
# observations x & 84 \tabularnewline
maximum correlation & 0.824708891261322 \tabularnewline
optimal lambda(x) & 0 \tabularnewline
Residual SD (orginial) & 7.71384115121662 \tabularnewline
Residual SD (transformed) & 7.6604466545498 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=24014&T=1

[TABLE]
[ROW][C]Box-Cox Linearity Plot[/C][/ROW]
[ROW][C]# observations x[/C][C]84[/C][/ROW]
[ROW][C]maximum correlation[/C][C]0.824708891261322[/C][/ROW]
[ROW][C]optimal lambda(x)[/C][C]0[/C][/ROW]
[ROW][C]Residual SD (orginial)[/C][C]7.71384115121662[/C][/ROW]
[ROW][C]Residual SD (transformed)[/C][C]7.6604466545498[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=24014&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=24014&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Box-Cox Linearity Plot
# observations x84
maximum correlation0.824708891261322
optimal lambda(x)0
Residual SD (orginial)7.71384115121662
Residual SD (transformed)7.6604466545498



Parameters (Session):
Parameters (R input):
R code (references can be found in the software module):
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')