Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_regression_trees.wasp
Title produced by softwareRecursive Partitioning (Regression Trees)
Date of computationTue, 21 Dec 2010 20:20:29 +0000
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2010/Dec/21/t1292962715za5jd7t800ejw7q.htm/, Retrieved Sun, 19 May 2024 18:46:14 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=113937, Retrieved Sun, 19 May 2024 18:46:14 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact105
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Multiple Regression] [workshop 7] [2010-12-21 20:06:07] [efd13e24149aec704f3383e33c1e842a]
- RMP     [Recursive Partitioning (Regression Trees)] [workshop 7] [2010-12-21 20:20:29] [531024149246456e4f6d79ace2e85c12] [Current]
Feedback Forum

Post a new message
Dataseries X:
5	6	5	7	11	2
2	6	2	3	11	1
6	6	6	5	15	1
6	4	4	5	9	2
6	2	6	3	11	1
5	7	3	4	17	1
5	6	5	4	16	1
6	5	3	5	9	1
6	6	5	5	14	1
5	7	4	5	12	1
5	7	1	6	6	2
5	4	6	5	4	1
6	1	6	2	13	1
5	6	6	5	12	1
5	4	4	4	10	1
6	5	6	6	14	2
6	5	5	5	12	1
4	6	3	6	9	1
5	4	5	5	16	2
5	6	4	2	13	2
5	3	5	3	12	1
6	3	6	5	11	1
5	5	3	6	12	2
7	5	4	5	12	2
6	5	5	4	11	1
6	5	4	5	16	2
6	5	5	5	9	1
6	2	6	5	8	2
4	6	7	5	11	1
5	7	2	6	9	2
6	2	4	6	16	2
4	3	6	6	14	1
5	6	5	6	10	2
5	5	5	4	14	1
5	7	5	4	13	2
7	5	6	3	12	1
7	6	6	5	16	2
6	5	1	6	16	1
7	3	4	4	15	1
6	7	2	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1
6	2	6	5	14	1
5	6	4	4	13	1
5	2	7	2	8	1
2	6	3	6	13	1
5	6	4	5	10	1
3	2	2	4	9	2
6	5	4	5	8	2
5	6	4	5	15	2
5	5	3	5	15	1
5	3	2	5	12	1
2	7	5	6	8	2
5	5	5	2	15	1
5	4	4	4	9	1
6	5	6	7	14	2
6	3	5	3	16	1
5	2	1	2	14	1
5	5	5	5	14	2
5	5	5	3	14	1
6	2	5	5	14	1
6	3	5	6	14	2
6	2	5	3	13	2
6	6	4	5	12	1
6	6	7	5	13	2
7	2	5	3	19	1
5	2	4	5	9	2




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 seconds
R Server'RServer@AstonUniversity' @ vre.aston.ac.uk

