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:37:22 -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/t13246582571pshcq8g6e2czb0.htm/, Retrieved Mon, 29 Apr 2024 21:39:02 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=160568, Retrieved Mon, 29 Apr 2024 21:39:02 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact102
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 20:21:33] [b98453cac15ba1066b407e146608df68]
-   PD  [Recursive Partitioning (Regression Trees)] [Recursive Partiti...] [2011-12-14 15:10:21] [7ead21d528290ed5f4bbc64b680f15e5]
-   PD    [Recursive Partitioning (Regression Trees)] [recursive partiti...] [2011-12-23 15:22:25] [7ead21d528290ed5f4bbc64b680f15e5]
-   P       [Recursive Partitioning (Regression Trees)] [categorization] [2011-12-23 16:23:15] [7ead21d528290ed5f4bbc64b680f15e5]
-   P           [Recursive Partitioning (Regression Trees)] [] [2011-12-23 16:37:22] [050dc696fa22882d0c3b1ebe5a70a85e] [Current]
Feedback Forum

Post a new message
Dataseries X:
112285	396	81	30	94	210907	24188	144	145
84786	297	55	28	103	120982	18273	103	101
83123	559	50	38	93	176508	14130	98	98
101193	967	125	30	103	179321	32287	135	132
38361	270	40	22	51	123185	8654	61	60
68504	143	37	26	70	52746	9245	39	38
119182	1562	63	25	91	385534	33251	150	144
22807	109	44	18	22	33170	1271	5	5
17140	371	88	11	38	101645	5279	28	28
116174	656	66	26	93	149061	27101	84	84
57635	511	57	25	60	165446	16373	80	79
66198	655	74	38	123	237213	19716	130	127
71701	465	49	44	148	173326	17753	82	78
57793	525	52	30	90	133131	9028	60	60
80444	885	88	40	124	258873	18653	131	131
53855	497	36	34	70	180083	8828	84	84
97668	1436	108	47	168	324799	29498	140	133
133824	612	43	30	115	230964	27563	151	150
101481	865	75	31	71	236785	18293	91	91
99645	385	32	23	66	135473	22530	138	132
114789	567	44	36	134	202925	15977	150	136
99052	639	85	36	117	215147	35082	124	124
67654	963	86	30	108	344297	16116	119	118
65553	398	56	25	84	153935	15849	73	70
97500	410	50	39	156	132943	16026	110	107
69112	966	135	34	120	174724	26569	123	119
82753	801	63	31	114	174415	24785	90	89
85323	892	81	31	94	225548	17569	116	112
72654	513	52	33	120	223632	23825	113	108
30727	469	44	25	81	124817	7869	56	52
77873	683	113	33	110	221698	14975	115	112
117478	643	39	35	133	210767	37791	119	116
74007	535	73	42	122	170266	9605	129	123
90183	625	48	43	158	260561	27295	127	125
61542	264	33	30	109	84853	2746	27	27
101494	992	59	33	124	294424	34461	175	162
27570	238	41	13	39	101011	8098	35	32
55813	818	69	32	92	215641	4787	64	64
79215	937	64	36	126	325107	24919	96	92
1423	70	1	0	0	7176	603	0	0
55461	507	59	28	70	167542	16329	84	83
31081	260	32	14	37	106408	12558	41	41
22996	503	129	17	38	96560	7784	47	47
83122	927	37	32	120	265769	28522	126	120
70106	1269	31	30	93	269651	22265	105	105
60578	537	65	35	95	149112	14459	80	79
39992	910	107	20	77	175824	14526	70	65
79892	532	74	28	90	152871	22240	73	70
49810	345	54	28	80	111665	11802	57	55
71570	918	76	39	31	116408	7623	40	39
100708	1635	715	34	110	362301	11912	68	67
33032	330	57	26	66	78800	7935	21	21
82875	557	66	39	138	183167	18220	127	127
139077	1178	106	39	133	277965	19199	154	152
71595	740	54	33	113	150629	19918	116	113
72260	452	32	28	100	168809	21884	102	99
5950	218	20	4	7	24188	2694	7	7
115762	764	71	39	140	329267	15808	148	141
32551	255	21	18	61	65029	3597	21	21
31701	454	70	14	41	101097	5296	35	35
80670	866	112	29	96	218946	25239	112	109
143558	574	66	44	164	244052	29801	137	133
117105	1276	190	21	78	341570	18450	135	123
23789	379	66	16	49	103597	7132	26	26
120733	825	165	28	102	233328	34861	230	230
105195	798	56	35	124	256462	35940	181	166
73107	663	61	28	99	206161	16688	71	68
132068	1069	53	38	129	311473	24683	147	147
149193	921	127	23	62	235800	46230	190	179
46821	858	63	36	73	177939	10387	64	61
87011	711	38	32	114	207176	21436	105	101
95260	503	50	29	99	196553	30546	107	108
55183	382	52	25	70	174184	19746	94	90
106671	464	42	27	104	143246	15977	116	114
73511	717	76	36	116	187559	22583	106	103
92945	690	67	28	91	187681	17274	143	142
78664	462	50	23	74	119016	16469	81	79
70054	657	53	40	138	182192	14251	89	88
22618	385	39	23	67	73566	3007	26	25
74011	577	50	40	151	194979	16851	84	83
83737	619	77	28	72	167488	21113	113	113
69094	479	57	34	120	143756	17401	120	118
93133	817	73	33	115	275541	23958	110	110
95536	752	34	28	105	243199	23567	134	129
225920	430	39	34	104	182999	13065	54	51
62133	451	46	30	108	135649	15358	96	93
61370	537	63	33	98	152299	14587	78	76
43836	519	35	22	69	120221	12770	51	49
106117	1000	106	38	111	346485	24021	121	118
38692	637	43	26	99	145790	9648	38	38
84651	465	47	35	71	193339	20537	145	141
56622	437	31	8	27	80953	7905	59	58
15986	711	162	24	69	122774	4527	27	27
95364	299	57	29	107	130585	30495	91	91
26706	248	36	20	73	112611	7117	48	48
89691	1162	263	29	107	286468	17719	68	63
67267	714	78	45	93	241066	27056	58	56
126846	905	63	37	129	148446	33473	150	144
41140	649	54	33	69	204713	9758	74	73
102860	512	63	33	118	182079	21115	181	168
51715	472	77	25	73	140344	7236	65	64
55801	905	79	32	119	220516	13790	97	97
111813	786	110	29	104	243060	32902	121	117
120293	489	56	28	107	162765	25131	99	100
138599	479	56	28	99	182613	30910	152	149
161647	617	43	31	90	232138	35947	188	187
115929	925	111	52	197	265318	29848	138	127
24266	351	71	21	36	85574	6943	40	37
162901	1144	62	24	85	310839	42705	254	245
109825	669	56	41	139	225060	31808	87	87
129838	707	74	33	106	232317	26675	178	177
37510	458	60	32	50	144966	8435	51	49
43750	214	43	19	64	43287	7409	49	49
40652	599	68	20	31	155754	14993	73	73
87771	572	53	31	63	164709	36867	176	177
85872	897	87	31	92	201940	33835	94	94
89275	819	46	32	106	235454	24164	120	117
44418	720	105	18	63	220801	12607	66	60
192565	273	32	23	69	99466	22609	56	55
35232	508	133	17	41	92661	5892	39	39
40909	506	79	20	56	133328	17014	66	64
13294	451	51	12	25	61361	5394	27	26
32387	699	207	17	65	125930	9178	65	64
140867	407	67	30	93	100750	6440	58	58
120662	465	47	31	114	224549	21916	98	95
21233	245	34	10	38	82316	4011	25	25
44332	370	66	13	44	102010	5818	26	26
61056	316	76	22	87	101523	18647	77	76
101338	603	65	42	110	243511	20556	130	129
1168	154	9	1	0	22938	238	11	11
13497	229	42	9	27	41566	70	2	2
65567	577	45	32	83	152474	22392	101	101
25162	192	25	11	30	61857	3913	31	28
32334	617	115	25	80	99923	12237	36	36
40735	411	97	36	98	132487	8388	120	89
91413	975	53	31	82	317394	22120	195	193
855	146	2	0	0	21054	338	4	4
97068	705	52	24	60	209641	11727	89	84
44339	184	44	13	28	22648	3704	24	23
14116	200	22	8	9	31414	3988	39	39
10288	274	35	13	33	46698	3030	14	14
65622	502	74	19	59	131698	13520	78	78
16563	382	103	18	49	91735	1421	15	14
76643	964	144	33	115	244749	20923	106	101
110681	537	60	40	140	184510	20237	83	82
29011	438	134	22	49	79863	3219	24	24
92696	369	89	38	120	128423	3769	37	36
94785	417	42	24	66	97839	12252	77	75
8773	276	52	8	21	38214	1888	16	16
83209	514	98	35	124	151101	14497	56	55
93815	822	99	43	152	272458	28864	132	131
86687	389	52	43	139	172494	21721	144	131
34553	466	29	14	38	108043	4821	40	39
105547	1255	125	41	144	328107	33644	153	144
103487	694	106	38	120	250579	15923	143	139
213688	1024	95	45	160	351067	42935	220	211
71220	400	40	31	114	158015	18864	79	78
23517	397	140	13	39	98866	4977	50	50
56926	350	43	28	78	85439	7785	39	39
91721	719	128	31	119	229242	17939	95	90
115168	1277	142	40	141	351619	23436	169	166
111194	356	73	30	101	84207	325	12	12
51009	457	72	16	56	120445	13539	63	57
135777	1402	128	37	133	324598	34538	134	133
51513	600	61	30	83	131069	12198	69	69
74163	480	73	35	116	204271	26924	119	119
51633	595	148	32	90	165543	12716	119	119
75345	436	64	27	36	141722	8172	75	65
33416	230	45	20	50	116048	10855	63	61
83305	651	58	18	61	250047	11932	55	49
98952	1367	97	31	97	299775	14300	103	101
102372	564	50	31	98	195838	25515	197	196
37238	716	37	21	78	173260	2805	16	15
103772	747	50	39	117	254488	29402	140	136
123969	467	105	41	148	104389	16440	89	89
27142	671	69	13	41	136084	11221	40	40
135400	861	46	32	105	199476	28732	125	123
21399	319	57	18	55	92499	5250	21	21
130115	612	52	39	132	224330	28608	167	163
24874	433	98	14	44	135781	8092	32	29
34988	434	61	7	21	74408	4473	36	35
45549	503	89	17	50	81240	1572	13	13
6023	85	0	0	0	14688	2065	5	5
64466	564	48	30	73	181633	14817	96	96
54990	824	91	37	86	271856	16714	151	151
1644	74	0	0	0	7199	556	6	6
6179	259	7	5	13	46660	2089	13	13
3926	69	3	1	4	17547	2658	3	3
32755	535	54	16	57	133368	10695	57	56
34777	239	70	32	48	95227	1669	23	23
73224	438	36	24	46	152601	16267	61	57
27114	459	37	17	48	98146	7768	21	14
20760	426	123	11	32	79619	7252	43	43
37636	288	247	24	68	59194	6387	20	20
65461	498	46	22	87	139942	18715	82	72
30080	454	72	12	43	118612	7936	90	87
24094	376	41	19	67	72880	8643	25	21
69008	225	24	13	46	65475	7294	60	56
54968	555	45	17	46	99643	4570	61	59
46090	252	33	15	56	71965	7185	85	82
27507	208	27	16	48	77272	10058	43	43
10672	130	36	24	44	49289	2342	25	25
34029	481	87	15	60	135131	8509	41	38
46300	389	90	17	65	108446	13275	26	25
24760	565	114	18	55	89746	6816	38	38
18779	173	31	20	38	44296	1930	12	12
21280	278	45	16	52	77648	8086	29	29
40662	609	69	16	60	181528	10737	49	47
28987	422	51	18	54	134019	8033	46	45
22827	445	34	22	86	124064	7058	41	40
18513	387	60	8	24	92630	6782	31	30
30594	339	45	17	52	121848	5401	41	41
24006	181	54	18	49	52915	6521	26	25
27913	245	25	16	61	81872	10856	23	23
42744	384	38	23	61	58981	2154	14	14
12934	212	52	22	81	53515	6117	16	16
22574	399	67	13	43	60812	5238	25	26
41385	229	74	13	40	56375	4820	21	21
18653	224	38	16	40	65490	5615	32	27
18472	203	30	16	56	80949	4272	9	9
30976	333	26	20	68	76302	8702	35	33
63339	384	67	22	79	104011	15340	42	42
25568	636	132	17	47	98104	8030	68	68
33747	185	42	18	57	67989	9526	32	32
4154	93	35	17	41	30989	1278	6	6
19474	581	118	12	29	135458	4236	68	67
35130	248	68	7	3	73504	3023	33	33
39067	304	43	17	60	63123	7196	84	77
13310	344	76	14	30	61254	3394	46	46
65892	407	64	23	79	74914	6371	30	30
4143	170	48	17	47	31774	1574	0	0
28579	312	64	14	40	81437	9620	36	36
51776	507	56	15	48	87186	6978	47	46
21152	224	71	17	36	50090	4911	20	18
38084	340	75	21	42	65745	8645	50	48
27717	168	39	18	49	56653	8987	30	29
32928	443	42	18	57	158399	5544	30	28
11342	204	39	17	12	46455	3083	34	34
19499	367	93	17	40	73624	6909	33	33
16380	210	38	16	43	38395	3189	34	34
36874	335	60	15	33	91899	6745	37	33
48259	364	71	21	77	139526	16724	83	80
16734	178	52	16	43	52164	4850	32	32
28207	206	27	14	45	51567	7025	30	30
30143	279	59	15	47	70551	6047	43	41
41369	387	40	17	43	84856	7377	41	41
45833	490	79	15	45	102538	9078	51	51
29156	238	44	15	50	86678	4605	19	18
35944	343	65	10	35	85709	3238	37	34
36278	232	10	6	7	34662	8100	33	31
45588	530	124	22	71	150580	9653	41	39
45097	291	81	21	67	99611	8914	54	54
3895	67	15	1	0	19349	786	14	14
28394	397	92	18	62	99373	6700	25	24
18632	467	42	17	54	86230	5788	25	24
2325	178	10	4	4	30837	593	8	8
25139	175	24	10	25	31706	4506	26	26
27975	299	64	16	40	89806	6382	20	19
14483	154	45	16	38	62088	5621	11	11
13127	106	22	9	19	40151	3997	14	14
5839	189	56	16	17	27634	520	3	1
24069	194	94	17	67	76990	8891	40	39
3738	135	19	7	14	37460	999	5	5
18625	201	35	15	30	54157	7067	38	37
36341	207	32	14	54	49862	4639	32	32
24548	280	35	14	35	84337	5654	41	38
21792	260	48	18	59	64175	6928	46	47
26263	227	49	12	24	59382	1514	47	47
23686	239	48	16	58	119308	9238	37	37
49303	333	62	21	42	76702	8204	51	51
25659	428	96	19	46	103425	5926	49	45
28904	230	45	16	61	70344	5785	21	21
2781	292	63	1	3	43410	4	1	1
29236	350	71	16	52	104838	5930	44	42
19546	186	26	10	25	62215	3710	26	26
22818	326	48	19	40	69304	705	21	21
32689	155	29	12	32	53117	443	4	4
5752	75	19	2	4	19764	2416	10	10
22197	361	45	14	49	86680	7747	43	43
20055	261	45	17	63	84105	5432	34	34
25272	299	67	19	67	77945	4913	32	31
82206	300	30	14	32	89113	2650	20	19
32073	450	36	11	23	91005	2370	34	34
5444	183	34	4	7	40248	775	6	6
20154	238	36	16	54	64187	5576	12	11
36944	165	34	20	37	50857	1352	24	24
8019	234	37	12	35	56613	3080	16	16
30884	176	46	15	51	62792	10205	72	72
19540	329	44	16	39	72535	6095	27	21




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Gertrude Mary Cox' @ cox.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 & 5 seconds \tabularnewline
R Server & 'Gertrude Mary Cox' @ cox.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=160568&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]5 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gertrude Mary Cox' @ cox.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=160568&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=160568&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 time5 seconds
R Server'Gertrude Mary Cox' @ cox.wessa.net







Confusion Matrix (predicted in columns / actuals in rows)
C1C2
C11432
C224120

\begin{tabular}{lllllllll}
\hline
Confusion Matrix (predicted in columns / actuals in rows) \tabularnewline
 & C1 & C2 \tabularnewline
C1 & 143 & 2 \tabularnewline
C2 & 24 & 120 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=160568&T=1

[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]143[/C][C]2[/C][/ROW]
[ROW][C]C2[/C][C]24[/C][C]120[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=160568&T=1

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

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
C11432
C224120



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