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, 13 Dec 2011 12:59:32 -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/13/t1323799220hse2la48u8sx7pg.htm/, Retrieved Thu, 02 May 2024 21:04:41 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=154594, Retrieved Thu, 02 May 2024 21:04:41 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact93
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Recursive Partitioning (Regression Trees)] [ws 10 deel 4] [2011-12-12 16:42:32] [4b648d52023f19d55c572f0eddd72b1f]
-   P     [Recursive Partitioning (Regression Trees)] [confusion matrix] [2011-12-13 17:59:32] [2adf2d2c11e011c12275478b9efd18e5] [Current]
Feedback Forum

Post a new message
Dataseries X:
11.73	2582.5	2666	36.98	1	4.5	10605.65	60.8
11.75	2502.5	2584	37.79	1	4.5	10725.54	60.8
11.39	2483.5	2547.5	36.66	1	4.5	10746.67	60.8
11.54	2458.5	2469	36.8	1	4.5	10808.29	60.8
9.62	2493.5	2493.5	37.02	1	4.5	10836.64	60.8
9.82	2517.5	2531	37	1	4.5	10842.8	60.8
9.94	2497.5	2541.5	37	1	5.8	10857.53	61.4
9.9	2487.5	2542	36.5	1	5.8	10664.7	61.4
9.8	2516	2611.5	36.33	1	5.8	10579.1	61.4
9.86	2493	2637.5	36.22	1	5.8	10452.71	61.4
10.5	2417.5	2588.5	36	1	5.8	10526.76	61.4
10.33	2390	2567.5	35.59	1	5.8	10624.09	61.4
10.16	2327.5	2535.5	35.11	1	5.8	10754.03	61.4
9.91	2272.5	2413	35.17	1	5.8	10492.38	61.4
9.96	2277.5	2427.5	34.49	1	5.8	10586.02	61.4
10.03	2312.5	2481.5	35.27	1	5.8	10693.66	61.4
9.55	2282	2492.5	36.55	1	5.8	10505.02	61.4
9.51	2319	2582.5	35.81	1	5.8	10525.19	61.4
9.8	2322.5	2657	36.02	1	5.8	10589.5	61.4
10.08	2327.5	2687.5	35.33	1	5.8	10434.38	61.4
10.2	2289.5	2632.5	34.59	1	5.8	10254.43	61.4
10.23	2337.5	2682.5	34.44	1	5.8	9620.49	61.4
10.2	2412.5	2721.5	34.88	1	5.8	8605.15	61.4
10.07	2425	2693.5	34.59	1	5.8	9093.72	61.4
10.01	2372.5	2652.5	35.08	1	5.8	8962.67	61.4
10.05	2337.5	2627.5	34.48	1	5.8	9206.75	61.4
9.92	2367.5	2652.5	35.38	1	5.8	9608.32	61.4
10.03	2348.5	2637.5	35.3	1	5.8	9449.47	61.4
10.18	2337.5	2672.5	35.51	1	5.8	9435.01	61.4
10.1	2331	2669	35.17	1	6.2	9536.13	61.2
10.16	2407.5	2751	39.6	1	6.2	9478.53	61.2
10.15	2428.5	2772.5	39.6	1	6.2	9459.08	61.2
10.13	2429.5	2787.5	38.98	1	6.2	9708.79	61.2
10.09	2469	2802.5	39.81	1	6.2	9755.1	61.2
10.18	2497.5	2842.5	39.52	1	6.2	9708.39	61.2
10.06	2542.5	2862.5	38.7	1	6.2	9718.89	61.2
9.65	2467.5	2757.5	37.59	1.25	6.2	9615.55	61.2
9.74	2447.5	2692	37.85	1.25	6.2	9584.37	61.2
9.53	2412.5	2622.5	37.84	1.25	6.2	9590.93	61.2
9.5	2402.5	2634	38.9	1.25	6.2	9768.08	61.2
9	2350.5	2582.5	39.01	1.25	6.2	9719.7	61.2
9.15	2353	2557.5	38.32	1.25	6.2	9555.26	61.2
9.32	2358	2627.5	38.7	1.25	6.2	9641.18	61.2
9.62	2366.5	2625	39.08	1.25	6.2	9653.92	61.2
9.59	2284.5	2556	39.03	1.25	6.2	9591.52	61.2
9.37	2225.5	2528	38.76	1.25	6.2	9556.65	61.2
9.35	2253	2492.5	39.29	1.25	6.2	9441.03	61.2
9.32	2253	2492.5	39.39	1.25	6.2	9606.82	61.2
9.49	2253	2492.5	39.75	1.25	2.8	9685.77	60.4
9.52	2237.5	2507.5	40.05	1.25	2.8	9682.21	60.4
9.59	2173.5	2467.5	40.4	1.25	2.8	9671.96	60.4
9.35	2122.5	2352.5	39.99	1.25	2.8	9558.69	60.4
9.2	2162.5	2302.5	39.66	1.25	2.8	9691.84	60.4
9.57	2164.5	2306.5	39.57	1.25	2.8	9849.74	60.4
9.78	2169	2337.5	39.98	1.25	2.8	10004.2	60.4
9.79	2124	2274.5	40.64	1.25	2.8	9859.2	60.4
9.57	2154	2297.5	41.55	1.25	2.8	9794.38	60.4
9.53	2167.5	2340.5	40.68	1.25	2.8	9818.76	60.4
9.65	2130.5	2297.5	40.6	1.25	2.8	9864.26	60.4
9.36	2111	2287.5	40.89	1.25	2.8	9716.65	60.4
9.4	2182.5	2401.5	35.73	1.25	2.8	9648.77	60.4
9.32	2176.5	2482	34.5	1.25	2.8	9558.3	60.4
9.31	2152.5	2467.5	35.16	1.25	2.8	9567.02	60.4
9.19	2127.5	2429.5	35.82	1.25	2.8	9662.08	60.4
9.39	2189.5	2480.5	35.76	1.25	2.8	9620.82	60.4
9.28	2239	2516.5	35.24	1.25	2.8	9607.08	60.4
9.28	2264	2512.5	35.36	1.25	2.8	9460.63	60.4
9.31	2282	2512.5	35.6	1.25	2.8	9477.17	60.4
9.28	2282	2512.5	35.52	1.25	2.8	9422.88	60.4
9.31	2271	2512.5	35.67	1.25	2.8	9562.05	60.4
9.35	2252.5	2508.5	36.41	1.25	-0.5	9521.94	53.5
9.19	2220.5	2425.5	35.49	1.25	-0.5	9504.97	53.5
9.07	2237.5	2427.5	35.61	1.25	-0.5	9693.73	53.5
8.96	2281	2467.5	35.8	1.25	-0.5	9719.61	53.5
8.69	2274	2537.5	35.5	1.25	-0.5	9555.04	53.5
8.58	2272.5	2567.5	35.27	1.25	-0.5	9492.21	53.5
8.56	2286.5	2589.5	34.55	1.25	-0.5	9380.35	53.5
8.47	2267.5	2552.5	34.7	1.25	-0.5	9442.95	53.5
8.46	2237.5	2522.5	34.24	1.25	-0.5	9449.46	53.5
8.75	2270.5	2577.5	34.5	1.25	-0.5	9467.15	53.5
8.95	2267.5	2562.5	34.61	1.25	-0.5	9514.44	53.5
9.33	2207.5	2492.5	34.04	1.25	-0.5	9448.21	53.5
9.51	2217.5	2477.5	33.57	1.25	-0.5	9547.79	53.5
9.561	2170	2422.5	33.34	1.25	-0.5	9574.32	53.5
9.94	2222.5	2485.5	33.32	1.25	-0.5	9411.28	53.5
9.9	2242.5	2497.5	34.02	1.25	-0.5	9351.4	53.5
9.275	2232.5	2536.5	33.67	1.25	-0.5	9354.32	53.5
9.56	2245.5	2573.5	32.5	1.25	-0.5	9459.66	53.5
9.779	2257.5	2561.5	32.27	1.25	-0.5	9629.43	53.5
9.746	2270.5	2579.5	32.65	1.25	-0.5	9596.74	53.5
9.991	2302.5	2632.5	33.24	1.25	-0.5	9678.71	53.5
9.98	2363.5	2645.5	33.92	1.25	-0.5	9578.31	53.5
10.195	2377.5	2667.5	34.27	1.25	-1.1	9648.98	55.3
10.31	2392.5	2681	34.72	1.25	-1.1	9797.26	55.3
10.25	2411	2687.5	34.67	1.25	-1.1	9816.09	55.3
9.871	2391	2682.5	34.36	1.25	-1.1	9868.07	55.3
10.06	2400	2722.5	35.4	1.25	-1.1	9965.09	55.3
9.894	2357.5	2700.5	35.44	1.25	-1.1	9972.46	55.3
9.59	2302.5	2664	33.64	1.25	-1.1	10082.48	55.3
9.64	2342.5	2704	33.19	1.5	-1.1	10071.14	55.3
9.89	2387.5	2771	33.85	1.5	-1.1	10137.73	55.3
9.53	2351	2674.5	33.81	1.5	-1.1	10069.53	55.3
9.388	2369	2692.5	34.35	1.5	-1.1	9925.92	55.3
9.16	2417.5	2715.5	34.07	1.5	-1.1	9963.14	55.3
9.418	2483.5	2761	34.23	1.5	-1.1	9936.12	55.3
9.57	2462.5	2722	34.52	1.5	-1.1	9974.47	55.3
9.857	2458.5	2737.5	35	1.5	-1.1	9889.72	55.3
9.877	2468.5	2682.5	35.06	1.5	-1.1	10005.9	55.3
9.76	2471	2677.5	35.18	1.5	-1.1	10010.39	55.3
9.76	2512	2717.5	35.28	1.5	-1.1	10132.11	55.3
9.695	2515	2702.5	34.24	1.5	-1.1	10050.01	55.3
9.475	2512.5	2692.5	34.29	1.5	-1.1	10097.72	55.3
9.262	2493.5	2633.5	33.46	1.5	-1.1	10047.19	55.3
9.097	2477.5	2617.5	33	1.5	-2.5	9901.35	50.9
8.55	2437.5	2571	31.4	1.5	-2.5	9833.03	50.9
8.16	2380.5	2532.5	31.24	1.5	-2.5	9965.01	50.9
7.532	2337.5	2497.5	29.2	1.5	-2.5	9844.59	50.9
7.325	2267.5	2399.5	28	1.5	-2.5	9637.14	50.9
6.749	2051	2287.5	25.38	1.5	-2.5	9659.18	50.9
7.13	2130.5	2284.5	28.22	1.5	-2.5	9299.88	50.9
6.995	2112.5	2297.5	26.87	1.5	-2.5	9097.56	50.9
7.346	2171.5	2332.5	28.37	1.5	-2.5	8944.48	50.9
7.73	2205.5	2397.5	28.16	1.5	-2.5	9038.74	50.9
7.837	2182.5	2382.5	28.86	1.5	-2.5	8981.94	50.9
7.514	2175.5	2377.5	26.54	1.5	-2.5	8963.72	50.9
7.58	2209	2397.5	27.16	1.5	-2.5	9086.41	50.9
6.83	2162	2312.5	25.31	1.5	-2.5	9107.43	50.9
6.617	2201	2312.5	25.25	1.5	-2.5	9057.26	50.9
6.715	2157.5	2282.5	24.94	1.5	-2.5	8943.76	50.9
6.63	2182.5	2307.5	26.23	1.5	-2.5	8719.24	50.9
6.891	2192.5	2342.5	27.28	1.5	-2.5	8628.13	50.9
7.002	2202.5	2387.5	26.68	1.5	-2.5	8733.01	50.9
7.09	2247.5	2450.5	27.15	1.5	-2.5	8639.61	50.9
7.36	2247.5	2450.5	27.93	1.5	-2.5	8772.36	50.9
7.477	2277.5	2511.5	27.45	1.5	-2.5	8797.78	50.9
7.826	2290	2572.5	27.28	1.5	-2.5	8851.35	50.9
7.79	2242.5	2537.5	26.88	1.5	-7.8	8953.9	50.6
7.578	2187.5	2480.5	25.88	1.5	-7.8	8955.2	50.6
7.204	2172.5	2427.5	25.09	1.5	-7.8	9060.8	50.6
7.198	2173	2387.5	27.23	1.5	-7.8	8950.74	50.6
7.685	2237.5	2427.5	26.5	1.5	-7.8	8784.46	50.6
7.795	2241	2435.5	25.67	1.5	-7.8	8590.57	50.6
7.46	2197.5	2442.5	25.42	1.5	-7.8	8763.41	50.6
7.274	2174	2417.5	26.28	1.5	-7.8	8793.12	50.6
7.33	2217.5	2402.5	27.66	1.5	-7.8	8737.66	50.6
7.655	2155	2333.5	28.16	1.5	-7.8	8535.67	50.6
7.767	2194	2392.5	27.73	1.5	-7.8	8616.55	50.6
7.84	2187.5	2382.5	26.28	1.5	-7.8	8518.57	50.6
7.424	2107.5	2312.5	26.39	1.5	-7.8	8668.86	50.6
7.54	2095	2326.5	25.7	1.5	-7.8	8864.16	50.6
7.351	2067.5	2236.5	24.33	1.5	-7.8	8721.24	50.6
6.735	2031	2132.5	24.72	1.5	-7.8	8741.16	50.6
6.777	1957.5	2027.5	25.3	1.5	-7.8	8560.26	50.6
6.679	1867.5	1902.5	25.61	1.5	-7.8	8374.13	50.6
7.34	1995.5	2015	24.01	1.5	-7.8	8609.95	50.6
6.978	1960	2005	24.45	1.5	-7.8	8615.65	50.6
6.92	1926.5	2012.5	23.75	1.5	-7.8	8701.23	50.6
6.628	1872.5	1992.5	21.98	1.5	-7.8	8700.29	50.6
6.385	1877.5	1936.5	23.51	1.5	-9.4	8545.48	51.6
5.984	1876	1912.5	24.25	1.5	-9.4	8456.12	51.6
6.268	1831	1872.5	24.45	1.5	-9.4	8382.98	51.6
6.596	1862.5	1932.5	24.37	1.5	-9.4	8522.02	51.6
6.395	1892.5	1952.5	25.87	1.5	-9.4	8605.62	51.6
6.715	1947.5	1991.5	26.46	1.5	-9.4	8773.68	51.6
6.804	1908.5	1972.5	27.71	1.5	-9.4	8738.9	51.6
6.929	1967.5	2032.5	26.99	1.5	-9.4	8823.25	51.6
6.846	1912.5	2000.5	27.5	1.5	-9.4	8747.96	51.6
6.992	1922.5	2028.5	26.89	1.5	-9.4	8879.6	51.6
6.774	1897.5	1992.5	27.19	1.5	-9.4	8741.91	51.6
6.75	1869.5	1932.5	26.53	1.5	-9.4	8772.54	51.6
6.485	1851	1902.5	27.03	1.5	-9.4	8682.15	51.6
6.27	1762.5	1807.5	26.78	1.5	-9.4	8678.89	51.6
6.47	1803.5	1867.5	27.49	1.5	-9.4	8843.98	51.6
6.78	1873.5	1987.5	26.49	1.5	-9.4	8762.31	51.6
6.71	1868.5	1997.5	26.05	1.5	-9.4	8748.47	51.6
6.141	1862.5	1943.5	27.51	1.5	-9.4	8926.54	51.6
6.72	1919	1987.5	28	1.5	-9.4	9050.47	51.6
6.68	1947	2023.5	26.57	1.5	-9.4	8988.39	51.6
6.371	1962.5	2077.5	24.76	1.5	-9.4	8835.52	51.6
6.097	1922.5	2007.5	25.53	1.5	-10.4	8640.42	50.8
6.27	1942.5	2022.5	27.08	1.5	-10.4	8801.4	50.8
6.447	1946	2032.5	26.66	1.5	-10.4	8767.09	50.8
6.37	1951.5	2038.5	26.63	1.5	-10.4	8655.51	50.8
6.446	1937.5	2012.5	27.61	1.5	-10.4	8755.44	50.8
6.54	1986.5	2032.5	26.72	1.5	-10.4	8500.8	50.8
6.374	1946.5	1986	26.96	1.5	-10.4	8514.47	50.8
6.33	1877.5	1940	27.73	1.5	-10.4	8603.7	50.8
6.63	1907.5	1997.5	26.96	1.5	-10.4	8541.93	50.8
6.498	1947.5	2017.5	27.33	1.5	-10.4	8463.16	50.8
6.485	1937.5	2022	27.1	1.5	-10.4	8479.63	50.8
6.36	1936	2016.5	26.58	1.5	-10.4	8374.91	50.8




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 seconds
R Server'George Udny Yule' @ yule.wessa.net
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 & 'George Udny Yule' @ yule.wessa.net \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=154594&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]'George Udny Yule' @ yule.wessa.net[/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=154594&T=0

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







Confusion Matrix (predicted in columns / actuals in rows)
C1C2
C1776
C20108

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

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



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