\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 & 4 seconds \tabularnewline
R Server & 'RServer@AstonUniversity' @ vre.aston.ac.uk \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=113937&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]4 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'RServer@AstonUniversity' @ vre.aston.ac.uk[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=113937&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=113937&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 time4 seconds
R Server'RServer@AstonUniversity' @ vre.aston.ac.uk







Model Performance
#Complexitysplitrelative errorCV errorCV S.D.
10.06011.0130.111
20.0510.941.1170.12
30.04720.8891.0810.124
40.03130.8431.0490.118
50.02140.8121.0130.113
60.01950.7911.030.115
70.01760.7721.0530.116
80.01270.7551.0680.118
90.01290.731.0760.119
100.011100.7181.0760.119
110.01110.7081.0710.116

\begin{tabular}{lllllllll}
\hline
Model Performance \tabularnewline
# & Complexity & split & relative error & CV error & CV S.D. \tabularnewline
1 & 0.06 & 0 & 1 & 1.013 & 0.111 \tabularnewline
2 & 0.05 & 1 & 0.94 & 1.117 & 0.12 \tabularnewline
3 & 0.047 & 2 & 0.889 & 1.081 & 0.124 \tabularnewline
4 & 0.031 & 3 & 0.843 & 1.049 & 0.118 \tabularnewline
5 & 0.021 & 4 & 0.812 & 1.013 & 0.113 \tabularnewline
6 & 0.019 & 5 & 0.791 & 1.03 & 0.115 \tabularnewline
7 & 0.017 & 6 & 0.772 & 1.053 & 0.116 \tabularnewline
8 & 0.012 & 7 & 0.755 & 1.068 & 0.118 \tabularnewline
9 & 0.012 & 9 & 0.73 & 1.076 & 0.119 \tabularnewline
10 & 0.011 & 10 & 0.718 & 1.076 & 0.119 \tabularnewline
11 & 0.01 & 11 & 0.708 & 1.071 & 0.116 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=113937&T=1

[TABLE]
[ROW][C]Model Performance[/C][/ROW]
[ROW][C]#[/C][C]Complexity[/C][C]split[/C][C]relative error[/C][C]CV error[/C][C]CV S.D.[/C][/ROW]
[ROW][C]1[/C][C]0.06[/C][C]0[/C][C]1[/C][C]1.013[/C][C]0.111[/C][/ROW]
[ROW][C]2[/C][C]0.05[/C][C]1[/C][C]0.94[/C][C]1.117[/C][C]0.12[/C][/ROW]
[ROW][C]3[/C][C]0.047[/C][C]2[/C][C]0.889[/C][C]1.081[/C][C]0.124[/C][/ROW]
[ROW][C]4[/C][C]0.031[/C][C]3[/C][C]0.843[/C][C]1.049[/C][C]0.118[/C][/ROW]
[ROW][C]5[/C][C]0.021[/C][C]4[/C][C]0.812[/C][C]1.013[/C][C]0.113[/C][/ROW]
[ROW][C]6[/C][C]0.019[/C][C]5[/C][C]0.791[/C][C]1.03[/C][C]0.115[/C][/ROW]
[ROW][C]7[/C][C]0.017[/C][C]6[/C][C]0.772[/C][C]1.053[/C][C]0.116[/C][/ROW]
[ROW][C]8[/C][C]0.012[/C][C]7[/C][C]0.755[/C][C]1.068[/C][C]0.118[/C][/ROW]
[ROW][C]9[/C][C]0.012[/C][C]9[/C][C]0.73[/C][C]1.076[/C][C]0.119[/C][/ROW]
[ROW][C]10[/C][C]0.011[/C][C]10[/C][C]0.718[/C][C]1.076[/C][C]0.119[/C][/ROW]
[ROW][C]11[/C][C]0.01[/C][C]11[/C][C]0.708[/C][C]1.071[/C][C]0.116[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=113937&T=1

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

As an alternative you can also use a QR Code:  

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

Model Performance
#Complexitysplitrelative errorCV errorCV S.D.
10.06011.0130.111
20.0510.941.1170.12
30.04720.8891.0810.124
40.03130.8431.0490.118
50.02140.8121.0130.113
60.01950.7911.030.115
70.01760.7721.0530.116
80.01270.7551.0680.118
90.01290.731.0760.119
100.011100.7181.0760.119
110.01110.7081.0710.116



Parameters (Session):
par1 = 5 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ; par4 = no ;
Parameters (R input):
par1 = 5 ; par2 = No ;
R code (references can be found in the software module):
library(rpart)
library(partykit)
par1 <- as.numeric(par1)
autoprune <- function ( tree, method='Minimum CV'){
xerr <- tree$cptable[,'xerror']
cpmin.id <- which.min(xerr)
if (method == 'Minimum CV Error plus 1 SD'){
xstd <- tree$cptable[,'xstd']
errt <- xerr[cpmin.id] + xstd[cpmin.id]
cpSE1.min <- which.min( errt < xerr )
mycp <- (tree$cptable[,'CP'])[cpSE1.min]
}
if (method == 'Minimum CV') {
mycp <- (tree$cptable[,'CP'])[cpmin.id]
}
return (mycp)
}
conf.multi.mat <- function(true, new)
{
if ( all( is.na(match( levels(true),levels(new) ) )) )
stop ( 'conflict of vector levels')
multi.t <- list()
for (mylev in levels(true) ) {
true.tmp <- true
new.tmp <- new
left.lev <- levels (true.tmp)[- match(mylev,levels(true) ) ]
levels(true.tmp) <- list ( mylev = mylev, all = left.lev )
levels(new.tmp) <- list ( mylev = mylev, all = left.lev )
curr.t <- conf.mat ( true.tmp , new.tmp )
multi.t[[mylev]] <- curr.t
multi.t[[mylev]]$precision <-
round( curr.t$conf[1,1] / sum( curr.t$conf[1,] ), 2 )
}
return (multi.t)
}
x <- t(y)
k <- length(x[1,])
n <- length(x[,1])
x1 <- cbind(x[,par1], x[,1:k!=par1])
mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
colnames(x1) <- mycolnames #colnames(x)[par1]
m <- rpart(as.data.frame(x1))
par2
if (par2 != 'No') {
mincp <- autoprune(m,method=par2)
print(mincp)
m <- prune(m,cp=mincp)
}
m$cptable
bitmap(file='test1.png')
plot(as.party(m),tp_args=list(id=FALSE))
dev.off()
bitmap(file='test2.png')
plotcp(m)
dev.off()
cbind(y=m$y,pred=predict(m),res=residuals(m))
myr <- residuals(m)
myp <- predict(m)
bitmap(file='test4.png')
op <- par(mfrow=c(2,2))
plot(myr,ylab='residuals')
plot(density(myr),main='Residual Kernel Density')
plot(myp,myr,xlab='predicted',ylab='residuals',main='Predicted vs Residuals')
plot(density(myp),main='Prediction Kernel Density')
par(op)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Model Performance',6,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'#',header=TRUE)
a<-table.element(a,'Complexity',header=TRUE)
a<-table.element(a,'split',header=TRUE)
a<-table.element(a,'relative error',header=TRUE)
a<-table.element(a,'CV error',header=TRUE)
a<-table.element(a,'CV S.D.',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(m$cptable[,1])) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,round(m$cptable[i,'CP'],3))
a<-table.element(a,m$cptable[i,'nsplit'])
a<-table.element(a,round(m$cptable[i,'rel error'],3))
a<-table.element(a,round(m$cptable[i,'xerror'],3))
a<-table.element(a,round(m$cptable[i,'xstd'],3))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')