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, 10 Dec 2013 08:48:39 -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/2013/Dec/10/t1386683344rvh2dtrhe93a5jq.htm/, Retrieved Fri, 29 Mar 2024 09:57:54 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=231953, Retrieved Fri, 29 Mar 2024 09:57:54 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact91
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 19:35:21] [b98453cac15ba1066b407e146608df68]
- R PD    [Recursive Partitioning (Regression Trees)] [WS10] [2013-12-10 13:48:39] [17f32cc89c421ada4d39615f3f325443] [Current]
-   P       [Recursive Partitioning (Regression Trees)] [Recursive partiti...] [2013-12-11 17:17:38] [947cbe24e101527daf12b807d6a22f40]
- RM          [Recursive Partitioning (Regression Trees)] [Recursive partiti...] [2013-12-11 17:22:52] [947cbe24e101527daf12b807d6a22f40]
-   P         [Recursive Partitioning (Regression Trees)] [Recurive] [2013-12-11 18:11:31] [947cbe24e101527daf12b807d6a22f40]
- RM            [Recursive Partitioning (Regression Trees)] [Recursive partiti...] [2013-12-11 18:12:05] [947cbe24e101527daf12b807d6a22f40]
Feedback Forum

Post a new message
Dataseries X:
1 119.992 157.302 74.997 0.00784 0.00007 0.0037 0.00554
1 122.4 148.65 113.819 0.00968 0.00008 0.00465 0.00696
1 116.682 131.111 111.555 0.0105 0.00009 0.00544 0.00781
1 116.676 137.871 111.366 0.00997 0.00009 0.00502 0.00698
1 116.014 141.781 110.655 0.01284 0.00011 0.00655 0.00908
1 120.552 131.162 113.787 0.00968 0.00008 0.00463 0.0075
1 120.267 137.244 114.82 0.00333 0.00003 0.00155 0.00202
1 107.332 113.84 104.315 0.0029 0.00003 0.00144 0.00182
1 95.73 132.068 91.754 0.00551 0.00006 0.00293 0.00332
1 95.056 120.103 91.226 0.00532 0.00006 0.00268 0.00332
1 88.333 112.24 84.072 0.00505 0.00006 0.00254 0.0033
1 91.904 115.871 86.292 0.0054 0.00006 0.00281 0.00336
1 136.926 159.866 131.276 0.00293 0.00002 0.00118 0.00153
1 139.173 179.139 76.556 0.0039 0.00003 0.00165 0.00208
1 152.845 163.305 75.836 0.00294 0.00002 0.00121 0.00149
1 142.167 217.455 83.159 0.00369 0.00003 0.00157 0.00203
1 144.188 349.259 82.764 0.00544 0.00004 0.00211 0.00292
1 168.778 232.181 75.603 0.00718 0.00004 0.00284 0.00387
1 153.046 175.829 68.623 0.00742 0.00005 0.00364 0.00432
1 156.405 189.398 142.822 0.00768 0.00005 0.00372 0.00399
1 153.848 165.738 65.782 0.0084 0.00005 0.00428 0.0045
1 153.88 172.86 78.128 0.0048 0.00003 0.00232 0.00267
1 167.93 193.221 79.068 0.00442 0.00003 0.0022 0.00247
1 173.917 192.735 86.18 0.00476 0.00003 0.00221 0.00258
1 163.656 200.841 76.779 0.00742 0.00005 0.0038 0.0039
1 104.4 206.002 77.968 0.00633 0.00006 0.00316 0.00375
1 171.041 208.313 75.501 0.00455 0.00003 0.0025 0.00234
1 146.845 208.701 81.737 0.00496 0.00003 0.0025 0.00275
1 155.358 227.383 80.055 0.0031 0.00002 0.00159 0.00176
1 162.568 198.346 77.63 0.00502 0.00003 0.0028 0.00253
0 197.076 206.896 192.055 0.00289 0.00001 0.00166 0.00168
0 199.228 209.512 192.091 0.00241 0.00001 0.00134 0.00138
0 198.383 215.203 193.104 0.00212 0.00001 0.00113 0.00135
0 202.266 211.604 197.079 0.0018 0.000009 0.00093 0.00107
0 203.184 211.526 196.16 0.00178 0.000009 0.00094 0.00106
0 201.464 210.565 195.708 0.00198 0.00001 0.00105 0.00115
1 177.876 192.921 168.013 0.00411 0.00002 0.00233 0.00241
1 176.17 185.604 163.564 0.00369 0.00002 0.00205 0.00218
1 180.198 201.249 175.456 0.00284 0.00002 0.00153 0.00166
1 187.733 202.324 173.015 0.00316 0.00002 0.00168 0.00182
1 186.163 197.724 177.584 0.00298 0.00002 0.00165 0.00175
1 184.055 196.537 166.977 0.00258 0.00001 0.00134 0.00147
0 237.226 247.326 225.227 0.00298 0.00001 0.00169 0.00182
0 241.404 248.834 232.483 0.00281 0.00001 0.00157 0.00173
0 243.439 250.912 232.435 0.0021 0.000009 0.00109 0.00137
0 242.852 255.034 227.911 0.00225 0.000009 0.00117 0.00139
0 245.51 262.09 231.848 0.00235 0.00001 0.00127 0.00148
0 252.455 261.487 182.786 0.00185 0.000007 0.00092 0.00113
0 122.188 128.611 115.765 0.00524 0.00004 0.00169 0.00203
0 122.964 130.049 114.676 0.00428 0.00003 0.00124 0.00155
0 124.445 135.069 117.495 0.00431 0.00003 0.00141 0.00167
0 126.344 134.231 112.773 0.00448 0.00004 0.00131 0.00169
0 128.001 138.052 122.08 0.00436 0.00003 0.00137 0.00166
0 129.336 139.867 118.604 0.0049 0.00004 0.00165 0.00183
1 108.807 134.656 102.874 0.00761 0.00007 0.00349 0.00486
1 109.86 126.358 104.437 0.00874 0.00008 0.00398 0.00539
1 110.417 131.067 103.37 0.00784 0.00007 0.00352 0.00514
1 117.274 129.916 110.402 0.00752 0.00006 0.00299 0.00469
1 116.879 131.897 108.153 0.00788 0.00007 0.00334 0.00493
1 114.847 271.314 104.68 0.00867 0.00008 0.00373 0.0052
0 209.144 237.494 109.379 0.00282 0.00001 0.00147 0.00152
0 223.365 238.987 98.664 0.00264 0.00001 0.00154 0.00151
0 222.236 231.345 205.495 0.00266 0.00001 0.00152 0.00144
0 228.832 234.619 223.634 0.00296 0.00001 0.00175 0.00155
0 229.401 252.221 221.156 0.00205 0.000009 0.00114 0.00113
0 228.969 239.541 113.201 0.00238 0.00001 0.00136 0.0014
1 140.341 159.774 67.021 0.00817 0.00006 0.0043 0.0044
1 136.969 166.607 66.004 0.00923 0.00007 0.00507 0.00463
1 143.533 162.215 65.809 0.01101 0.00008 0.00647 0.00467
1 148.09 162.824 67.343 0.00762 0.00005 0.00467 0.00354
1 142.729 162.408 65.476 0.00831 0.00006 0.00469 0.00419
1 136.358 176.595 65.75 0.00971 0.00007 0.00534 0.00478
1 120.08 139.71 111.208 0.00405 0.00003 0.0018 0.0022
1 112.014 588.518 107.024 0.00533 0.00005 0.00268 0.00329
1 110.793 128.101 107.316 0.00494 0.00004 0.0026 0.00283
1 110.707 122.611 105.007 0.00516 0.00005 0.00277 0.00289
1 112.876 148.826 106.981 0.005 0.00004 0.0027 0.00289
1 110.568 125.394 106.821 0.00462 0.00004 0.00226 0.0028
1 95.385 102.145 90.264 0.00608 0.00006 0.00331 0.00332
1 100.77 115.697 85.545 0.01038 0.0001 0.00622 0.00576
1 96.106 108.664 84.51 0.00694 0.00007 0.00389 0.00415
1 95.605 107.715 87.549 0.00702 0.00007 0.00428 0.00371
1 100.96 110.019 95.628 0.00606 0.00006 0.00351 0.00348
1 98.804 102.305 87.804 0.00432 0.00004 0.00247 0.00258
1 176.858 205.56 75.344 0.00747 0.00004 0.00418 0.0042
1 180.978 200.125 155.495 0.00406 0.00002 0.0022 0.00244
1 178.222 202.45 141.047 0.00321 0.00002 0.00163 0.00194
1 176.281 227.381 125.61 0.0052 0.00003 0.00287 0.00312
1 173.898 211.35 74.677 0.00448 0.00003 0.00237 0.00254
1 179.711 225.93 144.878 0.00709 0.00004 0.00391 0.00419
1 166.605 206.008 78.032 0.00742 0.00004 0.00387 0.00453
1 151.955 163.335 147.226 0.00419 0.00003 0.00224 0.00227
1 148.272 164.989 142.299 0.00459 0.00003 0.0025 0.00256
1 152.125 161.469 76.596 0.00382 0.00003 0.00191 0.00226
1 157.821 172.975 68.401 0.00358 0.00002 0.00196 0.00196
1 157.447 163.267 149.605 0.00369 0.00002 0.00201 0.00197
1 159.116 168.913 144.811 0.00342 0.00002 0.00178 0.00184
1 125.036 143.946 116.187 0.0128 0.0001 0.00743 0.00623
1 125.791 140.557 96.206 0.01378 0.00011 0.00826 0.00655
1 126.512 141.756 99.77 0.01936 0.00015 0.01159 0.0099
1 125.641 141.068 116.346 0.03316 0.00026 0.02144 0.01522
1 128.451 150.449 75.632 0.01551 0.00012 0.00905 0.00909
1 139.224 586.567 66.157 0.03011 0.00022 0.01854 0.01628
1 150.258 154.609 75.349 0.00248 0.00002 0.00105 0.00136
1 154.003 160.267 128.621 0.00183 0.00001 0.00076 0.001
1 149.689 160.368 133.608 0.00257 0.00002 0.00116 0.00134
1 155.078 163.736 144.148 0.00168 0.00001 0.00068 0.00092
1 151.884 157.765 133.751 0.00258 0.00002 0.00115 0.00122
1 151.989 157.339 132.857 0.00174 0.00001 0.00075 0.00096
1 193.03 208.9 80.297 0.00766 0.00004 0.0045 0.00389
1 200.714 223.982 89.686 0.00621 0.00003 0.00371 0.00337
1 208.519 220.315 199.02 0.00609 0.00003 0.00368 0.00339
1 204.664 221.3 189.621 0.00841 0.00004 0.00502 0.00485
1 210.141 232.706 185.258 0.00534 0.00003 0.00321 0.0028
1 206.327 226.355 92.02 0.00495 0.00002 0.00302 0.00246
1 151.872 492.892 69.085 0.00856 0.00006 0.00404 0.00385
1 158.219 442.557 71.948 0.00476 0.00003 0.00214 0.00207
1 170.756 450.247 79.032 0.00555 0.00003 0.00244 0.00261
1 178.285 442.824 82.063 0.00462 0.00003 0.00157 0.00194
1 217.116 233.481 93.978 0.00404 0.00002 0.00127 0.00128
1 128.94 479.697 88.251 0.00581 0.00005 0.00241 0.00314
1 176.824 215.293 83.961 0.0046 0.00003 0.00209 0.00221
1 138.19 203.522 83.34 0.00704 0.00005 0.00406 0.00398
1 182.018 197.173 79.187 0.00842 0.00005 0.00506 0.00449
1 156.239 195.107 79.82 0.00694 0.00004 0.00403 0.00395
1 145.174 198.109 80.637 0.00733 0.00005 0.00414 0.00422
1 138.145 197.238 81.114 0.00544 0.00004 0.00294 0.00327
1 166.888 198.966 79.512 0.00638 0.00004 0.00368 0.00351
1 119.031 127.533 109.216 0.0044 0.00004 0.00214 0.00192
1 120.078 126.632 105.667 0.0027 0.00002 0.00116 0.00135
1 120.289 128.143 100.209 0.00492 0.00004 0.00269 0.00238
1 120.256 125.306 104.773 0.00407 0.00003 0.00224 0.00205
1 119.056 125.213 86.795 0.00346 0.00003 0.00169 0.0017
1 118.747 123.723 109.836 0.00331 0.00003 0.00168 0.00171
1 106.516 112.777 93.105 0.00589 0.00006 0.00291 0.00319
1 110.453 127.611 105.554 0.00494 0.00004 0.00244 0.00315
1 113.4 133.344 107.816 0.00451 0.00004 0.00219 0.00283
1 113.166 130.27 100.673 0.00502 0.00004 0.00257 0.00312
1 112.239 126.609 104.095 0.00472 0.00004 0.00238 0.0029
1 116.15 131.731 109.815 0.00381 0.00003 0.00181 0.00232
1 170.368 268.796 79.543 0.00571 0.00003 0.00232 0.00269
1 208.083 253.792 91.802 0.00757 0.00004 0.00428 0.00428
1 198.458 219.29 148.691 0.00376 0.00002 0.00182 0.00215
1 202.805 231.508 86.232 0.0037 0.00002 0.00189 0.00211
1 202.544 241.35 164.168 0.00254 0.00001 0.001 0.00133
1 223.361 263.872 87.638 0.00352 0.00002 0.00169 0.00188
1 169.774 191.759 151.451 0.01568 0.00009 0.00863 0.00946
1 183.52 216.814 161.34 0.01466 0.00008 0.00849 0.00819
1 188.62 216.302 165.982 0.01719 0.00009 0.00996 0.01027
1 202.632 565.74 177.258 0.01627 0.00008 0.00919 0.00963
1 186.695 211.961 149.442 0.01872 0.0001 0.01075 0.01154
1 192.818 224.429 168.793 0.03107 0.00016 0.018 0.01958
1 198.116 233.099 174.478 0.02714 0.00014 0.01568 0.01699
1 121.345 139.644 98.25 0.00684 0.00006 0.00388 0.00332
1 119.1 128.442 88.833 0.00692 0.00006 0.00393 0.003
1 117.87 127.349 95.654 0.00647 0.00005 0.00356 0.003
1 122.336 142.369 94.794 0.00727 0.00006 0.00415 0.00339
1 117.963 134.209 100.757 0.01813 0.00015 0.01117 0.00718
1 126.144 154.284 97.543 0.00975 0.00008 0.00593 0.00454
1 127.93 138.752 112.173 0.00605 0.00005 0.00321 0.00318
1 114.238 124.393 77.022 0.00581 0.00005 0.00299 0.00316
1 115.322 135.738 107.802 0.00619 0.00005 0.00352 0.00329
1 114.554 126.778 91.121 0.00651 0.00006 0.00366 0.0034
1 112.15 131.669 97.527 0.00519 0.00005 0.00291 0.00284
1 102.273 142.83 85.902 0.00907 0.00009 0.00493 0.00461
0 236.2 244.663 102.137 0.00277 0.00001 0.00154 0.00153
0 237.323 243.709 229.256 0.00303 0.00001 0.00173 0.00159
0 260.105 264.919 237.303 0.00339 0.00001 0.00205 0.00186
0 197.569 217.627 90.794 0.00803 0.00004 0.0049 0.00448
0 240.301 245.135 219.783 0.00517 0.00002 0.00316 0.00283
0 244.99 272.21 239.17 0.00451 0.00002 0.00279 0.00237
0 112.547 133.374 105.715 0.00355 0.00003 0.00166 0.0019
0 110.739 113.597 100.139 0.00356 0.00003 0.0017 0.002
0 113.715 116.443 96.913 0.00349 0.00003 0.00171 0.00203
0 117.004 144.466 99.923 0.00353 0.00003 0.00176 0.00218
0 115.38 123.109 108.634 0.00332 0.00003 0.0016 0.00199
0 116.388 129.038 108.97 0.00346 0.00003 0.00169 0.00213
1 151.737 190.204 129.859 0.00314 0.00002 0.00135 0.00162
1 148.79 158.359 138.99 0.00309 0.00002 0.00152 0.00186
1 148.143 155.982 135.041 0.00392 0.00003 0.00204 0.00231
1 150.44 163.441 144.736 0.00396 0.00003 0.00206 0.00233
1 148.462 161.078 141.998 0.00397 0.00003 0.00202 0.00235
1 149.818 163.417 144.786 0.00336 0.00002 0.00174 0.00198
0 117.226 123.925 106.656 0.00417 0.00004 0.00186 0.0027
0 116.848 217.552 99.503 0.00531 0.00005 0.0026 0.00346
0 116.286 177.291 96.983 0.00314 0.00003 0.00134 0.00192
0 116.556 592.03 86.228 0.00496 0.00004 0.00254 0.00263
0 116.342 581.289 94.246 0.00267 0.00002 0.00115 0.00148
0 114.563 119.167 86.647 0.00327 0.00003 0.00146 0.00184
0 201.774 262.707 78.228 0.00694 0.00003 0.00412 0.00396
0 174.188 230.978 94.261 0.00459 0.00003 0.00263 0.00259
0 209.516 253.017 89.488 0.00564 0.00003 0.00331 0.00292
0 174.688 240.005 74.287 0.0136 0.00008 0.00624 0.00564
0 198.764 396.961 74.904 0.0074 0.00004 0.0037 0.0039
0 214.289 260.277 77.973 0.00567 0.00003 0.00295 0.00317




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time8 seconds
R Server'George Udny Yule' @ yule.wessa.net
R Engine error message
Error in rep.int(0, ydim) : invalid 'times' value
Calls: plot ... mosaicplot.default -> mosaic.cell -> Recall -> mosaic.cell -> rep.int
Execution halted

\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 & 8 seconds \tabularnewline
R Server & 'George Udny Yule' @ yule.wessa.net \tabularnewline
R Engine error message & 
Error in rep.int(0, ydim) : invalid 'times' value
Calls: plot ... mosaicplot.default -> mosaic.cell -> Recall -> mosaic.cell -> rep.int
Execution halted
\tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=231953&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]8 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'George Udny Yule' @ yule.wessa.net[/C][/ROW]
[ROW][C]R Engine error message[/C][C]
Error in rep.int(0, ydim) : invalid 'times' value
Calls: plot ... mosaicplot.default -> mosaic.cell -> Recall -> mosaic.cell -> rep.int
Execution halted
[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=231953&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=231953&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 time8 seconds
R Server'George Udny Yule' @ yule.wessa.net
R Engine error message
Error in rep.int(0, ydim) : invalid 'times' value
Calls: plot ... mosaicplot.default -> mosaic.cell -> Recall -> mosaic.cell -> rep.int
Execution halted



Parameters (Session):
par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
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')
}