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 computationFri, 23 Dec 2011 11:38:01 -0500
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2011/Dec/23/t1324658329ab0hhdt31tnuosh.htm/, Retrieved Mon, 29 Apr 2024 20:21:06 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=160569, Retrieved Mon, 29 Apr 2024 20:21:06 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact92
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Recursive Partitioning (Regression Trees)] [] [2010-12-05 18:59:57] [b98453cac15ba1066b407e146608df68]
-   PD  [Recursive Partitioning (Regression Trees)] [WS10_2] [2011-12-14 14:10:40] [153847d967fd6c20972581ae976d765c]
- R PD    [Recursive Partitioning (Regression Trees)] [Paper BAII Deel 3...] [2011-12-23 16:16:13] [153847d967fd6c20972581ae976d765c]
-   P         [Recursive Partitioning (Regression Trees)] [Paper BAII Deel 3...] [2011-12-23 16:38:01] [090955e14a3628c39265567ebcb7b0cf] [Current]
Feedback Forum

Post a new message
Dataseries X:
210907	112285	30	79	4	2
120982	84786	28	58	2	3
176508	83123	38	60	4	2
179321	101193	30	108	NA	NA
123185	38361	22	49	NA	NA
52746	68504	26	0	2	3
385534	119182	25	121	3	4
33170	22807	18	1	NA	NA
101645	17140	11	20	NA	NA
149061	116174	26	43	4	4
165446	57635	25	69	NA	NA
237213	66198	38	78	3	2
173326	71701	44	86	NA	NA
133131	57793	30	44	4	2
258873	80444	40	104	NA	NA
180083	53855	34	63	NA	NA
324799	97668	47	158	4	2
230964	133824	30	102	4	4
236785	101481	31	77	2	2
135473	99645	23	82	NA	NA
202925	114789	36	115	3	2
215147	99052	36	101	1	2
344297	67654	30	80	4	3
153935	65553	25	50	NA	NA
132943	97500	39	83	NA	NA
174724	69112	34	123	5	2
174415	82753	31	73	2	1
225548	85323	31	81	NA	NA
223632	72654	33	105	4	2
124817	30727	25	47	4	2
221698	77873	33	105	3	1
210767	117478	35	94	NA	NA
170266	74007	42	44	4	4
260561	90183	43	114	3	3
84853	61542	30	38	NA	NA
294424	101494	33	107	1	2
101011	27570	13	30	4	4
215641	55813	32	71	NA	NA
325107	79215	36	84	2	3
7176	1423	0	0	NA	NA
167542	55461	28	59	NA	NA
106408	31081	14	33	5	4
96560	22996	17	42	4	3
265769	83122	32	96	3	1
269651	70106	30	106	NA	NA
149112	60578	35	56	4	1
175824	39992	20	57	2	4
152871	79892	28	59	3	4
111665	49810	28	39	NA	NA
116408	71570	39	34	NA	NA
362301	100708	34	76	4	2
78800	33032	26	20	NA	NA
183167	82875	39	91	4	3
277965	139077	39	115	1	2
150629	71595	33	85	3	3
168809	72260	28	76	4	2
24188	5950	4	8	NA	NA
329267	115762	39	79	NA	NA
65029	32551	18	21	NA	NA
101097	31701	14	30	NA	NA
218946	80670	29	76	2	5
244052	143558	44	101	4	4
341570	117105	21	94	4	4
103597	23789	16	27	2	2
233328	120733	28	92	NA	NA
256462	105195	35	123	NA	NA
206161	73107	28	75	NA	NA
311473	132068	38	128	3	4
235800	149193	23	105	NA	NA
177939	46821	36	55	NA	NA
207176	87011	32	56	NA	NA
196553	95260	29	41	2	2
174184	55183	25	72	NA	NA
143246	106671	27	67	4	1
187559	73511	36	75	4	1
187681	92945	28	114	4	4
119016	78664	23	118	3	1
182192	70054	40	77	NA	NA
73566	22618	23	22	NA	NA
194979	74011	40	66	NA	NA
167488	83737	28	69	4	1
143756	69094	34	105	4	2
275541	93133	33	116	NA	NA
243199	95536	28	88	1	4
182999	225920	34	73	2	4
135649	62133	30	99	4	1
152299	61370	33	62	3	2
120221	43836	22	53	4	4
346485	106117	38	118	5	4
145790	38692	26	30	NA	NA
193339	84651	35	100	2	4
80953	56622	8	49	NA	NA
122774	15986	24	24	3	2
130585	95364	29	67	5	2
112611	26706	20	46	4	4
286468	89691	29	57	3	3
241066	67267	45	75	2	4
148446	126846	37	135	4	4
204713	41140	33	68	2	3
182079	102860	33	124	2	2
140344	51715	25	33	2	1
220516	55801	32	98	2	2
243060	111813	29	58	5	4
162765	120293	28	68	2	1
182613	138599	28	81	NA	NA
232138	161647	31	131	NA	NA
265318	115929	52	110	4	4
85574	24266	21	37	2	4
310839	162901	24	130	5	4
225060	109825	41	93	5	4
232317	129838	33	118	NA	NA
144966	37510	32	39	NA	NA
43287	43750	19	13	NA	NA
155754	40652	20	74	NA	NA
164709	87771	31	81	2	2
201940	85872	31	109	2	2
235454	89275	32	151	2	3
220801	44418	18	51	3	2
99466	192565	23	28	5	5
92661	35232	17	40	3	5
133328	40909	20	56	2	4
61361	13294	12	27	2	2
125930	32387	17	37	2	2
100750	140867	30	83	1	1
224549	120662	31	54	NA	NA
82316	21233	10	27	5	2
102010	44332	13	28	3	2
101523	61056	22	59	4	2
243511	101338	42	133	2	4
22938	1168	1	12	NA	NA
41566	13497	9	0	NA	NA
152474	65567	32	106	4	3
61857	25162	11	23	NA	NA
99923	32334	25	44	4	1
132487	40735	36	71	2	1
317394	91413	31	116	4	2
21054	855	0	4	NA	NA
209641	97068	24	62	NA	NA
22648	44339	13	12	3	2
31414	14116	8	18	NA	NA
46698	10288	13	14	4	4
131698	65622	19	60	4	3
91735	16563	18	7	2	2
244749	76643	33	98	2	2
184510	110681	40	64	NA	NA
79863	29011	22	29	4	4
128423	92696	38	32	3	4
97839	94785	24	25	5	5
38214	8773	8	16	NA	NA
151101	83209	35	48	NA	NA
272458	93815	43	100	2	2
172494	86687	43	46	4	4
108043	34553	14	45	3	1
328107	105547	41	129	2	3
250579	103487	38	130	4	1
351067	213688	45	136	4	4
158015	71220	31	59	NA	NA
98866	23517	13	25	NA	NA
85439	56926	28	32	NA	NA
229242	91721	31	63	4	1
351619	115168	40	95	NA	NA
84207	111194	30	14	4	2
120445	51009	16	36	2	1
324598	135777	37	113	4	4
131069	51513	30	47	4	2
204271	74163	35	92	4	3
165543	51633	32	70	NA	NA
141722	75345	27	19	5	2
116048	33416	20	50	NA	NA
250047	83305	18	41	3	2
299775	98952	31	91	3	4
195838	102372	31	111	4	4
173260	37238	21	41	4	2
254488	103772	39	120	3	3
104389	123969	41	135	NA	NA
136084	27142	13	27	NA	NA
199476	135400	32	87	NA	NA
92499	21399	18	25	3	3
224330	130115	39	131	4	3
135781	24874	14	45	3	2
74408	34988	7	29	4	3
81240	45549	17	58	5	3
14688	6023	0	4	NA	NA
181633	64466	30	47	2	5
271856	54990	37	109	4	4
7199	1644	0	7	NA	NA
46660	6179	5	12	NA	NA
17547	3926	1	0	NA	NA
133368	32755	16	37	2	2
95227	34777	32	37	4	2
152601	73224	24	46	4	2
98146	27114	17	15	3	3
79619	20760	11	42	NA	NA
59194	37636	24	7	2	1
139942	65461	22	54	2	2
118612	30080	12	54	2	2
72880	24094	19	14	3	4
65475	69008	13	16	3	2
99643	54968	17	33	4	1
71965	46090	15	32	4	2
77272	27507	16	21	NA	NA
49289	10672	24	15	NA	NA
135131	34029	15	38	2	4
108446	46300	17	22	1	4
89746	24760	18	28	5	4
44296	18779	20	10	NA	NA
77648	21280	16	31	NA	NA
181528	40662	16	32	3	2
134019	28987	18	32	4	1
124064	22827	22	43	NA	NA
92630	18513	8	27	3	2
121848	30594	17	37	4	5
52915	24006	18	20	NA	NA
81872	27913	16	32	2	1
58981	42744	23	0	4	3
53515	12934	22	5	4	4
60812	22574	13	26	3	2
56375	41385	13	10	2	2
65490	18653	16	27	5	5
80949	18472	16	11	NA	NA
76302	30976	20	29	5	4
104011	63339	22	25	4	2
98104	25568	17	55	3	2
67989	33747	18	23	NA	NA
30989	4154	17	5	NA	NA
135458	19474	12	43	2	2
73504	35130	7	23	NA	NA
63123	39067	17	34	2	3
61254	13310	14	36	0	3
74914	65892	23	35	NA	NA
31774	4143	17	0	4	2
81437	28579	14	37	4	2
87186	51776	15	28	4	4
50090	21152	17	16	NA	NA
65745	38084	21	26	2	2
56653	27717	18	38	4	4
158399	32928	18	23	4	4
46455	11342	17	22	NA	NA
73624	19499	17	30	4	2
38395	16380	16	16	NA	NA
91899	36874	15	18	3	3
139526	48259	21	28	NA	NA
52164	16734	16	32	NA	NA
51567	28207	14	21	4	2
70551	30143	15	23	NA	NA
84856	41369	17	29	NA	NA
102538	45833	15	50	2	2
86678	29156	15	12	NA	NA
85709	35944	10	21	NA	NA
34662	36278	6	18	4	1
150580	45588	22	27	4	4
99611	45097	21	41	2	3
19349	3895	1	13	NA	NA
99373	28394	18	12	4	4
86230	18632	17	21	3	3
30837	2325	4	8	5	5
31706	25139	10	26	4	1
89806	27975	16	27	NA	NA
62088	14483	16	13	4	4
40151	13127	9	16	NA	NA
27634	5839	16	2	NA	NA
76990	24069	17	42	NA	NA
37460	3738	7	5	NA	NA
54157	18625	15	37	4	4
49862	36341	14	17	4	5
84337	24548	14	38	4	2
64175	21792	18	37	NA	NA
59382	26263	12	29	4	4
119308	23686	16	32	2	2
76702	49303	21	35	4	3
103425	25659	19	17	NA	NA
70344	28904	16	20	NA	NA
43410	2781	1	7	NA	NA
104838	29236	16	46	3	2
62215	19546	10	24	NA	NA
69304	22818	19	40	4	1
53117	32689	12	3	3	3
19764	5752	2	10	NA	NA
86680	22197	14	37	4	2
84105	20055	17	17	3	3
77945	25272	19	28	4	2
89113	82206	14	19	NA	NA
91005	32073	11	29	NA	NA
40248	5444	4	8	NA	NA
64187	20154	16	10	2	4
50857	36944	20	15	NA	NA
56613	8019	12	15	NA	NA
62792	30884	15	28	NA	NA
72535	19540	16	17	NA	NA




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

