Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_boxcoxlin.wasp
Title produced by softwareBox-Cox Linearity Plot
Date of computationTue, 11 Nov 2008 13:09:37 -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/11/t1226434229cinkfc0nsv8us5e.htm/, Retrieved Sun, 19 May 2024 12:12:24 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=23921, Retrieved Sun, 19 May 2024 12:12:24 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact112
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
F       [Box-Cox Linearity Plot] [Q3] [2008-11-11 20:09:37] [787873b6436f665b5b192a0bdb2e43c9] [Current]
Feedback Forum
2008-11-14 10:36:21 [Tamara Witters] [reply

Met deze formule kan je een tijdreeks transformeren en op die manier problemen oplossen. VB: De scatterplot doet denken dat er een lineair verband bestaat, maar eigenlijk is er geen verband.
Met deze formule probeert de PC alle transformaties voor de verschillende lambda-waarden en op die manier ervoor te zorgen dat de correlatie het grootst wordt.
We moeten afleiden uit onze grafiek waar het maximum bereikt word, want daar is de correlatie het grootst.
In dit geval zouden we kunnen stellen dat de correlatie het grootst is bij lambda 2 nl: 0,48. MAAR indien we de grenzen zouden vergroten kunnen we zien dat de grafiek nog even zou stijgen en dan pas zou dalen. En daar wordt pas het maximum bereikt. Bijgevo lg kunnen we geen besluit maken want het maximum is niet bereikt.
De twee volgende grafieken geven ook de correlatie weer. Indien de verschillende puntjes (observaties) gelijk zouden vallen op de rechte dan kunnen we spreken van een grote correlatie.
2008-11-23 20:06:08 [Isabel Wilms] [reply
Box-cox lineairity plot: we transformeren hier tijdreeksen. De bedoeling is om niet-lineaire tijdreeksen, lineair te maken. Dit doen we door de r-code aan te passen. Hier wordt een nieuwe variabele gemaakt, de originele x-waarde wordt vervangen door een bewerking van deze waarde (nl. ((x tot de macht lambda)-1) op lambda). Nadien zal je een lambdawaarde moeten gaan kiezen, maar welke? diegene met de hoogste correlatie, die ga je gebruiken om verband lineair te maken. ( deze waarde kan je ook aflezen in de grafiek, dit is het max. dus waar de getransformeerde x-waarden en de originele y-waarden, de hoogste correlatie hebben). Hier is de correlatie max bij lambdawaarde 2, indien we hiervan zeker willen zijn, moeten we de grenzen van de lambdawaarden rechts verlengen zodat we zien dat dit echt het max is. Als dit zo is wordt 2 gebruikt om de tijdreeks lineair te maken.

Post a new message
Dataseries X:
0,95
0,98
1,23
1,17
0,84
0,74
0,65
0,91
1,19
1,30
1,53
1,94
1,79
1,95
2,26
2,04
2,16
2,75
2,79
2,88
3,36
2,97
3,10
2,49
2,20
2,25
2,09
2,79
3,14
2,93
2,65
2,67
2,26
2,35
2,13
2,18
2,90
2,63
2,67
1,81
1,33
0,88
1,28
1,26
1,26
1,29
1,10
1,37
1.21
1.74
1.76
1.48
1.04
1.62
1.49
1.79
1.8
1.58
1.86
1.74
1.59
1.26
1.13
1.92
2.61
2.26
2.41
2.26
2.03
2.86
2.55
2.27
2.26
2.57
3.07
2.76
2.51
2.87
3.14
3.11
3.16
2.47
2.57
2.89
2.63
2.38
1.69
1.96
2.19
1.87
1.6
1.63
1.22
1.21
1.49
1.64
1.66
1.77
1.82
1.78
1.28
1.29
1.37
1.12
1.51
2.24
2.94
3.09
3,46
3,64
4,39
4,15
5,21
5,80
5,91
Dataseries Y:
13.92
13.22
13.31
12.91
13.19
12.92
13.43
13.72
13.97
14.91
14.46
14.12
14.23
15.04
14.80
14.49
15.14
14.34
15.12
15.14
14.34
14.36
14.91
15.56
16.50
15.57
15.14
15.19
15.07
14.48
14.27
14.72
14.65
14.38
13.95
14.85
14.87
14.83
15.03
15.47
16.21
16.55
17.04
17.22
17.47
17.75
17.84
18.47
18.38
18.55
18.39
18.88
20.21
19.67
20.09
18.78
19.74
20.64
20.34
21.75
22.10
22.81
22.91
22.46
21.78
25.05
23.70
23.02
24.34
24.15
25.85
26.42
26.54
26.36
26.99
27.52
26.63
26.26
24.86
26.84
26.57
24.67
27.24
27.77
27.61
27.27
28.46
26.97
29.95
29.88
29.67
31.19
30.24
30.03
31.02
30.45
31.70
32.10
32.32
32.18
33.43
33.07
35.32
35.17
35.29
37.89
38.32
37.07
39.77
39.20
40.46
44.95
41.69
41.88
45.86




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24

\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 & 3 seconds \tabularnewline
R Server & 'Sir Ronald Aylmer Fisher' @ 193.190.124.24 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=23921&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]3 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Sir Ronald Aylmer Fisher' @ 193.190.124.24[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=23921&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=23921&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 time3 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24







Box-Cox Linearity Plot
# observations x115
maximum correlation0.484554133653491
optimal lambda(x)2
Residual SD (orginial)7.62257338433834
Residual SD (transformed)7.42635528844932

\begin{tabular}{lllllllll}
\hline
Box-Cox Linearity Plot \tabularnewline
# observations x & 115 \tabularnewline
maximum correlation & 0.484554133653491 \tabularnewline
optimal lambda(x) & 2 \tabularnewline
Residual SD (orginial) & 7.62257338433834 \tabularnewline
Residual SD (transformed) & 7.42635528844932 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=23921&T=1

[TABLE]
[ROW][C]Box-Cox Linearity Plot[/C][/ROW]
[ROW][C]# observations x[/C][C]115[/C][/ROW]
[ROW][C]maximum correlation[/C][C]0.484554133653491[/C][/ROW]
[ROW][C]optimal lambda(x)[/C][C]2[/C][/ROW]
[ROW][C]Residual SD (orginial)[/C][C]7.62257338433834[/C][/ROW]
[ROW][C]Residual SD (transformed)[/C][C]7.42635528844932[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=23921&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=23921&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 x115
maximum correlation0.484554133653491
optimal lambda(x)2
Residual SD (orginial)7.62257338433834
Residual SD (transformed)7.42635528844932



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')