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 computationFri, 17 Dec 2010 13:58:41 +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/17/t1292594194xe6liqdtl2ak4iu.htm/, Retrieved Fri, 29 Mar 2024 12:05:12 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=111470, Retrieved Fri, 29 Mar 2024 12:05:12 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact153
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Multiple Regression] [Sleep in Mammals ...] [2010-03-18 19:12:28] [b98453cac15ba1066b407e146608df68]
- RMPD  [Recursive Partitioning (Regression Trees)] [Review of Sleep A...] [2010-05-01 12:21:49] [b98453cac15ba1066b407e146608df68]
- RMP       [Recursive Partitioning (Regression Trees)] [] [2010-12-17 13:58:41] [39ab8462d2190635c809d7a35eacc961] [Current]
Feedback Forum

Post a new message
Dataseries X:
6.3	0.65321251377534	0	0.81954393554187	1.6232492903979	3	1	3
2.1	1.83884909073726	3.40602894496362	3.66304097489397	2.79518458968242	3	5	4
9.1	1.43136376415899	1.02325245963371	2.25406445291434	2.25527250510331	4	4	4
15.8	1.27875360095283	-1.69897000433602	-0.52287874528034	1.54406804435028	1	1	1
5.2	1.48287358360875	2.20411998265592	2.22788670461367	2.59328606702046	4	5	4
10.9	1.44715803134222	0.51851393987789	1.40823996531185	1.79934054945358	1	2	1
8.3	1.69897000433602	1.71733758272386	2.64345267648619	2.36172783601759	1	1	1
11	0.84509804001426	-0.36653154442041	0.80617997398389	2.04921802267018	5	4	4
3.2	1.47712125471966	2.66745295288995	2.62634036737504	2.44870631990508	5	5	5
6.3	0.54406804435028	-1.09691001300806	0.079181246047625	1.6232492903979	1	1	1
6.6	0.77815125038364	-0.10237290870956	0.54406804435028	1.6232492903979	2	2	2
9.5	1.01703333929878	-0.69897000433602	0.69897000433602	2.07918124604762	2	2	2
3.3	1.30102999566398	1.44185217577329	2.06069784035361	2.17026171539496	5	5	5
11	0.5910646070265	-0.92081875395238	0	1.20411998265592	3	1	2
4.7	1.61278385671974	1.92941892571429	2.51188336097887	2.49136169383427	1	3	1
10.4	0.95424250943932	-1	0.60205999132796	1.44715803134222	5	1	3
7.4	0.88081359228079	0.01703333929878	0.74036268949424	1.83250891270624	5	3	4
2.1	1.66275783168157	2.71683772329952	2.81624129999178	2.52633927738984	5	5	5
17.9	1.38021124171161	-2	-0.60205999132796	1.69897000433602	1	1	1
6.1	2	1.79239168949825	3.12057393120585	2.42651126136458	1	1	1
11.9	0.50514997831991	-1.69897000433602	-0.39794000867204	1.27875360095283	4	1	3
13.8	0.69897000433602	0.23044892137827	0.79934054945358	1.07918124604762	2	1	1
14.3	0.81291335664286	0.54406804435028	1.03342375548695	2.07918124604762	2	1	1
15.2	1.07918124604762	-0.31875876262441	1.19033169817029	2.14612803567824	2	2	2
10	1.30535136944662	1	2.06069784035361	2.23044892137827	4	4	4
11.9	1.11394335230684	0.20951501454263	1.05690485133647	1.23044892137827	2	1	2
6.5	1.43136376415899	2.28330122870355	2.25527250510331	2.06069784035361	4	4	4
7.5	1.25527250510331	0.39794000867204	1.08278537031645	1.49136169383427	5	5	5
10.6	0.67209785793572	-0.55284196865778	0.27875360095283	1.32221929473392	3	1	3
7.4	0.99122607569249	0.62736585659273	1.70243053644553	1.7160033436348	1	1	1
8.4	1.46239799789896	0.83250891270624	2.25285303097989	2.2148438480477	2	3	2
5.7	0.84509804001426	-0.1249387366083	1.0899051114394	2.35218251811136	2	2	2
4.9	0.77815125038364	0.55630250076729	1.32221929473392	2.35218251811136	3	2	3
3.2	1.30102999566398	1.74429298312268	2.24303804868629	2.17897694729317	5	5	5
11	0.65321251377534	-0.045757490560675	0.41497334797082	1.77815125038364	2	1	2
4.9	0.8750612633917	0.30102999566398	1.0899051114394	2.30102999566398	3	1	3
13.2	0.36172783601759	-1	0.39794000867204	1.66275783168157	3	2	2
9.7	1.38021124171161	0.6222140229663	1.76342799356294	2.32221929473392	4	3	4
12.8	0.47712125471966	0.54406804435028	0.5910646070265	1.14612803567824	2	1	1




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 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 & 2 seconds \tabularnewline
R Server & 'Gwilym Jenkins' @ 72.249.127.135 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=111470&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]2 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=111470&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=111470&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 time2 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135







Model Performance
#Complexitysplitrelative errorCV errorCV S.D.
10.419011.0760.209
20.07310.5810.8670.18
30.0120.5080.8290.164

\begin{tabular}{lllllllll}
\hline
Model Performance \tabularnewline
# & Complexity & split & relative error & CV error & CV S.D. \tabularnewline
1 & 0.419 & 0 & 1 & 1.076 & 0.209 \tabularnewline
2 & 0.073 & 1 & 0.581 & 0.867 & 0.18 \tabularnewline
3 & 0.01 & 2 & 0.508 & 0.829 & 0.164 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=111470&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.419[/C][C]0[/C][C]1[/C][C]1.076[/C][C]0.209[/C][/ROW]
[ROW][C]2[/C][C]0.073[/C][C]1[/C][C]0.581[/C][C]0.867[/C][C]0.18[/C][/ROW]
[ROW][C]3[/C][C]0.01[/C][C]2[/C][C]0.508[/C][C]0.829[/C][C]0.164[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=111470&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=111470&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.419011.0760.209
20.07310.5810.8670.18
30.0120.5080.8290.164



Parameters (Session):
par1 = 1 ; par2 = No ;
Parameters (R input):
par1 = 1 ; 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')