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 computationTue, 21 Dec 2010 23:15:01 +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/22/t1292973214klibzbqtn7dux26.htm/, Retrieved Mon, 06 May 2024 01:10:52 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=114028, Retrieved Mon, 06 May 2024 01:10:52 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact157
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)] [workshop10RP] [2010-12-21 22:45:11] [8b2514d8f13517d765015fc185a22b4b]
-   PD      [Recursive Partitioning (Regression Trees)] [workshop10RP2] [2010-12-21 23:15:01] [6e19356a8195a048e2417405f21c29e8] [Current]
Feedback Forum

Post a new message
Dataseries X:
1.3866	126.64	40.7819
1.3582	126.81	39.5915
1.3332	125.84	38.8859
1.3595	126.77	39.9068
1.3617	124.34	41.47
1.3684	124.4	41.5613
1.3394	120.48	41.6005
1.3262	118.54	41.4113
1.3173	117.66	41.84
1.3085	116.97	42.2892
1.327	120.11	43.1521
1.3182	119.16	43.5998
1.293	116.9	43.116
1.291	116.11	42.4185
1.2984	114.98	42.3687
1.2795	113.65	42.2975
1.299	115.82	42.8528
1.3174	117.59	43.535
1.326	118.57	44.7265
1.3111	118.07	45.7293
1.2816	114.98	45.7585
1.276	114.04	46.1685
1.2849	115.02	46.5075
1.2818	114.28	46.527
1.2829	115.04	46.601
1.2796	116.7	46.4607
1.3008	119.21	46.7135
1.2967	118.39	46.4113
1.2938	116.5	45.55
1.2833	115.46	44.6081
1.2823	117.59	44.4395
1.2765	117.33	44.9847
1.2634	116.2	45.7558
1.2596	116.83	45.3942
1.2705	118.99	45.697
1.2591	118.62	45.5664
1.2798	121.09	46.0205
1.2763	122.4	45.9195
1.2795	123.76	45.8005
1.2782	125.33	45.535
1.2644	123.23	45.4977
1.2596	122.52	45.5782
1.2615	123.64	45.7697
1.2555	124.67	45.2445
1.2555	124.71	45.0615
1.2658	122.53	45.2865
1.2565	124.4	44.791
1.2783	125.45	44.7625
1.2786	125.35	44.7644
1.2782	124.3	44.9973
1.2905	127.03	44.7265
1.3042	128.51	45.1465
1.2942	128.1	44.7465
1.313	128.94	45.1795
1.3671	129.67	45.6515
1.3549	129.87	45.492
1.3558	131.12	45.2775
1.3507	132.68	45.2115
1.3494	132.24	45.411
1.3607	133.63	45.4005
1.3295	129.91	44.7692
1.3193	127.93	44.8913
1.3308	131.17	45.032
1.3246	130.86	44.879
1.3392	133.48	44.833
1.3425	134.08	44.8257
1.3496	136.02	44.7815
1.3255	132.8	44.479
1.3231	132.37	44.6317
1.3273	133.05	44.5043
1.3276	132.57	44.3217
1.3173	130.7	44.1005
1.3196	130.5	44.047
1.3058	129.67	43.6835
1.2966	127.8	43.7864
1.2932	126.82	44.1807
1.2947	126.85	43.9595
1.305	128.28	43.937
1.3232	128.3	43.991
1.3125	126.82	43.865
1.2992	125.08	43.671
1.3266	128.53	43.93
1.3275	130.34	43.863
1.3223	131.52	43.7095
1.3403	132.59	43.9435
1.3322	131.17	43.736
1.3363	132.72	43.6295
1.3425	133.36	43.598
1.3574	132.82	43.8726
1.3683	132.9	43.8935
1.3623	130.9	43.5957
1.3563	129.41	43.7155
1.3518	128.67	43.528
1.3494	129.28	43.3415
1.3612	130.91	43.3374
1.369	131.06	43.332
1.3771	130.84	43.3869
1.3972	131.41	43.5016
1.401	133.22	43.4875
1.3908	132.06	43.6023
1.3901	132.48	43.3886
1.3856	134.38	43.3105
1.4098	135.22	43.4455
1.422	134.89	43.5185
1.4238	136.09	43.5755
1.4207	136.33	43.6217
1.4095	136.32	43.644
1.4177	137.48	43.5789
1.3866	136.53	43.5215
1.3959	136.8	43.5033
1.4102	138.03	43.632
1.3969	137.39	43.263
1.4004	137.55	43.3717
1.385	136.08	43.2745
1.389	134.78	43.2647
1.384	133.28	43.324
1.392	133.57	43.4455
1.3932	134.84	43.4098
1.3858	133.02	43.41
1.3978	133.49	43.93
1.4029	133.77	43.8104
1.394	134.34	43.54
1.4096	134.5	43.858
1.4058	134.03	43.8375
1.4134	135.51	43.881
1.4096	136.53	43.887
1.4049	135.95	43.8009
1.4009	134.32	43.7877
1.3897	132.44	43.811
1.4019	133.61	44.0625
1.3901	131.02	44.125
1.399	130.05	44.52
1.3901	128.21	45.4005
1.3975	129.03	45.89
1.3991	130.34	45.189
1.4089	131.57	44.9035
1.413	132.63	44.9351
1.409	132.06	44.801
1.4217	134.44	43.98
1.4223	134.1	44.11
1.4191	132.49	44.2661
1.4229	134.23	44.361
1.4227	134.92	44.099
1.4269	135.61	43.8435
1.4229	134.53	43.8914
1.4104	133.86	44.217
1.4053	133.89	44.506
1.4138	135.33	44.54
1.4303	135.86	44.4465
1.4384	136.22	44.842
1.441	137.38	44.8946
1.437	137.31	44.951
1.4357	136.89	45.445
1.4202	138.01	45.0035
1.4166	136.72	45.769
1.417	135.77	46.09
1.4293	137.52	45.412
1.4294	135.61	45.12
1.4072	132.94	45.48
1.4101	134.12	45.105
1.4112	132.55	45.056
1.4243	134.11	45.22
1.433	134.19	45.39
1.4323	135.57	45.041
1.4324	135.05	44.9399
1.427	134.32	44.9315
1.4268	133.61	45.1935
1.4364	134.75	45.3466
1.4272	133.1	45.4645
1.4314	133.26	45.5685
1.422	131.63	45.3921
1.4335	132.47	45.34
1.4262	132.45	45.1308
1.433	133.33	45.1005
1.4473	133.57	45.37
1.4522	134.13	45.2
1.4545	133.92	44.9614
1.4594	132.62	44.8015
1.4561	132.3	44.9152
1.4611	133.26	45.095
1.4671	132.6	44.9271
1.4712	134.38	44.6026
1.4705	134.17	44.5
1.4658	135.46	44.54
1.478	135.09	44.5532
1.4783	134.96	44.407
1.4768	133.85	44.259
1.467	132.59	44.1365
1.465	131.15	44.112
1.4549	130.91	43.8814
1.4643	131.07	43.98
1.4539	130.78	43.7294
1.4537	129.95	43.9119
1.4616	131.41	43.955
1.4722	131.21	43.9
1.4694	130.68	43.7065
1.4763	130.46	43.6939
1.475	131.12	43.6587
1.4765	132.99	43.5885
1.4864	133.02	43.8885
1.4881	133.39	43.8216
1.4864	134.07	43.751
1.4869	135.6	43.699
1.4918	135.66	43.7425
1.4971	135.53	43.639
1.4921	135.82	43.589
1.5	136.9	43.606
1.502	137.97	43.5325
1.5019	138.09	43.385
1.4874	136.91	43.3745
1.4785	134.76	43.236
1.4788	135.13	43.1957
1.48	134.66	43.01
1.4772	132.95	43.1401
1.4658	132.25	43.0487
1.4761	134.3	43.1972
1.4867	134.3	43.2461
1.4862	134.76	43.0866
1.4984	134.81	43.0865
1.4966	134.51	43.0194
1.5037	135.11	43.08
1.4922	134.32	43.007
1.4868	133.51	42.9278
1.4965	134.02	42.9545
1.4875	132.76	42.7995
1.4957	133.39	42.9048
1.4863	132.05	42.9468
1.4815	131.87	43.08
1.4968	133.03	43.1274
1.4969	132.57	43.1625
1.5083	132.1	43.45
1.5071	130.7	43.831
1.4918	129.2	43.7769
1.5023	129.77	43.98
1.5074	131.02	43.92
1.509	131.55	44.11
1.512	133.17	44.03
1.5068	133.08	44.1582
1.4787	133.24	44.14
1.4774	130.74	45.07
1.4768	129.91	44.8737
1.473	130.03	44.8505
1.4757	131.13	44.373
1.4647	129.55	44.075
1.4541	130.22	43.9725
1.456	130.61	44.094
1.4343	129.27	44.191
1.4337	129.68	43.9685
1.4368	130.1	43.79
1.4279	130.83	43.6041
1.4276	130.95	43.1707
1.4398	131.73	42.71
1.4405	131.86	42.755
1.4433	132.44	43.3316
1.4338	132.35	43.5
1.4406	133.16	43.154
1.4389	133.62	43.16
1.4442	132.54	43.1
1.435	132.69	42.85
1.4304	133.5	42.6175
1.4273	133.36	42.5
1.4528	134.23	42.6285
1.4481	132.41	42.6974
1.4563	133.02	43.04
1.4486	132.88	42.673
1.4374	130.76	42.5015
1.4369	130.33	42.538
1.4279	129.79	42.3735
1.4132	128.65	42.014
1.4064	129.14	41.8618
1.4135	127.35	42.1824
1.4151	127.74	42.605
1.4085	126.31	42.7345
1.4072	125.95	42.615
1.3999	126.36	42.465
1.3966	126.15	42.34
1.3913	125.6	42.251
1.3937	126.2	42.0475
1.3984	126.73	41.86
1.3847	125.68	41.685
1.3691	122.49	41.735
1.3675	122.07	41.706
1.376	123.4	41.764
1.374	123.01	41.58
1.3718	123.03	41.373
1.3572	122.33	41.088
1.3607	122.42	41.137
1.3649	122.68	41.1587
1.3726	124.69	41.185
1.3567	123.3	40.819
1.3519	124.17	40.633
1.3626	124.38	40.858
1.3577	123.19	40.794
1.3547	122.16	40.69
1.3489	120.66	40.595
1.357	120.92	40.7305
1.3525	120.67	40.5471
1.3548	120.68	40.5145
1.3641	121.1	40.7
1.3668	120.86	40.7
1.3582	121.48	40.522
1.3662	123.48	40.6165
1.3557	121.72	40.3985
1.361	123.16	40.2815
1.3657	123.84	40.245
1.3765	124.57	40.3055
1.3705	124.3	40.2696
1.3723	124.22	40.251
1.3756	124.43	40.127
1.366	123.33	39.95
1.3548	122.86	39.675
1.3471	121.25	39.954
1.3519	122.16	39.8828
1.3338	122.62	39.62
1.3356	123.44	39.5415
1.3353	124	39.525
1.3471	124.75	39.8145
1.3482	124.8	39.6675
1.3479	125.93	39.695
1.3468	126.28	39.5985
1.3396	126.04	39.2735
1.334	125.04	39.1435
1.3296	123.76	39.1742
1.3384	125.34	39.2025
1.3585	126.99	39.3946
1.3583	126.34	39.5025
1.3615	127.42	39.4845
1.3544	126.18	39.33
1.3535	125.3	39.295
1.3432	123.5	39.2675
1.3486	125.32	39.2535
1.3373	124.65	38.9845
1.3339	124.03	38.9285
1.3311	125.11	38.8592
1.3321	125.46	38.77
1.329	124.7	38.79
1.3245	124.48	38.8205
1.3256	124.76	38.7577
1.3315	125.81	38.839
1.3238	124.95	38.78
1.3089	123.66	38.54
1.2924	122.66	38.511
1.2727	119.34	38.615
1.2746	117.84	38.898
1.2969	120.97	38.8691
1.2698	117.38	38.384
1.2686	118.06	38.0277
1.2587	116.99	37.72
1.2492	115.55	37.7325
1.2349	114.17	37.626
1.2428	115.32	37.603
1.227	112.49	37.78
1.2334	111.93	38.559
1.2497	112.08	39.0459
1.236	111.63	38.45
1.2223	109.53	38.505
1.2309	111.35	38.2885
1.2255	110.79	37.795
1.2384	113.06	37.92
1.2307	112.62	38.034
1.2155	110.65	38.029
1.2218	112.36	38.063
1.2268	113.74	37.9828
1.206	111.73	37.745
1.1959	109.86	37.969
1.1942	109.32	38.007
1.201	109.99	38.0615
1.2045	109.84	38.0912
1.2127	111.13	38.091
1.2249	112.43	38.431
1.2258	111.77	38.48
1.2277	112.15	38.35
1.2363	112.89	38.214
1.2372	112.12	38.384
1.2391	113.1	38.1375
1.2258	111.09	38.0075
1.2271	110.76	38.0524
1.2262	109.59	38.235
1.2294	109.99	38.31
1.2339	110.25	38.2615
1.2198	108.31	38.13
1.2271	108.79	38.282
1.2328	108.14	38.581
1.2548	109.88	39.0801
1.2531	109.93	39.0387
1.2579	110.46	39.1015
1.2567	109.56	39.1503
1.266	111.49	39.14
1.2637	111.85	39.0275
1.2572	111.35	38.7665
1.2569	110.95	38.691
1.2703	112.49	38.849
1.2828	113.11	39.1644
1.3	112.54	39.4907
1.2957	112.84	39.5095
1.2844	111.5	39.2795
1.2817	111.52	39.0437
1.285	111.57	39.1355
1.2897	112.48	39.143
1.2931	112.31	39.185
1.3033	113.79	39.355
1.2992	114.01	39.297
1.3069	113.64	39.4514
1.3028	112.62	39.4173
1.3073	113.27	39.4305
1.3221	113.51	39.384
1.3206	112.92	39.3261
1.3184	113.66	39.301
1.3176	113.14	39.35
1.3253	113.48	39.64
1.3133	113.23	39.4723
1.3016	110.56	39.3685
1.279	109.5	39.1906
1.2799	109.78	39.1183
1.282	109.49	39.1325
1.286	109.66	39.1144
1.288	109.93	39.1614
1.2836	109.82	39.0908
1.2711	108.54	38.9199
1.2704	108.23	38.913
1.2611	106.19	38.9655
1.2613	106.49	39.029
1.2693	107.15	39.089
1.2713	107.74	39.07
1.27	107.54	39.0046
1.268	107.07	39.1038
1.28	107.54	39.3572
1.2818	107.81	39.388
1.2834	108.38	39.382
1.2874	108.42	39.4398
1.2744	106.86	39.2537
1.2697	106.41	39.2301
1.2715	106.46	39.2763
1.2725	106.84	39.282
1.2801	107.69	39.3325
1.285	107.04	39.557
1.2989	111.04	40.1
1.3078	111.93	40.5875
1.306	111.98	40.485
1.3074	112.07	40.55
1.312	112.05	40.7955
1.3364	113.14	41.456
1.3323	112.49	41.3557
1.3412	113.2	41.374
1.3477	113.52	41.2235
1.346	113.22	41.15
1.3611	113.85	41.3725
1.3648	113.68	41.6923
1.3726	114.26	41.8
1.3705	114.1	41.8045
1.378	114.8	41.64
1.3856	114.98	41.36
1.397	115.1	41.5745
1.3874	114.21	41.593
1.3936	114.24	41.575
1.3833	113.35	41.68
1.3958	114.23	42.0055
1.4101	114.43	42.3188
1.4089	114.28	42.565
1.3896	113	42.3575
1.3859	113.16	42.29
1.3861	112.59	42.695
1.4016	113.65	43.0028
1.3934	113.18	42.4507
1.4031	113.21	42.4705
1.3912	113.11	42.2875
1.3803	112.78	42.3172
1.3857	112.57	42.55
1.3857	111.87	42.7523
1.3926	111.94	42.8993
1.4018	113.18	43.1555
1.4014	113.67	43.1885
1.4244	115.15	43.43
1.4084	114.41	43.31
1.3917	112.88	42.815
1.3945	112.44	42.7017
1.377	113.48	42.28
1.37	112.78	41.922
1.3711	112.59	42.17
1.3626	113.31	42.1962
1.3612	113.21	42.3215
1.3481	112.5	42.3173
1.3647	113.72	42.391
1.3674	114.09	42.463
1.3647	113.97	42.4125
1.3496	112.5	42.304
1.3339	111.28	41.813
1.3321	111.35	41.651
1.3225	110.92	41.539
1.3146	110.73	41.1575
1.2998	109	40.9545




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

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







Confusion Matrix (predicted in columns / actuals in rows)
C1C2
C122620
C221224

\begin{tabular}{lllllllll}
\hline
Confusion Matrix (predicted in columns / actuals in rows) \tabularnewline
 & C1 & C2 \tabularnewline
C1 & 226 & 20 \tabularnewline
C2 & 21 & 224 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=114028&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]226[/C][C]20[/C][/ROW]
[ROW][C]C2[/C][C]21[/C][C]224[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=114028&T=1

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



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