R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(1 + ,-4.813031 + ,0.266482 + ,0.02211 + ,21.033 + ,0.815285 + ,1 + ,-4.075192 + ,0.33559 + ,0.01929 + ,19.085 + ,0.819521 + ,1 + ,-4.443179 + ,0.311173 + ,0.01309 + ,20.651 + ,0.825288 + ,1 + ,-4.117501 + ,0.334147 + ,0.01353 + ,20.644 + ,0.819235 + ,1 + ,-3.747787 + ,0.234513 + ,0.01767 + ,19.649 + ,0.823484 + ,1 + ,-4.242867 + ,0.299111 + ,0.01222 + ,21.378 + ,0.825069 + ,1 + ,-5.634322 + ,0.257682 + ,0.00607 + ,24.886 + ,0.764112 + ,1 + ,-6.167603 + ,0.183721 + ,0.00344 + ,26.892 + ,0.763262 + ,1 + ,-5.498678 + ,0.327769 + ,0.0107 + ,21.812 + ,0.773587 + ,1 + ,-5.011879 + ,0.325996 + ,0.01022 + ,21.862 + ,0.798463 + ,1 + ,-5.24977 + ,0.391002 + ,0.01166 + ,21.118 + ,0.776156 + ,1 + ,-4.960234 + ,0.363566 + ,0.01141 + ,21.414 + ,0.79252 + ,1 + ,-6.547148 + ,0.152813 + ,0.00581 + ,25.703 + ,0.646846 + ,1 + ,-5.660217 + ,0.254989 + ,0.01041 + ,24.889 + ,0.665833 + ,1 + ,-6.105098 + ,0.203653 + ,0.00609 + ,24.922 + ,0.654027 + ,1 + ,-5.340115 + ,0.210185 + ,0.00839 + ,25.175 + ,0.658245 + ,1 + ,-5.44004 + ,0.239764 + ,0.01859 + ,22.333 + ,0.644692 + ,1 + ,-2.93107 + ,0.434326 + ,0.02919 + ,20.376 + ,0.605417 + ,1 + ,-3.949079 + ,0.35787 + ,0.0316 + ,17.28 + ,0.719467 + ,1 + ,-4.554466 + ,0.340176 + ,0.03365 + ,17.153 + ,0.68608 + ,1 + ,-4.095442 + ,0.262564 + ,0.03871 + ,17.536 + ,0.704087 + ,1 + ,-5.18696 + ,0.237622 + ,0.01849 + ,19.493 + ,0.698951 + ,1 + ,-4.330956 + ,0.262384 + ,0.0128 + ,22.468 + ,0.679834 + ,1 + ,-5.248776 + ,0.210279 + ,0.0184 + ,20.422 + ,0.686894 + ,1 + ,-5.557447 + ,0.22089 + ,0.01778 + ,23.831 + ,0.732479 + ,1 + ,-5.571843 + ,0.236853 + ,0.02887 + ,22.066 + ,0.737948 + ,1 + ,-6.18359 + ,0.226278 + ,0.01095 + ,25.908 + ,0.720916 + ,1 + ,-6.27169 + ,0.196102 + ,0.01328 + ,25.119 + ,0.726652 + ,1 + ,-7.120925 + ,0.279789 + ,0.00677 + ,25.97 + ,0.676258 + ,1 + ,-6.635729 + ,0.209866 + ,0.0117 + ,25.678 + ,0.723797 + ,0 + ,-7.3483 + ,0.177551 + ,0.00339 + ,26.775 + ,0.741367 + ,0 + ,-7.682587 + ,0.173319 + ,0.00167 + ,30.94 + ,0.742055 + ,0 + ,-7.067931 + ,0.175181 + ,0.00119 + ,30.775 + ,0.738703 + ,0 + ,-7.695734 + ,0.17854 + ,0.00072 + ,32.684 + ,0.742133 + ,0 + ,-7.964984 + ,0.163519 + ,0.00065 + ,33.047 + ,0.741899 + ,0 + ,-7.777685 + ,0.170183 + ,0.00135 + ,31.732 + ,0.742737 + ,1 + ,-6.149653 + ,0.218037 + ,0.00586 + ,23.216 + ,0.778834 + ,1 + ,-6.006414 + ,0.196371 + ,0.0034 + ,24.951 + ,0.783626 + ,1 + ,-6.452058 + ,0.212294 + ,0.00231 + ,26.738 + ,0.766209 + ,1 + ,-6.006647 + ,0.266892 + ,0.00265 + ,26.31 + ,0.758324 + ,1 + ,-6.647379 + ,0.201095 + ,0.00231 + ,26.822 + ,0.765623 + ,1 + ,-7.044105 + ,0.063412 + ,0.00257 + ,26.453 + ,0.759203 + ,0 + ,-7.31055 + ,0.098648 + ,0.0074 + ,22.736 + ,0.654172 + ,0 + ,-6.793547 + ,0.158266 + ,0.00675 + ,23.145 + ,0.634267 + ,0 + ,-7.057869 + ,0.091608 + ,0.00454 + ,25.368 + ,0.635285 + ,0 + ,-6.99582 + ,0.102083 + ,0.00476 + ,25.032 + ,0.638928 + ,0 + ,-7.156076 + ,0.127642 + ,0.00476 + ,24.602 + ,0.631653 + ,0 + ,-7.31951 + ,0.200873 + ,0.00432 + ,26.805 + ,0.635204 + ,0 + ,-6.439398 + ,0.266392 + ,0.00839 + ,23.162 + ,0.733659 + ,0 + ,-6.482096 + ,0.264967 + ,0.00462 + ,24.971 + ,0.754073 + ,0 + ,-6.650471 + ,0.254498 + ,0.00479 + ,25.135 + ,0.775933 + ,0 + ,-6.689151 + ,0.291954 + ,0.00474 + ,25.03 + ,0.760361 + ,0 + ,-7.072419 + ,0.220434 + ,0.00481 + ,24.692 + ,0.766204 + ,0 + ,-6.836811 + ,0.269866 + ,0.00484 + ,25.429 + ,0.785714 + ,1 + ,-4.649573 + ,0.205558 + ,0.01036 + ,21.028 + ,0.819032 + ,1 + ,-4.333543 + ,0.221727 + ,0.0118 + ,20.767 + ,0.811843 + ,1 + ,-4.438453 + ,0.238298 + ,0.00969 + ,21.422 + ,0.821364 + ,1 + ,-4.60826 + ,0.290024 + ,0.00681 + ,22.817 + ,0.817756 + ,1 + ,-4.476755 + ,0.262633 + ,0.00786 + ,22.603 + ,0.813432 + ,1 + ,-4.609161 + ,0.221711 + ,0.01143 + ,21.66 + ,0.817396 + ,0 + ,-7.040508 + ,0.066994 + ,0.00871 + ,25.554 + ,0.678874 + ,0 + ,-7.293801 + ,0.086372 + ,0.00301 + ,26.138 + ,0.686264 + ,0 + ,-6.966321 + ,0.095882 + ,0.0034 + ,25.856 + ,0.694399 + ,0 + ,-7.24562 + ,0.018689 + ,0.00351 + ,25.964 + ,0.683296 + ,0 + ,-7.496264 + ,0.056844 + ,0.003 + ,26.415 + ,0.673636 + ,0 + ,-7.314237 + ,0.006274 + ,0.0042 + ,24.547 + ,0.681811 + ,1 + ,-5.409423 + ,0.22685 + ,0.02183 + ,19.56 + ,0.720908 + ,1 + ,-5.324574 + ,0.20566 + ,0.02659 + ,19.979 + ,0.729067 + ,1 + ,-5.86975 + ,0.151814 + ,0.04882 + ,20.338 + ,0.731444 + ,1 + ,-6.261141 + ,0.120956 + ,0.02431 + ,21.718 + ,0.727313 + ,1 + ,-5.720868 + ,0.15883 + ,0.02599 + ,20.264 + ,0.730387 + ,1 + ,-5.207985 + ,0.224852 + ,0.03361 + ,18.57 + ,0.733232 + ,1 + ,-5.79182 + ,0.329066 + ,0.00442 + ,25.742 + ,0.762959 + ,1 + ,-5.389129 + ,0.306636 + ,0.00623 + ,24.178 + ,0.789532 + ,1 + ,-5.31336 + ,0.201861 + ,0.00479 + ,25.438 + ,0.815908 + ,1 + ,-5.477592 + ,0.315074 + ,0.00472 + ,25.197 + ,0.807217 + ,1 + ,-5.775966 + ,0.341169 + ,0.00905 + ,23.37 + ,0.789977 + ,1 + ,-5.391029 + ,0.250572 + ,0.0042 + ,25.82 + ,0.81634 + ,1 + ,-5.115212 + ,0.249494 + ,0.01062 + ,21.875 + ,0.779612 + ,1 + ,-4.913885 + ,0.265699 + ,0.0222 + ,19.2 + ,0.790117 + ,1 + ,-4.441519 + ,0.155097 + ,0.01823 + ,19.055 + ,0.770466 + ,1 + ,-5.132032 + ,0.210458 + ,0.01825 + ,19.659 + ,0.778747 + ,1 + ,-5.022288 + ,0.146948 + ,0.01237 + ,20.536 + ,0.787896 + ,1 + ,-6.025367 + ,0.078202 + ,0.00882 + ,22.244 + ,0.772416 + ,1 + ,-5.288912 + ,0.343073 + ,0.0547 + ,13.893 + ,0.729586 + ,1 + ,-5.657899 + ,0.315903 + ,0.02782 + ,16.176 + ,0.727747 + ,1 + ,-6.366916 + ,0.335753 + ,0.03151 + ,15.924 + ,0.712199 + ,1 + ,-5.515071 + ,0.299549 + ,0.04824 + ,13.922 + ,0.740837 + ,1 + ,-5.783272 + ,0.299793 + ,0.04214 + ,14.739 + ,0.743937 + ,1 + ,-4.379411 + ,0.375531 + ,0.07223 + ,11.866 + ,0.745526 + ,1 + ,-4.508984 + ,0.389232 + ,0.08725 + ,11.744 + ,0.733165 + ,1 + ,-6.411497 + ,0.207156 + ,0.01658 + ,19.664 + ,0.71436 + ,1 + ,-5.952058 + ,0.08784 + ,0.01914 + ,18.78 + ,0.734504 + ,1 + ,-6.152551 + ,0.17352 + ,0.01211 + ,20.969 + ,0.69779 + ,1 + ,-6.251425 + ,0.188056 + ,0.0085 + ,22.219 + ,0.71217 + ,1 + ,-6.247076 + ,0.180528 + ,0.01018 + ,21.693 + ,0.705658 + ,1 + ,-6.41744 + ,0.194627 + ,0.00852 + ,22.663 + ,0.693429 + ,1 + ,-4.020042 + ,0.265315 + ,0.08151 + ,15.338 + ,0.714485 + ,1 + ,-5.159169 + ,0.202146 + ,0.10323 + ,15.433 + ,0.690892 + ,1 + ,-3.760348 + ,0.242861 + ,0.16744 + ,12.435 + ,0.674953 + ,1 + ,-3.700544 + ,0.260481 + ,0.31482 + ,8.867 + ,0.656846 + ,1 + ,-4.20273 + ,0.310163 + ,0.11843 + ,15.06 + ,0.643327 + ,1 + ,-3.269487 + ,0.270641 + ,0.2593 + ,10.489 + ,0.641418 + ,1 + ,-6.878393 + ,0.089267 + ,0.00495 + ,26.759 + ,0.722356 + ,1 + ,-7.111576 + ,0.14478 + ,0.00243 + ,28.409 + ,0.691483 + ,1 + ,-6.997403 + ,0.210279 + ,0.00578 + ,27.421 + ,0.719974 + ,1 + ,-6.981201 + ,0.18455 + ,0.00233 + ,29.746 + ,0.67793 + ,1 + ,-6.600023 + ,0.249172 + ,0.00659 + ,26.833 + ,0.700246 + ,1 + ,-6.739151 + ,0.160686 + ,0.00238 + ,29.928 + ,0.676066 + ,1 + ,-5.845099 + ,0.278679 + ,0.00947 + ,21.934 + ,0.740539 + ,1 + ,-5.25832 + ,0.256454 + ,0.00704 + ,23.239 + ,0.727863 + ,1 + ,-6.471427 + ,0.184378 + ,0.0083 + ,22.407 + ,0.712466 + ,1 + ,-4.876336 + ,0.212054 + ,0.01316 + ,21.305 + ,0.722085 + ,1 + ,-5.96304 + ,0.250283 + ,0.0062 + ,23.671 + ,0.722254 + ,1 + ,-6.729713 + ,0.181701 + ,0.01048 + ,21.864 + ,0.715121 + ,1 + ,-4.673241 + ,0.261549 + ,0.06051 + ,23.693 + ,0.662668 + ,1 + ,-6.051233 + ,0.27328 + ,0.01554 + ,26.356 + ,0.653823 + ,1 + ,-4.597834 + ,0.372114 + ,0.01802 + ,25.69 + ,0.676023 + ,1 + ,-4.913137 + ,0.393056 + ,0.00856 + ,25.02 + ,0.655239 + ,1 + ,-5.517173 + ,0.389295 + ,0.00681 + ,24.581 + ,0.58271 + ,1 + ,-6.186128 + ,0.279933 + ,0.0235 + ,24.743 + ,0.68413 + ,1 + ,-4.711007 + ,0.281618 + ,0.01161 + ,27.166 + ,0.656182 + ,1 + ,-5.418787 + ,0.160267 + ,0.01968 + ,18.305 + ,0.74148 + ,1 + ,-5.44514 + ,0.142466 + ,0.01813 + ,18.784 + ,0.732903 + ,1 + ,-5.944191 + ,0.143359 + ,0.0202 + ,19.196 + ,0.728421 + ,1 + ,-5.594275 + ,0.12795 + ,0.01874 + ,18.857 + ,0.735546 + ,1 + ,-5.540351 + ,0.087165 + ,0.01794 + ,18.178 + ,0.738245 + ,1 + ,-5.825257 + ,0.115697 + ,0.01796 + ,18.33 + ,0.736964 + ,1 + ,-6.890021 + ,0.152941 + ,0.01724 + ,26.842 + ,0.699787 + ,1 + ,-5.892061 + ,0.195976 + ,0.00487 + ,26.369 + ,0.718839 + ,1 + ,-6.135296 + ,0.20363 + ,0.0161 + ,23.949 + ,0.724045 + ,1 + ,-6.112667 + ,0.217013 + ,0.01015 + ,26.017 + ,0.735136 + ,1 + ,-5.436135 + ,0.254909 + ,0.00903 + ,23.389 + ,0.721308 + ,1 + ,-6.448134 + ,0.178713 + ,0.00504 + ,25.619 + ,0.723096 + ,1 + ,-5.301321 + ,0.320385 + ,0.03031 + ,17.06 + ,0.744064 + ,1 + ,-5.333619 + ,0.322044 + ,0.02529 + ,17.707 + ,0.706687 + ,1 + ,-4.378916 + ,0.300067 + ,0.02278 + ,19.013 + ,0.708144 + ,1 + ,-4.654894 + ,0.304107 + ,0.0369 + ,16.747 + ,0.708617 + ,1 + ,-5.634576 + ,0.306014 + ,0.02629 + ,17.366 + ,0.701404 + ,1 + ,-5.866357 + ,0.23307 + ,0.01827 + ,18.801 + ,0.696049 + ,1 + ,-4.796845 + ,0.397749 + ,0.02485 + ,18.54 + ,0.685057 + ,1 + ,-5.410336 + ,0.288917 + ,0.04238 + ,15.648 + ,0.665945 + ,1 + ,-5.585259 + ,0.310746 + ,0.01728 + ,18.702 + ,0.661735 + ,1 + ,-5.898673 + ,0.213353 + ,0.0201 + ,18.687 + ,0.632631 + ,1 + ,-6.132663 + ,0.220617 + ,0.01049 + ,20.68 + ,0.630409 + ,1 + ,-5.456811 + ,0.345238 + ,0.01493 + ,20.366 + ,0.574282 + ,1 + ,-3.297668 + ,0.414758 + ,0.0753 + ,12.359 + ,0.793509 + ,1 + ,-4.276605 + ,0.355736 + ,0.06057 + ,14.367 + ,0.768974 + ,1 + ,-3.377325 + ,0.335357 + ,0.08069 + ,12.298 + ,0.764036 + ,1 + ,-4.892495 + ,0.262281 + ,0.07889 + ,14.989 + ,0.775708 + ,1 + ,-4.484303 + ,0.340256 + ,0.10952 + ,12.529 + ,0.762726 + ,1 + ,-2.434031 + ,0.450493 + ,0.21713 + ,8.441 + ,0.76832 + ,1 + ,-2.839756 + ,0.356224 + ,0.16265 + ,9.449 + ,0.754449 + ,1 + ,-4.865194 + ,0.246404 + ,0.04179 + ,21.52 + ,0.670475 + ,1 + ,-4.239028 + ,0.175691 + ,0.04611 + ,21.824 + ,0.659333 + ,1 + ,-3.583722 + ,0.207914 + ,0.02631 + ,22.431 + ,0.652025 + ,1 + ,-5.4351 + ,0.230532 + ,0.03191 + ,22.953 + ,0.623731 + ,1 + ,-3.444478 + ,0.303214 + ,0.10748 + ,19.075 + ,0.646786 + ,1 + ,-5.070096 + ,0.280091 + ,0.03828 + ,21.534 + ,0.627337 + ,1 + ,-5.498456 + ,0.234196 + ,0.02663 + ,19.651 + ,0.675865 + ,1 + ,-5.185987 + ,0.259229 + ,0.02073 + ,20.437 + ,0.694571 + ,1 + ,-5.283009 + ,0.226528 + ,0.0281 + ,19.388 + ,0.684373 + ,1 + ,-5.529833 + ,0.24275 + ,0.02707 + ,18.954 + ,0.719576 + ,1 + ,-5.617124 + ,0.184896 + ,0.01435 + ,21.219 + ,0.673086 + ,1 + ,-2.929379 + ,0.396746 + ,0.03882 + ,18.447 + ,0.674562 + ,0 + ,-6.816086 + ,0.17227 + ,0.0062 + ,24.078 + ,0.628232 + ,0 + ,-7.018057 + ,0.176316 + ,0.00533 + ,24.679 + ,0.62671 + ,0 + ,-7.517934 + ,0.160414 + ,0.0091 + ,21.083 + ,0.628058 + ,0 + ,-5.736781 + ,0.164529 + ,0.01337 + ,19.269 + ,0.725216 + ,0 + ,-7.169701 + ,0.073298 + ,0.00965 + ,21.02 + ,0.646167 + ,0 + ,-7.3045 + ,0.171088 + ,0.01049 + ,21.528 + ,0.646818 + ,0 + ,-6.323531 + ,0.218885 + ,0.00435 + ,26.436 + ,0.7567 + ,0 + ,-6.085567 + ,0.192375 + ,0.0043 + ,26.55 + ,0.776158 + ,0 + ,-5.943501 + ,0.19215 + ,0.00478 + ,26.547 + ,0.7667 + ,0 + ,-6.012559 + ,0.229298 + ,0.0059 + ,25.445 + ,0.756482 + ,0 + ,-5.966779 + ,0.197938 + ,0.00401 + ,26.005 + ,0.761255 + ,0 + ,-6.016891 + ,0.109256 + ,0.00415 + ,26.143 + ,0.763242 + ,1 + ,-6.486822 + ,0.197919 + ,0.0057 + ,24.151 + ,0.745957 + ,1 + ,-6.311987 + ,0.182459 + ,0.00488 + ,24.412 + ,0.762508 + ,1 + ,-5.711205 + ,0.240875 + ,0.0054 + ,23.683 + ,0.778349 + ,1 + ,-6.261446 + ,0.183218 + ,0.00611 + ,23.133 + ,0.75932 + ,1 + ,-5.704053 + ,0.216204 + ,0.00639 + ,22.866 + ,0.768845 + ,1 + ,-6.27717 + ,0.109397 + ,0.00595 + ,23.008 + ,0.75718 + ,0 + ,-5.61907 + ,0.191576 + ,0.00955 + ,23.079 + ,0.669565 + ,0 + ,-5.198864 + ,0.206768 + ,0.01179 + ,22.085 + ,0.656516 + ,0 + ,-5.592584 + ,0.133917 + ,0.00737 + ,24.199 + ,0.654331 + ,0 + ,-6.431119 + ,0.15331 + ,0.01397 + ,23.958 + ,0.667654 + ,0 + ,-6.359018 + ,0.116636 + ,0.0068 + ,25.023 + ,0.663884 + ,0 + ,-6.710219 + ,0.149694 + ,0.00703 + ,24.775 + ,0.659132 + ,0 + ,-6.934474 + ,0.15989 + ,0.04441 + ,19.368 + ,0.683761 + ,0 + ,-6.538586 + ,0.121952 + ,0.02764 + ,19.517 + ,0.657899 + ,0 + ,-6.195325 + ,0.129303 + ,0.0181 + ,19.147 + ,0.683244 + ,0 + ,-6.787197 + ,0.158453 + ,0.10715 + ,17.883 + ,0.655683 + ,0 + ,-6.744577 + ,0.207454 + ,0.07223 + ,19.02 + ,0.643956 + ,0 + ,-5.724056 + ,0.190667 + ,0.04398 + ,21.209 + ,0.664357) + ,dim=c(6 + ,195) + ,dimnames=list(c('status' + ,'spread1' + ,'spread2' + ,'NHR' + ,'HNR' + ,'DFA') + ,1:195)) > y <- array(NA,dim=c(6,195),dimnames=list(c('status','spread1','spread2','NHR','HNR','DFA'),1:195)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '1' > par4 <- 'no' > par3 <- '3' > par2 <- 'none' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., 2012, Recursive Partitioning (Regression Trees) (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_regression_trees.wasp/ > #Source of accompanying publication: > # > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). Attaching package: 'Hmisc' The following object is masked from 'package:survival': untangle.specials The following objects are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "status" > x[,par1] [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 [38] 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 [186] 0 0 0 0 0 0 0 0 0 0 > 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]) 0 1 48 147 > colnames(x) [1] "status" "spread1" "spread2" "NHR" "HNR" "DFA" > colnames(x)[par1] [1] "status" > x[,par1] [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 [38] 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 [186] 0 0 0 0 0 0 0 0 0 0 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/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="/var/wessaorg/rcomp/tmp/1w0z41386339585.tab") + } + } > m Conditional inference tree with 3 terminal nodes Response: status Inputs: spread1, spread2, NHR, HNR, DFA Number of observations: 195 1) spread1 <= -6.650471; criterion = 1, statistic = 61.894 2)* weights = 40 1) spread1 > -6.650471 3) spread2 <= 0.192375; criterion = 0.999, statistic = 13.619 4)* weights = 36 3) spread2 > 0.192375 5)* weights = 119 > postscript(file="/var/wessaorg/rcomp/tmp/23b4u1386339585.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3h09g1386339585.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > 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) + } Actuals Forecasts Residuals 1 1 0.9495798 0.05042017 2 1 0.9495798 0.05042017 3 1 0.9495798 0.05042017 4 1 0.9495798 0.05042017 5 1 0.9495798 0.05042017 6 1 0.9495798 0.05042017 7 1 0.9495798 0.05042017 8 1 0.6944444 0.30555556 9 1 0.9495798 0.05042017 10 1 0.9495798 0.05042017 11 1 0.9495798 0.05042017 12 1 0.9495798 0.05042017 13 1 0.6944444 0.30555556 14 1 0.9495798 0.05042017 15 1 0.9495798 0.05042017 16 1 0.9495798 0.05042017 17 1 0.9495798 0.05042017 18 1 0.9495798 0.05042017 19 1 0.9495798 0.05042017 20 1 0.9495798 0.05042017 21 1 0.9495798 0.05042017 22 1 0.9495798 0.05042017 23 1 0.9495798 0.05042017 24 1 0.9495798 0.05042017 25 1 0.9495798 0.05042017 26 1 0.9495798 0.05042017 27 1 0.9495798 0.05042017 28 1 0.9495798 0.05042017 29 1 0.2250000 0.77500000 30 1 0.9495798 0.05042017 31 0 0.2250000 -0.22500000 32 0 0.2250000 -0.22500000 33 0 0.2250000 -0.22500000 34 0 0.2250000 -0.22500000 35 0 0.2250000 -0.22500000 36 0 0.2250000 -0.22500000 37 1 0.9495798 0.05042017 38 1 0.9495798 0.05042017 39 1 0.9495798 0.05042017 40 1 0.9495798 0.05042017 41 1 0.9495798 0.05042017 42 1 0.2250000 0.77500000 43 0 0.2250000 -0.22500000 44 0 0.2250000 -0.22500000 45 0 0.2250000 -0.22500000 46 0 0.2250000 -0.22500000 47 0 0.2250000 -0.22500000 48 0 0.2250000 -0.22500000 49 0 0.9495798 -0.94957983 50 0 0.9495798 -0.94957983 51 0 0.2250000 -0.22500000 52 0 0.2250000 -0.22500000 53 0 0.2250000 -0.22500000 54 0 0.2250000 -0.22500000 55 1 0.9495798 0.05042017 56 1 0.9495798 0.05042017 57 1 0.9495798 0.05042017 58 1 0.9495798 0.05042017 59 1 0.9495798 0.05042017 60 1 0.9495798 0.05042017 61 0 0.2250000 -0.22500000 62 0 0.2250000 -0.22500000 63 0 0.2250000 -0.22500000 64 0 0.2250000 -0.22500000 65 0 0.2250000 -0.22500000 66 0 0.2250000 -0.22500000 67 1 0.9495798 0.05042017 68 1 0.9495798 0.05042017 69 1 0.6944444 0.30555556 70 1 0.6944444 0.30555556 71 1 0.6944444 0.30555556 72 1 0.9495798 0.05042017 73 1 0.9495798 0.05042017 74 1 0.9495798 0.05042017 75 1 0.9495798 0.05042017 76 1 0.9495798 0.05042017 77 1 0.9495798 0.05042017 78 1 0.9495798 0.05042017 79 1 0.9495798 0.05042017 80 1 0.9495798 0.05042017 81 1 0.6944444 0.30555556 82 1 0.9495798 0.05042017 83 1 0.6944444 0.30555556 84 1 0.6944444 0.30555556 85 1 0.9495798 0.05042017 86 1 0.9495798 0.05042017 87 1 0.9495798 0.05042017 88 1 0.9495798 0.05042017 89 1 0.9495798 0.05042017 90 1 0.9495798 0.05042017 91 1 0.9495798 0.05042017 92 1 0.9495798 0.05042017 93 1 0.6944444 0.30555556 94 1 0.6944444 0.30555556 95 1 0.6944444 0.30555556 96 1 0.6944444 0.30555556 97 1 0.9495798 0.05042017 98 1 0.9495798 0.05042017 99 1 0.9495798 0.05042017 100 1 0.9495798 0.05042017 101 1 0.9495798 0.05042017 102 1 0.9495798 0.05042017 103 1 0.9495798 0.05042017 104 1 0.2250000 0.77500000 105 1 0.2250000 0.77500000 106 1 0.2250000 0.77500000 107 1 0.2250000 0.77500000 108 1 0.9495798 0.05042017 109 1 0.2250000 0.77500000 110 1 0.9495798 0.05042017 111 1 0.9495798 0.05042017 112 1 0.6944444 0.30555556 113 1 0.9495798 0.05042017 114 1 0.9495798 0.05042017 115 1 0.2250000 0.77500000 116 1 0.9495798 0.05042017 117 1 0.9495798 0.05042017 118 1 0.9495798 0.05042017 119 1 0.9495798 0.05042017 120 1 0.9495798 0.05042017 121 1 0.9495798 0.05042017 122 1 0.9495798 0.05042017 123 1 0.6944444 0.30555556 124 1 0.6944444 0.30555556 125 1 0.6944444 0.30555556 126 1 0.6944444 0.30555556 127 1 0.6944444 0.30555556 128 1 0.6944444 0.30555556 129 1 0.2250000 0.77500000 130 1 0.9495798 0.05042017 131 1 0.9495798 0.05042017 132 1 0.9495798 0.05042017 133 1 0.9495798 0.05042017 134 1 0.6944444 0.30555556 135 1 0.9495798 0.05042017 136 1 0.9495798 0.05042017 137 1 0.9495798 0.05042017 138 1 0.9495798 0.05042017 139 1 0.9495798 0.05042017 140 1 0.9495798 0.05042017 141 1 0.9495798 0.05042017 142 1 0.9495798 0.05042017 143 1 0.9495798 0.05042017 144 1 0.9495798 0.05042017 145 1 0.9495798 0.05042017 146 1 0.9495798 0.05042017 147 1 0.9495798 0.05042017 148 1 0.9495798 0.05042017 149 1 0.9495798 0.05042017 150 1 0.9495798 0.05042017 151 1 0.9495798 0.05042017 152 1 0.9495798 0.05042017 153 1 0.9495798 0.05042017 154 1 0.9495798 0.05042017 155 1 0.6944444 0.30555556 156 1 0.9495798 0.05042017 157 1 0.9495798 0.05042017 158 1 0.9495798 0.05042017 159 1 0.9495798 0.05042017 160 1 0.9495798 0.05042017 161 1 0.9495798 0.05042017 162 1 0.9495798 0.05042017 163 1 0.9495798 0.05042017 164 1 0.6944444 0.30555556 165 1 0.9495798 0.05042017 166 0 0.2250000 -0.22500000 167 0 0.2250000 -0.22500000 168 0 0.2250000 -0.22500000 169 0 0.6944444 -0.69444444 170 0 0.2250000 -0.22500000 171 0 0.2250000 -0.22500000 172 0 0.9495798 -0.94957983 173 0 0.6944444 -0.69444444 174 0 0.6944444 -0.69444444 175 0 0.9495798 -0.94957983 176 0 0.9495798 -0.94957983 177 0 0.6944444 -0.69444444 178 1 0.9495798 0.05042017 179 1 0.6944444 0.30555556 180 1 0.9495798 0.05042017 181 1 0.6944444 0.30555556 182 1 0.9495798 0.05042017 183 1 0.6944444 0.30555556 184 0 0.6944444 -0.69444444 185 0 0.9495798 -0.94957983 186 0 0.6944444 -0.69444444 187 0 0.6944444 -0.69444444 188 0 0.6944444 -0.69444444 189 0 0.2250000 -0.22500000 190 0 0.2250000 -0.22500000 191 0 0.6944444 -0.69444444 192 0 0.6944444 -0.69444444 193 0 0.2250000 -0.22500000 194 0 0.2250000 -0.22500000 195 0 0.6944444 -0.69444444 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/wessaorg/rcomp/tmp/4e7yl1386339585.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > 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() null device 1 > 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="/var/wessaorg/rcomp/tmp/5v75t1386339586.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="/var/wessaorg/rcomp/tmp/60hiq1386339586.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="/var/wessaorg/rcomp/tmp/7dbp81386339586.tab") + } > > try(system("convert tmp/23b4u1386339585.ps tmp/23b4u1386339585.png",intern=TRUE)) character(0) > try(system("convert tmp/3h09g1386339585.ps tmp/3h09g1386339585.png",intern=TRUE)) character(0) > try(system("convert tmp/4e7yl1386339585.ps tmp/4e7yl1386339585.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 9.234 1.800 11.001