\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 & 'AstonUniversity' @ aston.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=160569&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]'AstonUniversity' @ aston.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=160569&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=160569&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'AstonUniversity' @ aston.wessa.net







10-Fold Cross Validation
Prediction (training)Prediction (testing)
ActualC1C2CVC1C2CV
C117942080.8961185230.8894
C21005190.838410510.8361
Overall--0.8825--0.8773

\begin{tabular}{lllllllll}
\hline
10-Fold Cross Validation \tabularnewline
 & Prediction (training) & Prediction (testing) \tabularnewline
Actual & C1 & C2 & CV & C1 & C2 & CV \tabularnewline
C1 & 1794 & 208 & 0.8961 & 185 & 23 & 0.8894 \tabularnewline
C2 & 100 & 519 & 0.8384 & 10 & 51 & 0.8361 \tabularnewline
Overall & - & - & 0.8825 & - & - & 0.8773 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=160569&T=1

[TABLE]
[ROW][C]10-Fold Cross Validation[/C][/ROW]
[ROW][C][/C][C]Prediction (training)[/C][C]Prediction (testing)[/C][/ROW]
[ROW][C]Actual[/C][C]C1[/C][C]C2[/C][C]CV[/C][C]C1[/C][C]C2[/C][C]CV[/C][/ROW]
[ROW][C]C1[/C][C]1794[/C][C]208[/C][C]0.8961[/C][C]185[/C][C]23[/C][C]0.8894[/C][/ROW]
[ROW][C]C2[/C][C]100[/C][C]519[/C][C]0.8384[/C][C]10[/C][C]51[/C][C]0.8361[/C][/ROW]
[ROW][C]Overall[/C][C]-[/C][C]-[/C][C]0.8825[/C][C]-[/C][C]-[/C][C]0.8773[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=160569&T=1

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

As an alternative you can also use a QR Code:  

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

10-Fold Cross Validation
Prediction (training)Prediction (testing)
ActualC1C2CVC1C2CV
C117942080.8961185230.8894
C21005190.838410510.8361
Overall--0.8825--0.8773







Confusion Matrix (predicted in columns / actuals in rows)
C1C2
C119823
C21157

\begin{tabular}{lllllllll}
\hline
Confusion Matrix (predicted in columns / actuals in rows) \tabularnewline
 & C1 & C2 \tabularnewline
C1 & 198 & 23 \tabularnewline
C2 & 11 & 57 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=160569&T=2

[TABLE]
[ROW][C]Confusion Matrix (predicted in columns / actuals in rows)[/C][/ROW]
[ROW][C][/C][C]C1[/C][C]C2[/C][/ROW]
[ROW][C]C1[/C][C]198[/C][C]23[/C][/ROW]
[ROW][C]C2[/C][C]11[/C][C]57[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=160569&T=2

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

As an alternative you can also use a QR Code:  

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

Confusion Matrix (predicted in columns / actuals in rows)
C1C2
C119823
C21157



Parameters (Session):
par1 = 1 ; par2 = equal ; par3 = 2 ; par4 = yes ;
Parameters (R input):
par1 = 1 ; par2 = equal ; par3 = 2 ; par4 = yes ;
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')
}