Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_regression_trees1.wasp
Title produced by softwareRecursive Partitioning (Regression Trees)
Date of computationMon, 20 Dec 2010 13:10:46 +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/20/t12928509823b8h9ksz7so329b.htm/, Retrieved Thu, 25 Apr 2024 06:34:00 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=112916, Retrieved Thu, 25 Apr 2024 06:34:00 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact178
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]
- RMP   [Recursive Partitioning (Regression Trees)] [Review of Sleep A...] [2010-05-01 12:04:20] [b98453cac15ba1066b407e146608df68]
- RMP     [Recursive Partitioning (Regression Trees)] [] [2010-12-17 13:55:13] [94f495cfd7e7946e5228cbd267a6841d]
- RMPD        [Recursive Partitioning (Regression Trees)] [bonustaak, regres...] [2010-12-20 13:10:46] [39ab8462d2190635c809d7a35eacc961] [Current]
Feedback Forum

Post a new message
Dataseries X:
0.301029996	3	1.62324929
0.255272505	4	2.79518459
-0.15490196	4	2.255272505
0.591064607	1	1.544068044
0	4	2.593286067
0.556302501	1	1.799340549
0.146128036	1	2.361727836
0.176091259	4	2.049218023
-0.15490196	5	2.44870632
0.322219295	1	1.62324929
0.612783857	2	1.62324929
0.079181246	2	2.079181246
-0.301029996	5	2.170261715
0.531478917	2	1.204119983
0.176091259	1	2.491361694
0.531478917	3	1.447158031
-0.096910013	4	1.832508913
-0.096910013	5	2.526339277
0.301029996	1	1.698970004
0.278753601	1	2.426511261
0.113943352	3	1.278753601
0.748188027	1	1.079181246
0.491361694	1	2.079181246
0.255272505	2	2.146128036
-0.045757491	4	2.230448921
0.255272505	4	1.230448921
0.278753601	5	2.06069784
-0.045757491	3	1.491361694
0.414973348	1	1.322219295
0.380211242	2	1.716003344
0.079181246	2	2.214843848
-0.045757491	3	2.352182518
-0.301029996	5	2.352182518
-0.22184875	2	2.178976947
0.361727836	3	1.77815125
-0.301029996	2	2.301029996
0.414973348	4	1.662757832
-0.22184875	1	2.322219295
0.819543936	2	1.146128036




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135
R Framework error message
The field 'Names of X columns' contains a hard return which cannot be interpreted.
Please, resubmit your request without hard returns in the 'Names of X columns'.

