Home » date » 2010 » Dec » 21 »

workshop 10 recursive partitioning

*The author of this computation has been verified*
R Software Module: /rwasp_regression_trees1.wasp (opens new window with default values)
Title produced by software: Recursive Partitioning (Regression Trees)
Date of computation: Tue, 21 Dec 2010 13:09:51 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj.htm/, Retrieved Tue, 21 Dec 2010 14:08:44 +0100
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj.htm/},
    year = {2010},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2010},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
162556 807 213118 6282154 29790 444 81767 4321023 87550 412 153198 4111912 84738 428 -26007 223193 54660 315 126942 1491348 42634 168 157214 1629616 40949 263 129352 1398893 45187 267 234817 1926517 37704 228 60448 983660 16275 129 47818 1443586 25830 104 245546 1073089 12679 122 48020 984885 18014 393 -1710 1405225 43556 190 32648 227132 24811 280 95350 929118 6575 63 151352 1071292 7123 102 288170 638830 21950 265 114337 856956 37597 234 37884 992426 17821 277 122844 444477 12988 73 82340 857217 22330 67 79801 711969 13326 103 165548 702380 16189 290 116384 358589 7146 83 134028 297978 15824 56 63838 585715 27664 236 74996 657954 11920 73 31080 209458 8568 34 32168 786690 14416 139 49857 439798 3369 26 87161 688779 11819 70 106113 574339 6984 40 80570 741409 4519 42 102129 597793 2220 12 301670 644190 18562 211 102313 377934 10327 74 88577 640273 5336 80 112477 697458 2365 83 191778 550608 4069 131 79804 207393 8636 203 128294 301607 13718 56 96448 345783 4525 89 93 etc...
 
Output produced by software:

Enter (or paste) a matrix (table) containing all data (time) series. Every column represents a different variable and must be delimited by a space or Tab. Every row represents a period in time (or category) and must be delimited by hard returns. The easiest way to enter data is to copy and paste a block of spreadsheet cells. Please, do not use commas or spaces to seperate groups of digits!


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time21 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Goodness of Fit
Correlation0.8561
R-squared0.733
RMSE38.4445


