R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(210907 + ,1 + ,1 + ,24188 + ,145 + ,120982 + ,1 + ,1 + ,18273 + ,101 + ,176508 + ,1 + ,1 + ,14130 + ,98 + ,179321 + ,1 + ,0 + ,32287 + ,132 + ,123185 + ,1 + ,1 + ,8654 + ,60 + ,52746 + ,1 + ,1 + ,9245 + ,38 + ,385534 + ,1 + ,1 + ,33251 + ,144 + ,33170 + ,1 + ,1 + ,1271 + ,5 + ,101645 + ,1 + ,1 + ,5279 + ,28 + ,149061 + ,1 + ,1 + ,27101 + ,84 + ,165446 + ,1 + ,0 + ,16373 + ,79 + ,237213 + ,1 + ,1 + ,19716 + ,127 + ,173326 + ,1 + ,0 + ,17753 + ,78 + ,133131 + ,1 + ,1 + ,9028 + ,60 + ,258873 + ,1 + ,1 + ,18653 + ,131 + ,180083 + ,1 + ,0 + ,8828 + ,84 + ,324799 + ,1 + ,0 + ,29498 + ,133 + ,230964 + ,1 + ,1 + ,27563 + ,150 + ,236785 + ,1 + ,0 + ,18293 + ,91 + ,135473 + ,1 + ,1 + ,22530 + ,132 + ,202925 + ,1 + ,0 + ,15977 + ,136 + ,215147 + ,1 + ,1 + ,35082 + ,124 + ,344297 + ,1 + ,1 + ,16116 + ,118 + ,153935 + ,1 + ,1 + ,15849 + ,70 + ,132943 + ,1 + ,0 + ,16026 + ,107 + ,174724 + ,1 + ,1 + ,26569 + ,119 + ,174415 + ,1 + ,0 + ,24785 + ,89 + ,225548 + ,1 + ,1 + ,17569 + ,112 + ,223632 + ,1 + ,1 + ,23825 + ,108 + ,124817 + ,1 + ,0 + ,7869 + ,52 + ,221698 + ,1 + ,1 + ,14975 + ,112 + ,210767 + ,1 + ,0 + ,37791 + ,116 + ,170266 + ,1 + ,1 + ,9605 + ,123 + ,260561 + ,1 + ,1 + ,27295 + ,125 + ,84853 + ,1 + ,0 + ,2746 + ,27 + ,294424 + ,1 + ,0 + ,34461 + ,162 + ,101011 + ,1 + ,0 + ,8098 + ,32 + ,215641 + ,1 + ,0 + ,4787 + ,64 + ,325107 + ,1 + ,1 + ,24919 + ,92 + ,7176 + ,1 + ,0 + ,603 + ,0 + ,167542 + ,1 + ,0 + ,16329 + ,83 + ,106408 + ,1 + ,1 + ,12558 + ,41 + ,96560 + ,1 + ,0 + ,7784 + ,47 + ,265769 + ,1 + ,0 + ,28522 + ,120 + ,269651 + ,1 + ,1 + ,22265 + ,105 + ,149112 + ,1 + ,1 + ,14459 + ,79 + ,175824 + ,1 + ,1 + ,14526 + ,65 + ,152871 + ,1 + ,1 + ,22240 + ,70 + ,111665 + ,1 + ,1 + ,11802 + ,55 + ,116408 + ,1 + ,0 + ,7623 + ,39 + ,362301 + ,1 + ,1 + ,11912 + ,67 + ,78800 + ,1 + ,0 + ,7935 + ,21 + ,183167 + ,1 + ,0 + ,18220 + ,127 + ,277965 + ,1 + ,1 + ,19199 + ,152 + ,150629 + ,1 + ,0 + ,19918 + ,113 + ,168809 + ,1 + ,1 + ,21884 + ,99 + ,24188 + ,1 + ,1 + ,2694 + ,7 + ,329267 + ,1 + ,1 + ,15808 + ,141 + ,65029 + ,1 + ,0 + ,3597 + ,21 + ,101097 + ,1 + ,1 + ,5296 + ,35 + ,218946 + ,1 + ,0 + ,25239 + ,109 + ,244052 + ,1 + ,0 + ,29801 + ,133 + ,341570 + ,1 + ,1 + ,18450 + ,123 + ,103597 + ,1 + ,1 + ,7132 + ,26 + ,233328 + ,1 + ,1 + ,34861 + ,230 + ,256462 + ,1 + ,0 + ,35940 + ,166 + ,206161 + ,1 + ,1 + ,16688 + ,68 + ,311473 + ,1 + ,0 + ,24683 + ,147 + ,235800 + ,1 + ,1 + ,46230 + ,179 + ,177939 + ,1 + ,0 + ,10387 + ,61 + ,207176 + ,1 + ,0 + ,21436 + ,101 + ,196553 + ,1 + ,1 + ,30546 + ,108 + ,174184 + ,1 + ,1 + ,19746 + ,90 + ,143246 + ,1 + ,0 + ,15977 + ,114 + ,187559 + ,1 + ,0 + ,22583 + ,103 + ,187681 + ,1 + ,1 + ,17274 + ,142 + ,119016 + ,1 + ,1 + ,16469 + ,79 + ,182192 + ,1 + ,1 + ,14251 + ,88 + ,73566 + ,1 + ,0 + ,3007 + ,25 + ,194979 + ,1 + ,0 + ,16851 + ,83 + ,167488 + ,1 + ,0 + ,21113 + ,113 + ,143756 + ,1 + ,1 + ,17401 + ,118 + ,275541 + ,1 + ,0 + ,23958 + ,110 + ,243199 + ,1 + ,1 + ,23567 + ,129 + ,182999 + ,1 + ,1 + ,13065 + ,51 + ,135649 + ,1 + ,0 + ,15358 + ,93 + ,152299 + ,1 + ,1 + ,14587 + ,76 + ,120221 + ,1 + ,1 + ,12770 + ,49 + ,346485 + ,1 + ,1 + ,24021 + ,118 + ,145790 + ,1 + ,1 + ,9648 + ,38 + ,193339 + ,1 + ,1 + ,20537 + ,141 + ,80953 + ,1 + ,1 + ,7905 + ,58 + ,122774 + ,1 + ,1 + ,4527 + ,27 + ,130585 + ,1 + ,1 + ,30495 + ,91 + ,112611 + ,1 + ,1 + ,7117 + ,48 + ,286468 + ,1 + ,1 + ,17719 + ,63 + ,241066 + ,1 + ,1 + ,27056 + ,56 + ,148446 + ,1 + ,0 + ,33473 + ,144 + ,204713 + ,1 + ,0 + ,9758 + ,73 + ,182079 + ,1 + ,1 + ,21115 + ,168 + ,140344 + ,1 + ,0 + ,7236 + ,64 + ,220516 + ,1 + ,1 + ,13790 + ,97 + ,243060 + ,1 + ,0 + ,32902 + ,117 + ,162765 + ,1 + ,1 + ,25131 + ,100 + ,182613 + ,1 + ,0 + ,30910 + ,149 + ,232138 + ,1 + ,1 + ,35947 + ,187 + ,265318 + ,1 + ,0 + ,29848 + ,127 + ,85574 + ,1 + ,0 + ,6943 + ,37 + ,310839 + ,1 + ,1 + ,42705 + ,245 + ,225060 + ,1 + ,1 + ,31808 + ,87 + ,232317 + ,1 + ,1 + ,26675 + ,177 + ,144966 + ,1 + ,1 + ,8435 + ,49 + ,43287 + ,1 + ,1 + ,7409 + ,49 + ,155754 + ,1 + ,0 + ,14993 + ,73 + ,164709 + ,1 + ,1 + ,36867 + ,177 + ,201940 + ,1 + ,1 + ,33835 + ,94 + ,235454 + ,1 + ,1 + ,24164 + ,117 + ,220801 + ,1 + ,1 + ,12607 + ,60 + ,99466 + ,1 + ,0 + ,22609 + ,55 + ,92661 + ,1 + ,1 + ,5892 + ,39 + ,133328 + ,1 + ,1 + ,17014 + ,64 + ,61361 + ,1 + ,1 + ,5394 + ,26 + ,125930 + ,1 + ,1 + ,9178 + ,64 + ,100750 + ,1 + ,1 + ,6440 + ,58 + ,224549 + ,1 + ,0 + ,21916 + ,95 + ,82316 + ,1 + ,1 + ,4011 + ,25 + ,102010 + ,1 + ,1 + ,5818 + ,26 + ,101523 + ,1 + ,1 + ,18647 + ,76 + ,243511 + ,1 + ,0 + ,20556 + ,129 + ,22938 + ,1 + ,0 + ,238 + ,11 + ,41566 + ,1 + ,1 + ,70 + ,2 + ,152474 + ,1 + ,0 + ,22392 + ,101 + ,61857 + ,1 + ,0 + ,3913 + ,28 + ,99923 + ,1 + ,1 + ,12237 + ,36 + ,132487 + ,1 + ,0 + ,8388 + ,89 + ,317394 + ,1 + ,0 + ,22120 + ,193 + ,21054 + ,1 + ,1 + ,338 + ,4 + ,209641 + ,1 + ,1 + ,11727 + ,84 + ,22648 + ,1 + ,0 + ,3704 + ,23 + ,31414 + ,1 + ,1 + ,3988 + ,39 + ,46698 + ,1 + ,0 + ,3030 + ,14 + ,131698 + ,1 + ,1 + ,13520 + ,78 + ,91735 + ,1 + ,0 + ,1421 + ,14 + ,244749 + ,1 + ,1 + ,20923 + ,101 + ,184510 + ,1 + ,1 + ,20237 + ,82 + ,79863 + ,1 + ,0 + ,3219 + ,24 + ,128423 + ,1 + ,0 + ,3769 + ,36 + ,97839 + ,1 + ,0 + ,12252 + ,75 + ,38214 + ,1 + ,1 + ,1888 + ,16 + ,151101 + ,1 + ,1 + ,14497 + ,55 + ,272458 + ,1 + ,0 + ,28864 + ,131 + ,172494 + ,1 + ,1 + ,21721 + ,131 + ,108043 + ,1 + ,1 + ,4821 + ,39 + ,328107 + ,1 + ,1 + ,33644 + ,144 + ,250579 + ,1 + ,1 + ,15923 + ,139 + ,351067 + ,1 + ,1 + ,42935 + ,211 + ,158015 + ,1 + ,1 + ,18864 + ,78 + ,98866 + ,1 + ,1 + ,4977 + ,50 + ,85439 + ,0 + ,0 + ,7785 + ,39 + ,229242 + ,0 + ,0 + ,17939 + ,90 + ,351619 + ,0 + ,0 + ,23436 + ,166 + ,84207 + ,0 + ,1 + ,325 + ,12 + ,120445 + ,0 + ,0 + ,13539 + ,57 + ,324598 + ,0 + ,0 + ,34538 + ,133 + ,131069 + ,0 + ,1 + ,12198 + ,69 + ,204271 + ,0 + ,1 + ,26924 + ,119 + ,165543 + ,0 + ,0 + ,12716 + ,119 + ,141722 + ,0 + ,0 + ,8172 + ,65 + ,116048 + ,0 + ,1 + ,10855 + ,61 + ,250047 + ,0 + ,0 + ,11932 + ,49 + ,299775 + ,0 + ,1 + ,14300 + ,101 + ,195838 + ,0 + ,1 + ,25515 + ,196 + ,173260 + ,0 + ,0 + ,2805 + ,15 + ,254488 + ,0 + ,1 + ,29402 + ,136 + ,104389 + ,0 + ,0 + ,16440 + ,89 + ,136084 + ,0 + ,1 + ,11221 + ,40 + ,199476 + ,0 + ,1 + ,28732 + ,123 + ,92499 + ,0 + ,1 + ,5250 + ,21 + ,224330 + ,0 + ,0 + ,28608 + ,163 + ,135781 + ,0 + ,0 + ,8092 + ,29 + ,74408 + ,0 + ,0 + ,4473 + ,35 + ,81240 + ,0 + ,1 + ,1572 + ,13 + ,14688 + ,0 + ,1 + ,2065 + ,5 + ,181633 + ,0 + ,0 + ,14817 + ,96 + ,271856 + ,0 + ,1 + ,16714 + ,151 + ,7199 + ,0 + ,0 + ,556 + ,6 + ,46660 + ,0 + ,0 + ,2089 + ,13 + ,17547 + ,0 + ,1 + ,2658 + ,3 + ,133368 + ,0 + ,1 + ,10695 + ,56 + ,95227 + ,0 + ,1 + ,1669 + ,23 + ,152601 + ,0 + ,1 + ,16267 + ,57 + ,98146 + ,0 + ,1 + ,7768 + ,14 + ,79619 + ,0 + ,0 + ,7252 + ,43 + ,59194 + ,0 + ,1 + ,6387 + ,20 + ,139942 + ,0 + ,1 + ,18715 + ,72 + ,118612 + ,0 + ,0 + ,7936 + ,87 + ,72880 + ,0 + ,0 + ,8643 + ,21 + ,65475 + ,0 + ,0 + ,7294 + ,56 + ,99643 + ,0 + ,0 + ,4570 + ,59 + ,71965 + ,0 + ,0 + ,7185 + ,82 + ,77272 + ,0 + ,1 + ,10058 + ,43 + ,49289 + ,0 + ,1 + ,2342 + ,25 + ,135131 + ,0 + ,1 + ,8509 + ,38 + ,108446 + ,0 + ,0 + ,13275 + ,25 + ,89746 + ,0 + ,0 + ,6816 + ,38 + ,44296 + ,0 + ,0 + ,1930 + ,12 + ,77648 + ,0 + ,1 + ,8086 + ,29 + ,181528 + ,0 + ,0 + ,10737 + ,47 + ,134019 + ,0 + ,0 + ,8033 + ,45 + ,124064 + ,0 + ,0 + ,7058 + ,40 + ,92630 + ,0 + ,1 + ,6782 + ,30 + ,121848 + ,0 + ,0 + ,5401 + ,41 + ,52915 + ,0 + ,1 + ,6521 + ,25 + ,81872 + ,0 + ,1 + ,10856 + ,23 + ,58981 + ,0 + ,0 + ,2154 + ,14 + ,53515 + ,0 + ,1 + ,6117 + ,16 + ,60812 + ,0 + ,0 + ,5238 + ,26 + ,56375 + ,0 + ,0 + ,4820 + ,21 + ,65490 + ,0 + ,1 + ,5615 + ,27 + ,80949 + ,0 + ,0 + ,4272 + ,9 + ,76302 + ,0 + ,1 + ,8702 + ,33 + ,104011 + ,0 + ,0 + ,15340 + ,42 + ,98104 + ,0 + ,0 + ,8030 + ,68 + ,67989 + ,0 + ,0 + ,9526 + ,32 + ,30989 + ,0 + ,0 + ,1278 + ,6 + ,135458 + ,0 + ,1 + ,4236 + ,67 + ,73504 + ,0 + ,0 + ,3023 + ,33 + ,63123 + ,0 + ,0 + ,7196 + ,77 + ,61254 + ,0 + ,1 + ,3394 + ,46 + ,74914 + ,0 + ,1 + ,6371 + ,30 + ,31774 + ,0 + ,0 + ,1574 + ,0 + ,81437 + ,0 + ,0 + ,9620 + ,36 + ,87186 + ,0 + ,0 + ,6978 + ,46 + ,50090 + ,0 + ,1 + ,4911 + ,18 + ,65745 + ,0 + ,0 + ,8645 + ,48 + ,56653 + ,0 + ,0 + ,8987 + ,29 + ,158399 + ,0 + ,0 + ,5544 + ,28 + ,46455 + ,0 + ,0 + ,3083 + ,34 + ,73624 + ,0 + ,0 + ,6909 + ,33 + ,38395 + ,0 + ,0 + ,3189 + ,34 + ,91899 + ,0 + ,0 + ,6745 + ,33 + ,139526 + ,0 + ,1 + ,16724 + ,80 + ,52164 + ,0 + ,1 + ,4850 + ,32 + ,51567 + ,0 + ,1 + ,7025 + ,30 + ,70551 + ,0 + ,0 + ,6047 + ,41 + ,84856 + ,0 + ,0 + ,7377 + ,41 + ,102538 + ,0 + ,1 + ,9078 + ,51 + ,86678 + ,0 + ,1 + ,4605 + ,18 + ,85709 + ,0 + ,0 + ,3238 + ,34 + ,34662 + ,0 + ,0 + ,8100 + ,31 + ,150580 + ,0 + ,0 + ,9653 + ,39 + ,99611 + ,0 + ,1 + ,8914 + ,54 + ,19349 + ,0 + ,1 + ,786 + ,14 + ,99373 + ,0 + ,1 + ,6700 + ,24 + ,86230 + ,0 + ,1 + ,5788 + ,24 + ,30837 + ,0 + ,0 + ,593 + ,8 + ,31706 + ,0 + ,0 + ,4506 + ,26 + ,89806 + ,0 + ,0 + ,6382 + ,19 + ,62088 + ,0 + ,0 + ,5621 + ,11 + ,40151 + ,0 + ,1 + ,3997 + ,14 + ,27634 + ,0 + ,0 + ,520 + ,1 + ,76990 + ,0 + ,0 + ,8891 + ,39 + ,37460 + ,0 + ,1 + ,999 + ,5 + ,54157 + ,0 + ,0 + ,7067 + ,37 + ,49862 + ,0 + ,0 + ,4639 + ,32 + ,84337 + ,0 + ,1 + ,5654 + ,38 + ,64175 + ,0 + ,1 + ,6928 + ,47 + ,59382 + ,0 + ,0 + ,1514 + ,47 + ,119308 + ,0 + ,1 + ,9238 + ,37 + ,76702 + ,0 + ,0 + ,8204 + ,51 + ,103425 + ,0 + ,0 + ,5926 + ,45 + ,70344 + ,0 + ,1 + ,5785 + ,21 + ,43410 + ,0 + ,0 + ,4 + ,1 + ,104838 + ,0 + ,1 + ,5930 + ,42 + ,62215 + ,0 + ,0 + ,3710 + ,26 + ,69304 + ,0 + ,0 + ,705 + ,21 + ,53117 + ,0 + ,0 + ,443 + ,4 + ,19764 + ,0 + ,0 + ,2416 + ,10 + ,86680 + ,0 + ,1 + ,7747 + ,43 + ,84105 + ,0 + ,0 + ,5432 + ,34 + ,77945 + ,0 + ,0 + ,4913 + ,31 + ,89113 + ,0 + ,1 + ,2650 + ,19 + ,91005 + ,0 + ,0 + ,2370 + ,34 + ,40248 + ,0 + ,1 + ,775 + ,6 + ,64187 + ,0 + ,0 + ,5576 + ,11 + ,50857 + ,0 + ,0 + ,1352 + ,24 + ,56613 + ,0 + ,1 + ,3080 + ,16 + ,62792 + ,0 + ,1 + ,10205 + ,72) + ,dim=c(5 + ,288) + ,dimnames=list(c('time' + ,'pop' + ,'gender' + ,'reviews' + ,'blogs') + ,1:288)) > y <- array(NA,dim=c(5,288),dimnames=list(c('time','pop','gender','reviews','blogs'),1:288)) > 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 = '4' > 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 object(s) 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(s) are masked from 'package:survival': untangle.specials The following object(s) 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] "reviews" > x[,par1] [1] 24188 18273 14130 32287 8654 9245 33251 1271 5279 27101 16373 19716 [13] 17753 9028 18653 8828 29498 27563 18293 22530 15977 35082 16116 15849 [25] 16026 26569 24785 17569 23825 7869 14975 37791 9605 27295 2746 34461 [37] 8098 4787 24919 603 16329 12558 7784 28522 22265 14459 14526 22240 [49] 11802 7623 11912 7935 18220 19199 19918 21884 2694 15808 3597 5296 [61] 25239 29801 18450 7132 34861 35940 16688 24683 46230 10387 21436 30546 [73] 19746 15977 22583 17274 16469 14251 3007 16851 21113 17401 23958 23567 [85] 13065 15358 14587 12770 24021 9648 20537 7905 4527 30495 7117 17719 [97] 27056 33473 9758 21115 7236 13790 32902 25131 30910 35947 29848 6943 [109] 42705 31808 26675 8435 7409 14993 36867 33835 24164 12607 22609 5892 [121] 17014 5394 9178 6440 21916 4011 5818 18647 20556 238 70 22392 [133] 3913 12237 8388 22120 338 11727 3704 3988 3030 13520 1421 20923 [145] 20237 3219 3769 12252 1888 14497 28864 21721 4821 33644 15923 42935 [157] 18864 4977 7785 17939 23436 325 13539 34538 12198 26924 12716 8172 [169] 10855 11932 14300 25515 2805 29402 16440 11221 28732 5250 28608 8092 [181] 4473 1572 2065 14817 16714 556 2089 2658 10695 1669 16267 7768 [193] 7252 6387 18715 7936 8643 7294 4570 7185 10058 2342 8509 13275 [205] 6816 1930 8086 10737 8033 7058 6782 5401 6521 10856 2154 6117 [217] 5238 4820 5615 4272 8702 15340 8030 9526 1278 4236 3023 7196 [229] 3394 6371 1574 9620 6978 4911 8645 8987 5544 3083 6909 3189 [241] 6745 16724 4850 7025 6047 7377 9078 4605 3238 8100 9653 8914 [253] 786 6700 5788 593 4506 6382 5621 3997 520 8891 999 7067 [265] 4639 5654 6928 1514 9238 8204 5926 5785 4 5930 3710 705 [277] 443 2416 7747 5432 4913 2650 2370 775 5576 1352 3080 10205 > 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]) 4 70 238 325 338 443 520 556 593 603 705 775 786 1 1 1 1 1 1 1 1 1 1 1 1 1 999 1271 1278 1352 1421 1514 1572 1574 1669 1888 1930 2065 2089 1 1 1 1 1 1 1 1 1 1 1 1 1 2154 2342 2370 2416 2650 2658 2694 2746 2805 3007 3023 3030 3080 1 1 1 1 1 1 1 1 1 1 1 1 1 3083 3189 3219 3238 3394 3597 3704 3710 3769 3913 3988 3997 4011 1 1 1 1 1 1 1 1 1 1 1 1 1 4236 4272 4473 4506 4527 4570 4605 4639 4787 4820 4821 4850 4911 1 1 1 1 1 1 1 1 1 1 1 1 1 4913 4977 5238 5250 5279 5296 5394 5401 5432 5544 5576 5615 5621 1 1 1 1 1 1 1 1 1 1 1 1 1 5654 5785 5788 5818 5892 5926 5930 6047 6117 6371 6382 6387 6440 1 1 1 1 1 1 1 1 1 1 1 1 1 6521 6700 6745 6782 6816 6909 6928 6943 6978 7025 7058 7067 7117 1 1 1 1 1 1 1 1 1 1 1 1 1 7132 7185 7196 7236 7252 7294 7377 7409 7623 7747 7768 7784 7785 1 1 1 1 1 1 1 1 1 1 1 1 1 7869 7905 7935 7936 8030 8033 8086 8092 8098 8100 8172 8204 8388 1 1 1 1 1 1 1 1 1 1 1 1 1 8435 8509 8643 8645 8654 8702 8828 8891 8914 8987 9028 9078 9178 1 1 1 1 1 1 1 1 1 1 1 1 1 9238 9245 9526 9605 9620 9648 9653 9758 10058 10205 10387 10695 10737 1 1 1 1 1 1 1 1 1 1 1 1 1 10855 10856 11221 11727 11802 11912 11932 12198 12237 12252 12558 12607 12716 1 1 1 1 1 1 1 1 1 1 1 1 1 12770 13065 13275 13520 13539 13790 14130 14251 14300 14459 14497 14526 14587 1 1 1 1 1 1 1 1 1 1 1 1 1 14817 14975 14993 15340 15358 15808 15849 15923 15977 16026 16116 16267 16329 1 1 1 1 1 1 1 1 2 1 1 1 1 16373 16440 16469 16688 16714 16724 16851 17014 17274 17401 17569 17719 17753 1 1 1 1 1 1 1 1 1 1 1 1 1 17939 18220 18273 18293 18450 18647 18653 18715 18864 19199 19716 19746 19918 1 1 1 1 1 1 1 1 1 1 1 1 1 20237 20537 20556 20923 21113 21115 21436 21721 21884 21916 22120 22240 22265 1 1 1 1 1 1 1 1 1 1 1 1 1 22392 22530 22583 22609 23436 23567 23825 23958 24021 24164 24188 24683 24785 1 1 1 1 1 1 1 1 1 1 1 1 1 24919 25131 25239 25515 26569 26675 26924 27056 27101 27295 27563 28522 28608 1 1 1 1 1 1 1 1 1 1 1 1 1 28732 28864 29402 29498 29801 29848 30495 30546 30910 31808 32287 32902 33251 1 1 1 1 1 1 1 1 1 1 1 1 1 33473 33644 33835 34461 34538 34861 35082 35940 35947 36867 37791 42705 42935 1 1 1 1 1 1 1 1 1 1 1 1 1 46230 1 > colnames(x) [1] "time" "pop" "gender" "reviews" "blogs" > colnames(x)[par1] [1] "reviews" > x[,par1] [1] 24188 18273 14130 32287 8654 9245 33251 1271 5279 27101 16373 19716 [13] 17753 9028 18653 8828 29498 27563 18293 22530 15977 35082 16116 15849 [25] 16026 26569 24785 17569 23825 7869 14975 37791 9605 27295 2746 34461 [37] 8098 4787 24919 603 16329 12558 7784 28522 22265 14459 14526 22240 [49] 11802 7623 11912 7935 18220 19199 19918 21884 2694 15808 3597 5296 [61] 25239 29801 18450 7132 34861 35940 16688 24683 46230 10387 21436 30546 [73] 19746 15977 22583 17274 16469 14251 3007 16851 21113 17401 23958 23567 [85] 13065 15358 14587 12770 24021 9648 20537 7905 4527 30495 7117 17719 [97] 27056 33473 9758 21115 7236 13790 32902 25131 30910 35947 29848 6943 [109] 42705 31808 26675 8435 7409 14993 36867 33835 24164 12607 22609 5892 [121] 17014 5394 9178 6440 21916 4011 5818 18647 20556 238 70 22392 [133] 3913 12237 8388 22120 338 11727 3704 3988 3030 13520 1421 20923 [145] 20237 3219 3769 12252 1888 14497 28864 21721 4821 33644 15923 42935 [157] 18864 4977 7785 17939 23436 325 13539 34538 12198 26924 12716 8172 [169] 10855 11932 14300 25515 2805 29402 16440 11221 28732 5250 28608 8092 [181] 4473 1572 2065 14817 16714 556 2089 2658 10695 1669 16267 7768 [193] 7252 6387 18715 7936 8643 7294 4570 7185 10058 2342 8509 13275 [205] 6816 1930 8086 10737 8033 7058 6782 5401 6521 10856 2154 6117 [217] 5238 4820 5615 4272 8702 15340 8030 9526 1278 4236 3023 7196 [229] 3394 6371 1574 9620 6978 4911 8645 8987 5544 3083 6909 3189 [241] 6745 16724 4850 7025 6047 7377 9078 4605 3238 8100 9653 8914 [253] 786 6700 5788 593 4506 6382 5621 3997 520 8891 999 7067 [265] 4639 5654 6928 1514 9238 8204 5926 5785 4 5930 3710 705 [277] 443 2416 7747 5432 4913 2650 2370 775 5576 1352 3080 10205 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/1he1e1354891421.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: reviews Inputs: time, pop, gender, blogs Number of observations: 288 1) blogs <= 77; criterion = 1, statistic = 220.105 2) blogs <= 48; criterion = 1, statistic = 94.264 3) blogs <= 16; criterion = 1, statistic = 56.482 4) blogs <= 8; criterion = 0.988, statistic = 8.748 5)* weights = 16 4) blogs > 8 6)* weights = 19 3) blogs > 16 7) time <= 95227; criterion = 0.999, statistic = 14.548 8)* weights = 69 7) time > 95227 9)* weights = 29 2) blogs > 48 10)* weights = 48 1) blogs > 77 11) blogs <= 142; criterion = 1, statistic = 37.087 12) blogs <= 90; criterion = 0.996, statistic = 10.691 13)* weights = 22 12) blogs > 90 14)* weights = 62 11) blogs > 142 15)* weights = 23 > postscript(file="/var/fisher/rcomp/tmp/26rk71354891421.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/fisher/rcomp/tmp/3gyg51354891421.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 24188 30480.000 -6.292000e+03 2 18273 22530.581 -4.257581e+03 3 14130 22530.581 -8.400581e+03 4 32287 22530.581 9.756419e+03 5 8654 11729.083 -3.075083e+03 6 9245 5645.580 3.599420e+03 7 33251 30480.000 2.771000e+03 8 1271 1027.562 2.434375e+02 9 5279 8012.552 -2.733552e+03 10 27101 16532.409 1.056859e+04 11 16373 16532.409 -1.594091e+02 12 19716 22530.581 -2.814581e+03 13 17753 16532.409 1.220591e+03 14 9028 11729.083 -2.701083e+03 15 18653 22530.581 -3.877581e+03 16 8828 16532.409 -7.704409e+03 17 29498 22530.581 6.967419e+03 18 27563 30480.000 -2.917000e+03 19 18293 22530.581 -4.237581e+03 20 22530 22530.581 -5.806452e-01 21 15977 22530.581 -6.553581e+03 22 35082 22530.581 1.255142e+04 23 16116 22530.581 -6.414581e+03 24 15849 11729.083 4.119917e+03 25 16026 22530.581 -6.504581e+03 26 26569 22530.581 4.038419e+03 27 24785 16532.409 8.252591e+03 28 17569 22530.581 -4.961581e+03 29 23825 22530.581 1.294419e+03 30 7869 11729.083 -3.860083e+03 31 14975 22530.581 -7.555581e+03 32 37791 22530.581 1.526042e+04 33 9605 22530.581 -1.292558e+04 34 27295 22530.581 4.764419e+03 35 2746 5645.580 -2.899580e+03 36 34461 30480.000 3.981000e+03 37 8098 8012.552 8.544828e+01 38 4787 11729.083 -6.942083e+03 39 24919 22530.581 2.388419e+03 40 603 1027.562 -4.245625e+02 41 16329 16532.409 -2.034091e+02 42 12558 8012.552 4.545448e+03 43 7784 8012.552 -2.285517e+02 44 28522 22530.581 5.991419e+03 45 22265 22530.581 -2.655806e+02 46 14459 16532.409 -2.073409e+03 47 14526 11729.083 2.796917e+03 48 22240 11729.083 1.051092e+04 49 11802 11729.083 7.291667e+01 50 7623 8012.552 -3.895517e+02 51 11912 11729.083 1.829167e+02 52 7935 5645.580 2.289420e+03 53 18220 22530.581 -4.310581e+03 54 19199 30480.000 -1.128100e+04 55 19918 22530.581 -2.612581e+03 56 21884 22530.581 -6.465806e+02 57 2694 1027.562 1.666438e+03 58 15808 22530.581 -6.722581e+03 59 3597 5645.580 -2.048580e+03 60 5296 8012.552 -2.716552e+03 61 25239 22530.581 2.708419e+03 62 29801 22530.581 7.270419e+03 63 18450 22530.581 -4.080581e+03 64 7132 8012.552 -8.805517e+02 65 34861 30480.000 4.381000e+03 66 35940 30480.000 5.460000e+03 67 16688 11729.083 4.958917e+03 68 24683 30480.000 -5.797000e+03 69 46230 30480.000 1.575000e+04 70 10387 11729.083 -1.342083e+03 71 21436 22530.581 -1.094581e+03 72 30546 22530.581 8.015419e+03 73 19746 16532.409 3.213591e+03 74 15977 22530.581 -6.553581e+03 75 22583 22530.581 5.241935e+01 76 17274 22530.581 -5.256581e+03 77 16469 16532.409 -6.340909e+01 78 14251 16532.409 -2.281409e+03 79 3007 5645.580 -2.638580e+03 80 16851 16532.409 3.185909e+02 81 21113 22530.581 -1.417581e+03 82 17401 22530.581 -5.129581e+03 83 23958 22530.581 1.427419e+03 84 23567 22530.581 1.036419e+03 85 13065 11729.083 1.335917e+03 86 15358 22530.581 -7.172581e+03 87 14587 11729.083 2.857917e+03 88 12770 11729.083 1.040917e+03 89 24021 22530.581 1.490419e+03 90 9648 8012.552 1.635448e+03 91 20537 22530.581 -1.993581e+03 92 7905 11729.083 -3.824083e+03 93 4527 8012.552 -3.485552e+03 94 30495 22530.581 7.964419e+03 95 7117 8012.552 -8.955517e+02 96 17719 11729.083 5.989917e+03 97 27056 11729.083 1.532692e+04 98 33473 30480.000 2.993000e+03 99 9758 11729.083 -1.971083e+03 100 21115 30480.000 -9.365000e+03 101 7236 11729.083 -4.493083e+03 102 13790 22530.581 -8.740581e+03 103 32902 22530.581 1.037142e+04 104 25131 22530.581 2.600419e+03 105 30910 30480.000 4.300000e+02 106 35947 30480.000 5.467000e+03 107 29848 22530.581 7.317419e+03 108 6943 5645.580 1.297420e+03 109 42705 30480.000 1.222500e+04 110 31808 16532.409 1.527559e+04 111 26675 30480.000 -3.805000e+03 112 8435 11729.083 -3.294083e+03 113 7409 11729.083 -4.320083e+03 114 14993 11729.083 3.263917e+03 115 36867 30480.000 6.387000e+03 116 33835 22530.581 1.130442e+04 117 24164 22530.581 1.633419e+03 118 12607 11729.083 8.779167e+02 119 22609 11729.083 1.087992e+04 120 5892 5645.580 2.464203e+02 121 17014 11729.083 5.284917e+03 122 5394 5645.580 -2.515797e+02 123 9178 11729.083 -2.551083e+03 124 6440 11729.083 -5.289083e+03 125 21916 22530.581 -6.145806e+02 126 4011 5645.580 -1.634580e+03 127 5818 8012.552 -2.194552e+03 128 18647 11729.083 6.917917e+03 129 20556 22530.581 -1.974581e+03 130 238 3004.474 -2.766474e+03 131 70 1027.562 -9.575625e+02 132 22392 22530.581 -1.385806e+02 133 3913 5645.580 -1.732580e+03 134 12237 8012.552 4.224448e+03 135 8388 16532.409 -8.144409e+03 136 22120 30480.000 -8.360000e+03 137 338 1027.562 -6.895625e+02 138 11727 16532.409 -4.805409e+03 139 3704 5645.580 -1.941580e+03 140 3988 5645.580 -1.657580e+03 141 3030 3004.474 2.552632e+01 142 13520 16532.409 -3.012409e+03 143 1421 3004.474 -1.583474e+03 144 20923 22530.581 -1.607581e+03 145 20237 16532.409 3.704591e+03 146 3219 5645.580 -2.426580e+03 147 3769 8012.552 -4.243552e+03 148 12252 11729.083 5.229167e+02 149 1888 3004.474 -1.116474e+03 150 14497 11729.083 2.767917e+03 151 28864 22530.581 6.333419e+03 152 21721 22530.581 -8.095806e+02 153 4821 8012.552 -3.191552e+03 154 33644 30480.000 3.164000e+03 155 15923 22530.581 -6.607581e+03 156 42935 30480.000 1.245500e+04 157 18864 16532.409 2.331591e+03 158 4977 11729.083 -6.752083e+03 159 7785 5645.580 2.139420e+03 160 17939 16532.409 1.406591e+03 161 23436 30480.000 -7.044000e+03 162 325 3004.474 -2.679474e+03 163 13539 11729.083 1.809917e+03 164 34538 22530.581 1.200742e+04 165 12198 11729.083 4.689167e+02 166 26924 22530.581 4.393419e+03 167 12716 22530.581 -9.814581e+03 168 8172 11729.083 -3.557083e+03 169 10855 11729.083 -8.740833e+02 170 11932 11729.083 2.029167e+02 171 14300 22530.581 -8.230581e+03 172 25515 30480.000 -4.965000e+03 173 2805 3004.474 -1.994737e+02 174 29402 22530.581 6.871419e+03 175 16440 16532.409 -9.240909e+01 176 11221 8012.552 3.208448e+03 177 28732 22530.581 6.201419e+03 178 5250 5645.580 -3.955797e+02 179 28608 30480.000 -1.872000e+03 180 8092 8012.552 7.944828e+01 181 4473 5645.580 -1.172580e+03 182 1572 3004.474 -1.432474e+03 183 2065 1027.562 1.037438e+03 184 14817 22530.581 -7.713581e+03 185 16714 30480.000 -1.376600e+04 186 556 1027.562 -4.715625e+02 187 2089 3004.474 -9.154737e+02 188 2658 1027.562 1.630438e+03 189 10695 11729.083 -1.034083e+03 190 1669 5645.580 -3.976580e+03 191 16267 11729.083 4.537917e+03 192 7768 3004.474 4.763526e+03 193 7252 5645.580 1.606420e+03 194 6387 5645.580 7.414203e+02 195 18715 11729.083 6.985917e+03 196 7936 16532.409 -8.596409e+03 197 8643 5645.580 2.997420e+03 198 7294 11729.083 -4.435083e+03 199 4570 11729.083 -7.159083e+03 200 7185 16532.409 -9.347409e+03 201 10058 5645.580 4.412420e+03 202 2342 5645.580 -3.303580e+03 203 8509 8012.552 4.964483e+02 204 13275 8012.552 5.262448e+03 205 6816 5645.580 1.170420e+03 206 1930 3004.474 -1.074474e+03 207 8086 5645.580 2.440420e+03 208 10737 8012.552 2.724448e+03 209 8033 8012.552 2.044828e+01 210 7058 8012.552 -9.545517e+02 211 6782 5645.580 1.136420e+03 212 5401 8012.552 -2.611552e+03 213 6521 5645.580 8.754203e+02 214 10856 5645.580 5.210420e+03 215 2154 3004.474 -8.504737e+02 216 6117 3004.474 3.112526e+03 217 5238 5645.580 -4.075797e+02 218 4820 5645.580 -8.255797e+02 219 5615 5645.580 -3.057971e+01 220 4272 3004.474 1.267526e+03 221 8702 5645.580 3.056420e+03 222 15340 8012.552 7.327448e+03 223 8030 11729.083 -3.699083e+03 224 9526 5645.580 3.880420e+03 225 1278 1027.562 2.504375e+02 226 4236 11729.083 -7.493083e+03 227 3023 5645.580 -2.622580e+03 228 7196 11729.083 -4.533083e+03 229 3394 5645.580 -2.251580e+03 230 6371 5645.580 7.254203e+02 231 1574 1027.562 5.464375e+02 232 9620 5645.580 3.974420e+03 233 6978 5645.580 1.332420e+03 234 4911 5645.580 -7.345797e+02 235 8645 5645.580 2.999420e+03 236 8987 5645.580 3.341420e+03 237 5544 8012.552 -2.468552e+03 238 3083 5645.580 -2.562580e+03 239 6909 5645.580 1.263420e+03 240 3189 5645.580 -2.456580e+03 241 6745 5645.580 1.099420e+03 242 16724 16532.409 1.915909e+02 243 4850 5645.580 -7.955797e+02 244 7025 5645.580 1.379420e+03 245 6047 5645.580 4.014203e+02 246 7377 5645.580 1.731420e+03 247 9078 11729.083 -2.651083e+03 248 4605 5645.580 -1.040580e+03 249 3238 5645.580 -2.407580e+03 250 8100 5645.580 2.454420e+03 251 9653 8012.552 1.640448e+03 252 8914 11729.083 -2.815083e+03 253 786 3004.474 -2.218474e+03 254 6700 8012.552 -1.312552e+03 255 5788 5645.580 1.424203e+02 256 593 1027.562 -4.345625e+02 257 4506 5645.580 -1.139580e+03 258 6382 5645.580 7.364203e+02 259 5621 3004.474 2.616526e+03 260 3997 3004.474 9.925263e+02 261 520 1027.562 -5.075625e+02 262 8891 5645.580 3.245420e+03 263 999 1027.562 -2.856250e+01 264 7067 5645.580 1.421420e+03 265 4639 5645.580 -1.006580e+03 266 5654 5645.580 8.420290e+00 267 6928 5645.580 1.282420e+03 268 1514 5645.580 -4.131580e+03 269 9238 8012.552 1.225448e+03 270 8204 11729.083 -3.525083e+03 271 5926 8012.552 -2.086552e+03 272 5785 5645.580 1.394203e+02 273 4 1027.562 -1.023562e+03 274 5930 8012.552 -2.082552e+03 275 3710 5645.580 -1.935580e+03 276 705 5645.580 -4.940580e+03 277 443 1027.562 -5.845625e+02 278 2416 3004.474 -5.884737e+02 279 7747 5645.580 2.101420e+03 280 5432 5645.580 -2.135797e+02 281 4913 5645.580 -7.325797e+02 282 2650 5645.580 -2.995580e+03 283 2370 5645.580 -3.275580e+03 284 775 1027.562 -2.525625e+02 285 5576 3004.474 2.571526e+03 286 1352 5645.580 -4.293580e+03 287 3080 3004.474 7.552632e+01 288 10205 11729.083 -1.524083e+03 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/fisher/rcomp/tmp/44u1j1354891421.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/fisher/rcomp/tmp/5sno71354891421.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/fisher/rcomp/tmp/68bw51354891421.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/fisher/rcomp/tmp/75bkp1354891421.tab") + } > > try(system("convert tmp/26rk71354891421.ps tmp/26rk71354891421.png",intern=TRUE)) character(0) > try(system("convert tmp/3gyg51354891421.ps tmp/3gyg51354891421.png",intern=TRUE)) character(0) > try(system("convert tmp/44u1j1354891421.ps tmp/44u1j1354891421.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.009 0.611 7.606