\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 & 'Gwilym Jenkins' @ 72.249.127.135 \tabularnewline
R Framework error message & 
The field 'Names of X columns' contains a hard return which cannot be interpreted.
Please, resubmit your request without hard returns in the 'Names of X columns'.
\tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=112916&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]'Gwilym Jenkins' @ 72.249.127.135[/C][/ROW]
[ROW][C]R Framework error message[/C][C]
The field 'Names of X columns' contains a hard return which cannot be interpreted.
Please, resubmit your request without hard returns in the 'Names of X columns'.
[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=112916&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=112916&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'Gwilym Jenkins' @ 72.249.127.135
R Framework error message
The field 'Names of X columns' contains a hard return which cannot be interpreted.
Please, resubmit your request without hard returns in the 'Names of X columns'.







Goodness of Fit
Correlation0.7632
R-squared0.5824
RMSE0.192

\begin{tabular}{lllllllll}
\hline
Goodness of Fit \tabularnewline
Correlation & 0.7632 \tabularnewline
R-squared & 0.5824 \tabularnewline
RMSE & 0.192 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=112916&T=1

[TABLE]
[ROW][C]Goodness of Fit[/C][/ROW]
[ROW][C]Correlation[/C][C]0.7632[/C][/ROW]
[ROW][C]R-squared[/C][C]0.5824[/C][/ROW]
[ROW][C]RMSE[/C][C]0.192[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=112916&T=1

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

As an alternative you can also use a QR Code:  

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

Goodness of Fit
Correlation0.7632
R-squared0.5824
RMSE0.192







Actuals, Predictions, and Residuals
#ActualsForecastsResiduals
10.3010299960.2290603310.071969665
20.255272505-0.056849359750.31212186475
3-0.15490196-0.05684935975-0.09805260025
40.5910646070.4695085516153850.121556055384615
50-0.056849359750.05684935975
60.5563025010.4695085516153850.0867939493846154
70.146128036-0.056849359750.20297739575
80.1760912590.229060331-0.052969072
9-0.15490196-0.05684935975-0.09805260025
100.3222192950.469508551615385-0.147289256615385
110.6127838570.4695085516153850.143275305384615
120.0791812460.469508551615385-0.390327305615385
13-0.301029996-0.05684935975-0.24418063625
140.5314789170.4695085516153850.0619703653846154
150.176091259-0.056849359750.23294061875
160.5314789170.2290603310.302418586
17-0.0969100130.229060331-0.325970344
18-0.096910013-0.05684935975-0.04006065325
190.3010299960.469508551615385-0.168478555615385
200.278753601-0.056849359750.33560296075
210.1139433520.229060331-0.115116979
220.7481880270.4695085516153850.278679475384615
230.4913616940.4695085516153850.0218531423846154
240.2552725050.469508551615385-0.214236046615385
25-0.045757491-0.056849359750.01109186875
260.2552725050.2290603310.026212174
270.2787536010.2290603310.04969327
28-0.0457574910.229060331-0.274817822
290.4149733480.469508551615385-0.0545352036153846
300.3802112420.469508551615385-0.0892973096153846
310.079181246-0.056849359750.13603060575
32-0.045757491-0.056849359750.01109186875
33-0.301029996-0.05684935975-0.24418063625
34-0.22184875-0.05684935975-0.16499939025
350.3617278360.2290603310.132667505
36-0.301029996-0.05684935975-0.24418063625
370.4149733480.2290603310.185913017
38-0.22184875-0.05684935975-0.16499939025
390.8195439360.4695085516153850.350035384384615

\begin{tabular}{lllllllll}
\hline
Actuals, Predictions, and Residuals \tabularnewline
# & Actuals & Forecasts & Residuals \tabularnewline
1 & 0.301029996 & 0.229060331 & 0.071969665 \tabularnewline
2 & 0.255272505 & -0.05684935975 & 0.31212186475 \tabularnewline
3 & -0.15490196 & -0.05684935975 & -0.09805260025 \tabularnewline
4 & 0.591064607 & 0.469508551615385 & 0.121556055384615 \tabularnewline
5 & 0 & -0.05684935975 & 0.05684935975 \tabularnewline
6 & 0.556302501 & 0.469508551615385 & 0.0867939493846154 \tabularnewline
7 & 0.146128036 & -0.05684935975 & 0.20297739575 \tabularnewline
8 & 0.176091259 & 0.229060331 & -0.052969072 \tabularnewline
9 & -0.15490196 & -0.05684935975 & -0.09805260025 \tabularnewline
10 & 0.322219295 & 0.469508551615385 & -0.147289256615385 \tabularnewline
11 & 0.612783857 & 0.469508551615385 & 0.143275305384615 \tabularnewline
12 & 0.079181246 & 0.469508551615385 & -0.390327305615385 \tabularnewline
13 & -0.301029996 & -0.05684935975 & -0.24418063625 \tabularnewline
14 & 0.531478917 & 0.469508551615385 & 0.0619703653846154 \tabularnewline
15 & 0.176091259 & -0.05684935975 & 0.23294061875 \tabularnewline
16 & 0.531478917 & 0.229060331 & 0.302418586 \tabularnewline
17 & -0.096910013 & 0.229060331 & -0.325970344 \tabularnewline
18 & -0.096910013 & -0.05684935975 & -0.04006065325 \tabularnewline
19 & 0.301029996 & 0.469508551615385 & -0.168478555615385 \tabularnewline
20 & 0.278753601 & -0.05684935975 & 0.33560296075 \tabularnewline
21 & 0.113943352 & 0.229060331 & -0.115116979 \tabularnewline
22 & 0.748188027 & 0.469508551615385 & 0.278679475384615 \tabularnewline
23 & 0.491361694 & 0.469508551615385 & 0.0218531423846154 \tabularnewline
24 & 0.255272505 & 0.469508551615385 & -0.214236046615385 \tabularnewline
25 & -0.045757491 & -0.05684935975 & 0.01109186875 \tabularnewline
26 & 0.255272505 & 0.229060331 & 0.026212174 \tabularnewline
27 & 0.278753601 & 0.229060331 & 0.04969327 \tabularnewline
28 & -0.045757491 & 0.229060331 & -0.274817822 \tabularnewline
29 & 0.414973348 & 0.469508551615385 & -0.0545352036153846 \tabularnewline
30 & 0.380211242 & 0.469508551615385 & -0.0892973096153846 \tabularnewline
31 & 0.079181246 & -0.05684935975 & 0.13603060575 \tabularnewline
32 & -0.045757491 & -0.05684935975 & 0.01109186875 \tabularnewline
33 & -0.301029996 & -0.05684935975 & -0.24418063625 \tabularnewline
34 & -0.22184875 & -0.05684935975 & -0.16499939025 \tabularnewline
35 & 0.361727836 & 0.229060331 & 0.132667505 \tabularnewline
36 & -0.301029996 & -0.05684935975 & -0.24418063625 \tabularnewline
37 & 0.414973348 & 0.229060331 & 0.185913017 \tabularnewline
38 & -0.22184875 & -0.05684935975 & -0.16499939025 \tabularnewline
39 & 0.819543936 & 0.469508551615385 & 0.350035384384615 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=112916&T=2

[TABLE]
[ROW][C]Actuals, Predictions, and Residuals[/C][/ROW]
[ROW][C]#[/C][C]Actuals[/C][C]Forecasts[/C][C]Residuals[/C][/ROW]
[ROW][C]1[/C][C]0.301029996[/C][C]0.229060331[/C][C]0.071969665[/C][/ROW]
[ROW][C]2[/C][C]0.255272505[/C][C]-0.05684935975[/C][C]0.31212186475[/C][/ROW]
[ROW][C]3[/C][C]-0.15490196[/C][C]-0.05684935975[/C][C]-0.09805260025[/C][/ROW]
[ROW][C]4[/C][C]0.591064607[/C][C]0.469508551615385[/C][C]0.121556055384615[/C][/ROW]
[ROW][C]5[/C][C]0[/C][C]-0.05684935975[/C][C]0.05684935975[/C][/ROW]
[ROW][C]6[/C][C]0.556302501[/C][C]0.469508551615385[/C][C]0.0867939493846154[/C][/ROW]
[ROW][C]7[/C][C]0.146128036[/C][C]-0.05684935975[/C][C]0.20297739575[/C][/ROW]
[ROW][C]8[/C][C]0.176091259[/C][C]0.229060331[/C][C]-0.052969072[/C][/ROW]
[ROW][C]9[/C][C]-0.15490196[/C][C]-0.05684935975[/C][C]-0.09805260025[/C][/ROW]
[ROW][C]10[/C][C]0.322219295[/C][C]0.469508551615385[/C][C]-0.147289256615385[/C][/ROW]
[ROW][C]11[/C][C]0.612783857[/C][C]0.469508551615385[/C][C]0.143275305384615[/C][/ROW]
[ROW][C]12[/C][C]0.079181246[/C][C]0.469508551615385[/C][C]-0.390327305615385[/C][/ROW]
[ROW][C]13[/C][C]-0.301029996[/C][C]-0.05684935975[/C][C]-0.24418063625[/C][/ROW]
[ROW][C]14[/C][C]0.531478917[/C][C]0.469508551615385[/C][C]0.0619703653846154[/C][/ROW]
[ROW][C]15[/C][C]0.176091259[/C][C]-0.05684935975[/C][C]0.23294061875[/C][/ROW]
[ROW][C]16[/C][C]0.531478917[/C][C]0.229060331[/C][C]0.302418586[/C][/ROW]
[ROW][C]17[/C][C]-0.096910013[/C][C]0.229060331[/C][C]-0.325970344[/C][/ROW]
[ROW][C]18[/C][C]-0.096910013[/C][C]-0.05684935975[/C][C]-0.04006065325[/C][/ROW]
[ROW][C]19[/C][C]0.301029996[/C][C]0.469508551615385[/C][C]-0.168478555615385[/C][/ROW]
[ROW][C]20[/C][C]0.278753601[/C][C]-0.05684935975[/C][C]0.33560296075[/C][/ROW]
[ROW][C]21[/C][C]0.113943352[/C][C]0.229060331[/C][C]-0.115116979[/C][/ROW]
[ROW][C]22[/C][C]0.748188027[/C][C]0.469508551615385[/C][C]0.278679475384615[/C][/ROW]
[ROW][C]23[/C][C]0.491361694[/C][C]0.469508551615385[/C][C]0.0218531423846154[/C][/ROW]
[ROW][C]24[/C][C]0.255272505[/C][C]0.469508551615385[/C][C]-0.214236046615385[/C][/ROW]
[ROW][C]25[/C][C]-0.045757491[/C][C]-0.05684935975[/C][C]0.01109186875[/C][/ROW]
[ROW][C]26[/C][C]0.255272505[/C][C]0.229060331[/C][C]0.026212174[/C][/ROW]
[ROW][C]27[/C][C]0.278753601[/C][C]0.229060331[/C][C]0.04969327[/C][/ROW]
[ROW][C]28[/C][C]-0.045757491[/C][C]0.229060331[/C][C]-0.274817822[/C][/ROW]
[ROW][C]29[/C][C]0.414973348[/C][C]0.469508551615385[/C][C]-0.0545352036153846[/C][/ROW]
[ROW][C]30[/C][C]0.380211242[/C][C]0.469508551615385[/C][C]-0.0892973096153846[/C][/ROW]
[ROW][C]31[/C][C]0.079181246[/C][C]-0.05684935975[/C][C]0.13603060575[/C][/ROW]
[ROW][C]32[/C][C]-0.045757491[/C][C]-0.05684935975[/C][C]0.01109186875[/C][/ROW]
[ROW][C]33[/C][C]-0.301029996[/C][C]-0.05684935975[/C][C]-0.24418063625[/C][/ROW]
[ROW][C]34[/C][C]-0.22184875[/C][C]-0.05684935975[/C][C]-0.16499939025[/C][/ROW]
[ROW][C]35[/C][C]0.361727836[/C][C]0.229060331[/C][C]0.132667505[/C][/ROW]
[ROW][C]36[/C][C]-0.301029996[/C][C]-0.05684935975[/C][C]-0.24418063625[/C][/ROW]
[ROW][C]37[/C][C]0.414973348[/C][C]0.229060331[/C][C]0.185913017[/C][/ROW]
[ROW][C]38[/C][C]-0.22184875[/C][C]-0.05684935975[/C][C]-0.16499939025[/C][/ROW]
[ROW][C]39[/C][C]0.819543936[/C][C]0.469508551615385[/C][C]0.350035384384615[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=112916&T=2

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

As an alternative you can also use a QR Code:  

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

Actuals, Predictions, and Residuals
#ActualsForecastsResiduals
10.3010299960.2290603310.071969665
20.255272505-0.056849359750.31212186475
3-0.15490196-0.05684935975-0.09805260025
40.5910646070.4695085516153850.121556055384615
50-0.056849359750.05684935975
60.5563025010.4695085516153850.0867939493846154
70.146128036-0.056849359750.20297739575
80.1760912590.229060331-0.052969072
9-0.15490196-0.05684935975-0.09805260025
100.3222192950.469508551615385-0.147289256615385
110.6127838570.4695085516153850.143275305384615
120.0791812460.469508551615385-0.390327305615385
13-0.301029996-0.05684935975-0.24418063625
140.5314789170.4695085516153850.0619703653846154
150.176091259-0.056849359750.23294061875
160.5314789170.2290603310.302418586
17-0.0969100130.229060331-0.325970344
18-0.096910013-0.05684935975-0.04006065325
190.3010299960.469508551615385-0.168478555615385
200.278753601-0.056849359750.33560296075
210.1139433520.229060331-0.115116979
220.7481880270.4695085516153850.278679475384615
230.4913616940.4695085516153850.0218531423846154
240.2552725050.469508551615385-0.214236046615385
25-0.045757491-0.056849359750.01109186875
260.2552725050.2290603310.026212174
270.2787536010.2290603310.04969327
28-0.0457574910.229060331-0.274817822
290.4149733480.469508551615385-0.0545352036153846
300.3802112420.469508551615385-0.0892973096153846
310.079181246-0.056849359750.13603060575
32-0.045757491-0.056849359750.01109186875
33-0.301029996-0.05684935975-0.24418063625
34-0.22184875-0.05684935975-0.16499939025
350.3617278360.2290603310.132667505
36-0.301029996-0.05684935975-0.24418063625
370.4149733480.2290603310.185913017
38-0.22184875-0.05684935975-0.16499939025
390.8195439360.4695085516153850.350035384384615



Parameters (Session):
par1 = 1 ; par2 = none ; par4 = no ;
Parameters (R input):
par1 = 1 ; par2 = none ; par3 = ; par4 = no ;
R code (references can be found in the software module):
library(party)
library(Hmisc)
par1 <- as.numeric(par1)
par3 <- as.numeric(par3)
x <- data.frame(t(y))
is.data.frame(x)
x <- x[!is.na(x[,par1]),]
k <- length(x[1,])
n <- length(x[,1])
colnames(x)[par1]
x[,par1]
if (par2 == 'kmeans') {
cl <- kmeans(x[,par1], par3)
print(cl)
clm <- matrix(cbind(cl$centers,1:par3),ncol=2)
clm <- clm[sort.list(clm[,1]),]
for (i in 1:par3) {
cl$cluster[cl$cluster==clm[i,2]] <- paste('C',i,sep='')
}
cl$cluster <- as.factor(cl$cluster)
print(cl$cluster)
x[,par1] <- cl$cluster
}
if (par2 == 'quantiles') {
x[,par1] <- cut2(x[,par1],g=par3)
}
if (par2 == 'hclust') {
hc <- hclust(dist(x[,par1])^2, 'cen')
print(hc)
memb <- cutree(hc, k = par3)
dum <- c(mean(x[memb==1,par1]))
for (i in 2:par3) {
dum <- c(dum, mean(x[memb==i,par1]))
}
hcm <- matrix(cbind(dum,1:par3),ncol=2)
hcm <- hcm[sort.list(hcm[,1]),]
for (i in 1:par3) {
memb[memb==hcm[i,2]] <- paste('C',i,sep='')
}
memb <- as.factor(memb)
print(memb)
x[,par1] <- memb
}
if (par2=='equal') {
ed <- cut(as.numeric(x[,par1]),par3,labels=paste('C',1:par3,sep=''))
x[,par1] <- as.factor(ed)
}
table(x[,par1])
colnames(x)
colnames(x)[par1]
x[,par1]
if (par2 == 'none') {
m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x)
}
load(file='createtable')
if (par2 != 'none') {
m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x)
if (par4=='yes') {
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'',1,TRUE)
a<-table.element(a,'Prediction (training)',par3+1,TRUE)
a<-table.element(a,'Prediction (testing)',par3+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Actual',1,TRUE)
for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE)
a<-table.element(a,'CV',1,TRUE)
for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE)
a<-table.element(a,'CV',1,TRUE)
a<-table.row.end(a)
for (i in 1:10) {
ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1))
m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,])
if (i==1) {
m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,])
m.ct.i.actu <- x[ind==1,par1]
m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,])
m.ct.x.actu <- x[ind==2,par1]
} else {
m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,]))
m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1])
m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,]))
m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1])
}
}
print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred))
numer <- 0
for (i in 1:par3) {
print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,]))
numer <- numer + m.ct.i.tab[i,i]
}
print(m.ct.i.cp <- numer / sum(m.ct.i.tab))
print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred))
numer <- 0
for (i in 1:par3) {
print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,]))
numer <- numer + m.ct.x.tab[i,i]
}
print(m.ct.x.cp <- numer / sum(m.ct.x.tab))
for (i in 1:par3) {
a<-table.row.start(a)
a<-table.element(a,paste('C',i,sep=''),1,TRUE)
for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj])
a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4))
for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj])
a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4))
a<-table.row.end(a)
}
a<-table.row.start(a)
a<-table.element(a,'Overall',1,TRUE)
for (jjj in 1:par3) a<-table.element(a,'-')
a<-table.element(a,round(m.ct.i.cp,4))
for (jjj in 1:par3) a<-table.element(a,'-')
a<-table.element(a,round(m.ct.x.cp,4))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable3.tab')
}
}
m
bitmap(file='test1.png')
plot(m)
dev.off()
bitmap(file='test1a.png')
plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response')
dev.off()
if (par2 == 'none') {
forec <- predict(m)
result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec))
colnames(result) <- c('Actuals','Forecasts','Residuals')
print(result)
}
if (par2 != 'none') {
print(cbind(as.factor(x[,par1]),predict(m)))
myt <- table(as.factor(x[,par1]),predict(m))
print(myt)
}
bitmap(file='test2.png')
if(par2=='none') {
op <- par(mfrow=c(2,2))
plot(density(result$Actuals),main='Kernel Density Plot of Actuals')
plot(density(result$Residuals),main='Kernel Density Plot of Residuals')
plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals')
plot(density(result$Forecasts),main='Kernel Density Plot of Predictions')
par(op)
}
if(par2!='none') {
plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted')
}
dev.off()
if (par2 == 'none') {
detcoef <- cor(result$Forecasts,result$Actuals)
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Goodness of Fit',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Correlation',1,TRUE)
a<-table.element(a,round(detcoef,4))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'R-squared',1,TRUE)
a<-table.element(a,round(detcoef*detcoef,4))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'RMSE',1,TRUE)
a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'#',header=TRUE)
a<-table.element(a,'Actuals',header=TRUE)
a<-table.element(a,'Forecasts',header=TRUE)
a<-table.element(a,'Residuals',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(result$Actuals)) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,result$Actuals[i])
a<-table.element(a,result$Forecasts[i])
a<-table.element(a,result$Residuals[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')
}
if (par2 != 'none') {
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'',1,TRUE)
for (i in 1:par3) {
a<-table.element(a,paste('C',i,sep=''),1,TRUE)
}
a<-table.row.end(a)
for (i in 1:par3) {
a<-table.row.start(a)
a<-table.element(a,paste('C',i,sep=''),1,TRUE)
for (j in 1:par3) {
a<-table.element(a,myt[i,j])
}
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable2.tab')
}