Actuals, Predictions, and Residuals
#ActualsForecastsResiduals
1807369.571428571429437.428571428571
2444233.375210.625
3412369.57142857142942.4285714285714
4428369.57142857142958.4285714285714
5315369.571428571429-54.5714285714286
6168369.571428571429-201.571428571429
7263233.37529.625
8267369.571428571429-102.571428571429
9228233.375-5.375
10129233.375-104.375
11104233.375-129.375
1212277.836734693877544.1632653061225
13393233.375159.625
14190369.571428571429-179.571428571429
15280233.37546.625
166377.8367346938775-14.8367346938775
1710277.836734693877524.1632653061225
18265233.37531.625
19234233.3750.625
20277233.37543.625
217377.8367346938775-4.83673469387755
2267233.375-166.375
2310377.836734693877525.1632653061225
24290233.37556.625
258377.83673469387755.16326530612245
265677.8367346938775-21.8367346938775
27236233.3752.625
287377.8367346938775-4.83673469387755
293477.8367346938775-43.8367346938775
3013977.836734693877561.1632653061225
312638.0735294117647-12.0735294117647
327077.8367346938775-7.83673469387755
334077.8367346938775-37.8367346938775
344277.8367346938775-35.8367346938775
351238.0735294117647-26.0735294117647
36211233.375-22.375
377477.8367346938775-3.83673469387755
388077.83673469387752.16326530612245
398338.073529411764744.9264705882353
4013177.836734693877553.1632653061225
4120377.8367346938775125.163265306122
425677.8367346938775-21.8367346938775
438977.836734693877511.1632653061225
448877.836734693877510.1632653061225
453977.8367346938775-38.8367346938775
462538.0735294117647-13.0735294117647
474977.8367346938775-28.8367346938775
4814977.836734693877571.1632653061225
495877.8367346938775-19.8367346938775
504138.07352941176472.9264705882353
519038.073529411764751.9264705882353
5213677.836734693877558.1632653061225
539777.836734693877519.1632653061225
546320.823529411764742.1764705882353
5511477.836734693877536.1632653061225
567738.073529411764738.9264705882353
57638.0735294117647-32.0735294117647
584777.8367346938775-30.8367346938775
595138.073529411764712.9264705882353
608577.83673469387757.16326530612245
614377.8367346938775-34.8367346938775
623238.0735294117647-6.0735294117647
632538.0735294117647-13.0735294117647
647777.8367346938775-0.836734693877546
655438.073529411764715.9264705882353
6625177.8367346938775173.163265306122
671511.80869565217393.19130434782609
684438.07352941176475.9264705882353
697338.073529411764734.9264705882353
708577.83673469387757.16326530612245
714938.073529411764710.9264705882353
723877.8367346938775-39.8367346938775
733538.0735294117647-3.0735294117647
74911.8086956521739-2.80869565217391
753438.0735294117647-4.0735294117647
762038.0735294117647-18.0735294117647
772920.82352941176478.1764705882353
781111.8086956521739-0.808695652173913
795238.073529411764713.9264705882353
801311.80869565217391.19130434782609
812938.0735294117647-9.0735294117647
826677.8367346938775-11.8367346938775
833320.823529411764712.1764705882353
841511.80869565217393.19130434782609
851520.8235294117647-5.82352941176471
866877.8367346938775-9.83673469387755
8710038.073529411764761.9264705882353
881320.8235294117647-7.8235294117647
894538.07352941176476.9264705882353
901420.8235294117647-6.82352941176471
913638.0735294117647-2.07352941176470
924038.07352941176471.92647058823530
936838.073529411764729.9264705882353
942977.8367346938775-48.8367346938775
954338.07352941176474.9264705882353
963038.0735294117647-8.0735294117647
97920.8235294117647-11.8235294117647
982238.0735294117647-16.0735294117647
991938.0735294117647-19.0735294117647
100938.0735294117647-29.0735294117647
1013111.808695652173919.1913043478261
1021911.80869565217397.19130434782609
1035538.073529411764716.9264705882353
104811.8086956521739-3.80869565217391
1052838.0735294117647-10.0735294117647
1062911.808695652173917.1913043478261
1074838.07352941176479.9264705882353
1081638.0735294117647-22.0735294117647
1094777.8367346938775-30.8367346938775
1102038.0735294117647-18.0735294117647
1112220.82352941176471.17647058823529
1123338.0735294117647-5.0735294117647
1134477.8367346938775-33.8367346938775
1141338.0735294117647-25.0735294117647
115638.0735294117647-32.0735294117647
1163538.0735294117647-3.0735294117647
117811.8086956521739-3.80869565217391
1181738.0735294117647-21.0735294117647
1191138.0735294117647-27.0735294117647
1202111.80869565217399.19130434782609
1219277.836734693877514.1632653061225
1221211.80869565217390.191304347826087
12311238.073529411764773.9264705882353
1242538.0735294117647-13.0735294117647
1251738.0735294117647-21.0735294117647
1262338.0735294117647-15.0735294117647
12700.170940170940171-0.170940170940171
128104.928571428571435.07142857142857
1292311.808695652173911.1913043478261
13000.170940170940171-0.170940170940171
13174.928571428571432.07142857142857
1322538.0735294117647-13.0735294117647
13310.1709401709401710.829059829059829
134204.9285714285714315.0714285714286
135411.8086956521739-7.80869565217391
136411.8086956521739-7.80869565217391
137104.928571428571435.07142857142857
13814.92857142857143-3.92857142857143
139411.8086956521739-7.80869565217391
14000.170940170940171-0.170940170940171
141811.8086956521739-3.80869565217391
14200.170940170940171-0.170940170940171
1431111.8086956521739-0.808695652173913
14444.92857142857143-0.92857142857143
1451511.80869565217393.19130434782609
146911.8086956521739-2.80869565217391
14700.170940170940171-0.170940170940171
14874.928571428571432.07142857142857
149211.8086956521739-9.80869565217391
15004.92857142857143-4.92857142857143
151711.8086956521739-4.80869565217391
1524638.07352941176477.9264705882353
15350.1709401709401714.82905982905983
154711.8086956521739-4.80869565217391
15524.92857142857143-2.92857142857143
15600.170940170940171-0.170940170940171
15700.170940170940171-0.170940170940171
15824.92857142857143-2.92857142857143
159511.8086956521739-6.80869565217391
16000.170940170940171-0.170940170940171
16100.170940170940171-0.170940170940171
16200.170940170940171-0.170940170940171
16300.170940170940171-0.170940170940171
164711.8086956521739-4.80869565217391
1652411.808695652173912.1913043478261
16614.92857142857143-3.92857142857143
16700.170940170940171-0.170940170940171
1681820.8235294117647-2.82352941176471
1695577.8367346938775-22.8367346938775
17000.170940170940171-0.170940170940171
17100.170940170940171-0.170940170940171
17234.92857142857143-1.92857142857143
17300.170940170940171-0.170940170940171
174911.8086956521739-2.80869565217391
17500.170940170940171-0.170940170940171
176811.8086956521739-3.80869565217391
17711311.8086956521739101.191304347826
17804.92857142857143-4.92857142857143
17900.170940170940171-0.170940170940171
18000.170940170940171-0.170940170940171
1811920.8235294117647-1.82352941176471
1821111.8086956521739-0.808695652173913
1832538.0735294117647-13.0735294117647
1841611.80869565217394.19130434782609
18554.928571428571430.0714285714285712
1861111.8086956521739-0.808695652173913
1872338.0735294117647-15.0735294117647
188611.8086956521739-5.80869565217391
189511.8086956521739-6.80869565217391
19000.170940170940171-0.170940170940171
191711.8086956521739-4.80869565217391
19200.170940170940171-0.170940170940171
193711.8086956521739-4.80869565217391
19400.170940170940171-0.170940170940171
19534.92857142857143-1.92857142857143
19600.170940170940171-0.170940170940171
1978977.836734693877511.1632653061225
19800.170940170940171-0.170940170940171
19900.170940170940171-0.170940170940171
2001911.80869565217397.19130434782609
20100.170940170940171-0.170940170940171
20200.170940170940171-0.170940170940171
20300.170940170940171-0.170940170940171
2041211.80869565217390.191304347826087
2051211.80869565217390.191304347826087
20654.928571428571430.0714285714285712
20724.92857142857143-2.92857142857143
20800.170940170940171-0.170940170940171
2092620.82352941176475.17647058823529
210311.8086956521739-8.80869565217391
21100.170940170940171-0.170940170940171
21200.170940170940171-0.170940170940171
2131111.8086956521739-0.808695652173913
2141011.8086956521739-1.80869565217391
215511.8086956521739-6.80869565217391
21620.1709401709401711.82905982905983
21764.928571428571431.07142857142857
218711.8086956521739-4.80869565217391
21920.1709401709401711.82905982905983
2202838.0735294117647-10.0735294117647
221311.8086956521739-8.80869565217391
22200.170940170940171-0.170940170940171
22314.92857142857143-3.92857142857143
2242011.80869565217398.19130434782609
22514.92857142857143-3.92857142857143
2262211.808695652173910.1913043478261
22794.928571428571434.07142857142857
22800.170940170940171-0.170940170940171
229211.8086956521739-9.80869565217391
23000.170940170940171-0.170940170940171
231711.8086956521739-4.80869565217391
232911.8086956521739-2.80869565217391
23300.170940170940171-0.170940170940171
2341311.80869565217391.19130434782609
23500.170940170940171-0.170940170940171
23604.92857142857143-4.92857142857143
23700.170940170940171-0.170940170940171
23864.928571428571431.07142857142857
23900.170940170940171-0.170940170940171
24000.170940170940171-0.170940170940171
24100.170940170940171-0.170940170940171
24234.92857142857143-1.92857142857143
24300.170940170940171-0.170940170940171
24474.928571428571432.07142857142857
245238.0735294117647-36.0735294117647
24600.170940170940171-0.170940170940171
24700.170940170940171-0.170940170940171
2481511.80869565217393.19130434782609
24900.170940170940171-0.170940170940171
25000.170940170940171-0.170940170940171
251911.8086956521739-2.80869565217391
25200.170940170940171-0.170940170940171
253111.8086956521739-10.8086956521739
2543811.808695652173926.1913043478261
2555738.073529411764718.9264705882353
25600.170940170940171-0.170940170940171
257711.8086956521739-4.80869565217391
2582611.808695652173914.1913043478261
25900.170940170940171-0.170940170940171
26000.170940170940171-0.170940170940171
26100.170940170940171-0.170940170940171
26200.170940170940171-0.170940170940171
2631320.8235294117647-7.8235294117647
2641011.8086956521739-1.80869565217391
26500.170940170940171-0.170940170940171
26600.170940170940171-0.170940170940171
26700.170940170940171-0.170940170940171
268920.8235294117647-11.8235294117647
26900.170940170940171-0.170940170940171
2702611.808695652173914.1913043478261
27100.170940170940171-0.170940170940171
27200.170940170940171-0.170940170940171
27300.170940170940171-0.170940170940171
2741911.80869565217397.19130434782609
27500.170940170940171-0.170940170940171
2761211.80869565217390.191304347826087
2772311.808695652173911.1913043478261
27800.170940170940171-0.170940170940171
2792938.0735294117647-9.0735294117647
280811.8086956521739-3.80869565217391
28100.170940170940171-0.170940170940171
28200.170940170940171-0.170940170940171
2832611.808695652173914.1913043478261
28400.170940170940171-0.170940170940171
285911.8086956521739-2.80869565217391
28600.170940170940171-0.170940170940171
287511.8086956521739-6.80869565217391
28834.92857142857143-1.92857142857143
28900.170940170940171-0.170940170940171
2901311.80869565217391.19130434782609
29100.170940170940171-0.170940170940171
2921211.80869565217390.191304347826087
2931920.8235294117647-1.82352941176471
29400.170940170940171-0.170940170940171
295104.928571428571435.07142857142857
296911.8086956521739-2.80869565217391
29700.170940170940171-0.170940170940171
29800.170940170940171-0.170940170940171
29900.170940170940171-0.170940170940171
30090.1709401709401718.82905982905983
30144.92857142857143-0.92857142857143
302111.8086956521739-10.8086956521739
30310.1709401709401710.829059829059829
30400.170940170940171-0.170940170940171
3051420.8235294117647-6.82352941176471
306124.928571428571437.07142857142857
30700.170940170940171-0.170940170940171
3081911.80869565217397.19130434782609
3091711.80869565217395.19130434782609
31000.170940170940171-0.170940170940171
31100.170940170940171-0.170940170940171
3123220.823529411764711.1764705882353
31300.170940170940171-0.170940170940171
314144.928571428571439.07142857142857
31584.928571428571433.07142857142857
316411.8086956521739-7.80869565217391
31704.92857142857143-4.92857142857143
3182011.80869565217398.19130434782609
31954.928571428571430.0714285714285712
32000.170940170940171-0.170940170940171
32100.170940170940171-0.170940170940171
32200.170940170940171-0.170940170940171
32300.170940170940171-0.170940170940171
32400.170940170940171-0.170940170940171
32500.170940170940171-0.170940170940171
32614.92857142857143-3.92857142857143
32700.170940170940171-0.170940170940171
32800.170940170940171-0.170940170940171
32900.170940170940171-0.170940170940171
33000.170940170940171-0.170940170940171
33100.170940170940171-0.170940170940171
33200.170940170940171-0.170940170940171
33300.170940170940171-0.170940170940171
33444.92857142857143-0.92857142857143
33514.92857142857143-3.92857142857143
336411.8086956521739-7.80869565217391
3372011.80869565217398.19130434782609
33800.170940170940171-0.170940170940171
33914.92857142857143-3.92857142857143
3401011.8086956521739-1.80869565217391
3411211.80869565217390.191304347826087
34200.170940170940171-0.170940170940171
34300.170940170940171-0.170940170940171
34400.170940170940171-0.170940170940171
3451311.80869565217391.19130434782609
34600.170940170940171-0.170940170940171
34734.92857142857143-1.92857142857143
34800.170940170940171-0.170940170940171
34900.170940170940171-0.170940170940171
3501038.0735294117647-28.0735294117647
351311.8086956521739-8.80869565217391
35274.928571428571432.07142857142857
3531011.8086956521739-1.80869565217391
354111.8086956521739-10.8086956521739
35500.170940170940171-0.170940170940171
35600.170940170940171-0.170940170940171
3571511.80869565217393.19130434782609
35800.170940170940171-0.170940170940171
35900.170940170940171-0.170940170940171
36000.170940170940171-0.170940170940171
36144.92857142857143-0.92857142857143
36200.170940170940171-0.170940170940171
36300.170940170940171-0.170940170940171
3642838.0735294117647-10.0735294117647
365911.8086956521739-2.80869565217391
36600.170940170940171-0.170940170940171
36700.170940170940171-0.170940170940171
36800.170940170940171-0.170940170940171
36900.170940170940171-0.170940170940171
370711.8086956521739-4.80869565217391
37100.170940170940171-0.170940170940171
372711.8086956521739-4.80869565217391
373711.8086956521739-4.80869565217391
374311.8086956521739-8.80869565217391
37500.170940170940171-0.170940170940171
37600.170940170940171-0.170940170940171
3771111.8086956521739-0.808695652173913
378711.8086956521739-4.80869565217391
3791038.0735294117647-28.0735294117647
38000.170940170940171-0.170940170940171
38100.170940170940171-0.170940170940171
3821811.80869565217396.19130434782609
3831411.80869565217392.19130434782609
38400.170940170940171-0.170940170940171
385124.928571428571437.07142857142857
3862938.0735294117647-9.0735294117647
387311.8086956521739-8.80869565217391
388611.8086956521739-5.80869565217391
38934.92857142857143-1.92857142857143
390811.8086956521739-3.80869565217391
3911011.8086956521739-1.80869565217391
392611.8086956521739-5.80869565217391
393811.8086956521739-3.80869565217391
394620.8235294117647-14.8235294117647
395938.0735294117647-29.0735294117647
396811.8086956521739-3.80869565217391
3972677.8367346938775-51.8367346938775
39823938.0735294117647200.926470588235
399711.8086956521739-4.80869565217391
4004138.07352941176472.9264705882353
401311.8086956521739-8.80869565217391
402811.8086956521739-3.80869565217391
403611.8086956521739-5.80869565217391
4042138.0735294117647-17.0735294117647
405711.8086956521739-4.80869565217391
4061111.8086956521739-0.808695652173913
4071111.8086956521739-0.808695652173913
4081211.80869565217390.191304347826087
409911.8086956521739-2.80869565217391
410311.8086956521739-8.80869565217391
4115738.073529411764718.9264705882353
4122177.8367346938775-56.8367346938775
4131511.80869565217393.19130434782609
4143238.0735294117647-6.0735294117647
4151138.0735294117647-27.0735294117647
416211.8086956521739-9.80869565217391
4172338.0735294117647-15.0735294117647
4182011.80869565217398.19130434782609
4192411.808695652173912.1913043478261
420111.8086956521739-10.8086956521739
421111.8086956521739-10.8086956521739
4227438.073529411764735.9264705882353
4236877.8367346938775-9.83673469387755
4242077.8367346938775-57.8367346938775
4252038.0735294117647-18.0735294117647
4268277.83673469387754.16326530612245
4272138.0735294117647-17.0735294117647
428244233.37510.625
4293277.8367346938775-45.8367346938775
4308677.83673469387758.16326530612245
43169233.375-164.375
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj/2f4bw1292936969.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj/2f4bw1292936969.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj/3f4bw1292936969.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj/3f4bw1292936969.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj/4qdsz1292936969.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292936920xq9tyjhwz2q2fzj/4qdsz1292936969.ps (open in new window)


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





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by