R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(162687 + ,1845 + ,95 + ,595 + ,21 + ,20465 + ,201906 + ,1796 + ,62 + ,545 + ,20 + ,33629 + ,7215 + ,192 + ,18 + ,72 + ,0 + ,1423 + ,146367 + ,2444 + ,97 + ,679 + ,27 + ,25629 + ,257045 + ,3567 + ,139 + ,1201 + ,31 + ,54002 + ,524450 + ,6917 + ,265 + ,1967 + ,36 + ,151036 + ,188294 + ,1840 + ,58 + ,595 + ,23 + ,33287 + ,195674 + ,1740 + ,60 + ,496 + ,30 + ,31172 + ,177020 + ,2078 + ,44 + ,670 + ,30 + ,28113 + ,330194 + ,3118 + ,99 + ,1047 + ,27 + ,57803 + ,121844 + ,1946 + ,75 + ,634 + ,24 + ,49830 + ,203938 + ,2370 + ,72 + ,743 + ,30 + ,52143 + ,113213 + ,1944 + ,106 + ,686 + ,22 + ,21055 + ,220751 + ,3198 + ,120 + ,1086 + ,28 + ,47007 + ,172905 + ,1491 + ,63 + ,419 + ,18 + ,28735 + ,156326 + ,1573 + ,88 + ,474 + ,22 + ,59147 + ,145178 + ,1807 + ,58 + ,442 + ,37 + ,78950 + ,89171 + ,1309 + ,61 + ,373 + ,15 + ,13497 + ,172624 + ,2820 + ,88 + ,899 + ,34 + ,46154 + ,39790 + ,776 + ,27 + ,242 + ,18 + ,53249 + ,87927 + ,1162 + ,62 + ,399 + ,15 + ,10726 + ,241285 + ,2818 + ,103 + ,850 + ,30 + ,83700 + ,195820 + ,1761 + ,73 + ,642 + ,25 + ,40400 + ,146946 + ,2315 + ,56 + ,717 + ,34 + ,33797 + ,159763 + ,1994 + ,89 + ,619 + ,21 + ,36205 + ,207078 + ,1806 + ,34 + ,657 + ,21 + ,30165 + ,212394 + ,2152 + ,166 + ,691 + ,25 + ,58534 + ,201536 + ,1457 + ,95 + ,366 + ,31 + ,44663 + ,394662 + ,3000 + ,121 + ,994 + ,31 + ,92556 + ,217892 + ,2236 + ,46 + ,929 + ,20 + ,40078 + ,182286 + ,1685 + ,45 + ,490 + ,28 + ,34711 + ,181740 + ,1626 + ,47 + ,553 + ,22 + ,31076 + ,137978 + ,2257 + ,107 + ,738 + ,17 + ,74608 + ,255929 + ,3373 + ,130 + ,1028 + ,25 + ,58092 + ,236489 + ,2571 + ,55 + ,844 + ,25 + ,42009 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,230761 + ,2142 + ,64 + ,1000 + ,31 + ,36022 + ,132807 + ,1878 + ,54 + ,629 + ,14 + ,23333 + ,157118 + ,2190 + ,49 + ,532 + ,35 + ,53349 + ,253254 + ,2186 + ,68 + ,811 + ,34 + ,92596 + ,269329 + ,2533 + ,72 + ,837 + ,22 + ,49598 + ,161273 + ,1823 + ,61 + ,682 + ,34 + ,44093 + ,107181 + ,1095 + ,33 + ,400 + ,23 + ,84205 + ,195891 + ,2162 + ,79 + ,804 + ,24 + ,63369 + ,139667 + ,1365 + ,51 + ,419 + ,26 + ,60132 + ,171101 + ,1245 + ,99 + ,334 + ,23 + ,37403 + ,81407 + ,756 + ,33 + ,216 + ,35 + ,24460 + ,247563 + ,2417 + ,104 + ,786 + ,24 + ,46456 + ,239807 + ,2327 + ,90 + ,752 + ,31 + ,66616 + ,172743 + ,2786 + ,59 + ,964 + ,30 + ,41554 + ,48188 + ,658 + ,28 + ,205 + ,22 + ,22346 + ,169355 + ,2012 + ,70 + ,506 + ,23 + ,30874 + ,325322 + ,2616 + ,77 + ,830 + ,27 + ,68701 + ,241518 + ,2071 + ,79 + ,694 + ,30 + ,35728 + ,195583 + ,1911 + ,59 + ,691 + ,33 + ,29010 + ,159913 + ,1775 + ,57 + ,547 + ,12 + ,23110 + ,220241 + ,1919 + ,70 + ,538 + ,26 + ,38844 + ,101694 + ,1047 + ,26 + ,329 + ,26 + ,27084 + ,157258 + ,1190 + ,68 + ,427 + ,23 + ,35139 + ,202536 + ,2890 + ,99 + ,972 + ,38 + ,57476 + ,173505 + ,1836 + ,64 + ,541 + ,32 + ,33277 + ,150518 + ,2254 + ,83 + ,836 + ,21 + ,31141 + ,141491 + ,1392 + ,64 + ,376 + ,22 + ,61281 + ,125612 + ,1325 + ,38 + ,467 + ,26 + ,25820 + ,166049 + ,1317 + ,36 + ,430 + ,28 + ,23284 + ,124197 + ,1525 + ,42 + ,483 + ,33 + ,35378 + ,195043 + ,2335 + ,71 + ,504 + ,36 + ,74990 + ,138708 + ,2897 + ,65 + ,887 + ,25 + ,29653 + ,116552 + ,1118 + ,40 + ,271 + ,25 + ,64622 + ,31970 + ,340 + ,15 + ,101 + ,21 + ,4157 + ,258158 + ,2977 + ,115 + ,1097 + ,19 + ,29245 + ,151194 + ,1452 + ,79 + ,470 + ,12 + ,50008 + ,135926 + ,1550 + ,68 + ,528 + ,30 + ,52338 + ,119629 + ,1685 + ,73 + ,475 + ,21 + ,13310 + ,171518 + ,2728 + ,71 + ,698 + ,39 + ,92901 + ,108949 + ,1574 + ,45 + ,425 + ,32 + ,10956 + ,183471 + ,2413 + ,60 + ,709 + ,28 + ,34241 + ,159966 + ,2563 + ,98 + ,824 + ,29 + ,75043 + ,93786 + ,1079 + ,34 + ,336 + ,21 + ,21152 + ,84971 + ,1235 + ,72 + ,395 + ,31 + ,42249 + ,88882 + ,980 + ,76 + ,234 + ,26 + ,42005 + ,304603 + ,2246 + ,65 + ,830 + ,29 + ,41152 + ,75101 + ,1076 + ,30 + ,334 + ,23 + ,14399 + ,145043 + ,1637 + ,40 + ,524 + ,25 + ,28263 + ,95827 + ,1208 + ,48 + ,393 + ,22 + ,17215 + ,173924 + ,1865 + ,58 + ,574 + ,26 + ,48140 + ,241957 + ,2726 + ,237 + ,672 + ,33 + ,62897 + ,115367 + ,1208 + ,115 + ,284 + ,24 + ,22883 + ,118408 + ,1419 + ,64 + ,450 + ,24 + ,41622 + ,164078 + ,1609 + ,53 + ,653 + ,21 + ,40715 + ,158931 + ,1864 + ,41 + ,684 + ,28 + ,65897 + ,184139 + ,2412 + ,82 + ,706 + ,28 + ,76542 + ,152856 + ,1238 + ,58 + ,417 + ,25 + ,37477 + ,144014 + ,1462 + ,59 + ,549 + ,15 + ,53216 + ,62535 + ,973 + ,42 + ,394 + ,13 + ,40911 + ,245196 + ,2319 + ,117 + ,730 + ,36 + ,57021 + ,199841 + ,1890 + ,71 + ,571 + ,27 + ,73116 + ,19349 + ,223 + ,12 + ,67 + ,1 + ,3895 + ,247280 + ,2526 + ,108 + ,877 + ,24 + ,46609 + ,159408 + ,2072 + ,83 + ,856 + ,31 + ,29351 + ,72128 + ,778 + ,30 + ,306 + ,4 + ,2325 + ,104253 + ,1194 + ,26 + ,382 + ,21 + ,31747 + ,151090 + ,1424 + ,57 + ,435 + ,27 + ,32665 + ,137382 + ,1328 + ,66 + ,336 + ,23 + ,19249 + ,87448 + ,839 + ,42 + ,227 + ,12 + ,15292 + ,27676 + ,596 + ,22 + ,194 + ,16 + ,5842 + ,165507 + ,1671 + ,50 + ,410 + ,29 + ,33994 + ,132148 + ,1167 + ,37 + ,273 + ,26 + ,13018 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,95778 + ,1106 + ,34 + ,343 + ,25 + ,98177 + ,109001 + ,1148 + ,67 + ,376 + ,21 + ,37941 + ,158833 + ,1485 + ,46 + ,495 + ,24 + ,31032 + ,147690 + ,1526 + ,63 + ,448 + ,21 + ,32683 + ,89887 + ,962 + ,63 + ,313 + ,21 + ,34545 + ,3616 + ,78 + ,5 + ,14 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,199005 + ,1184 + ,45 + ,410 + ,23 + ,27525 + ,160930 + ,1671 + ,92 + ,606 + ,33 + ,66856 + ,177948 + ,2142 + ,102 + ,593 + ,32 + ,28549 + ,136061 + ,1015 + ,39 + ,312 + ,23 + ,38610 + ,43410 + ,778 + ,19 + ,292 + ,1 + ,2781 + ,184277 + ,1856 + ,74 + ,547 + ,29 + ,41211 + ,108858 + ,1056 + ,43 + ,302 + ,20 + ,22698 + ,151030 + ,2297 + ,59 + ,660 + ,33 + ,41194 + ,60493 + ,731 + ,40 + ,174 + ,12 + ,32689 + ,19764 + ,285 + ,12 + ,75 + ,2 + ,5752 + ,177559 + ,1872 + ,56 + ,572 + ,21 + ,26757 + ,140281 + ,1181 + ,35 + ,389 + ,28 + ,22527 + ,164249 + ,1725 + ,54 + ,562 + ,35 + ,44810 + ,11796 + ,256 + ,9 + ,79 + ,2 + ,0 + ,10674 + ,98 + ,9 + ,33 + ,0 + ,0 + ,151322 + ,1435 + ,59 + ,487 + ,18 + ,100674 + ,6836 + ,41 + ,3 + ,11 + ,1 + ,0 + ,174712 + ,1930 + ,67 + ,664 + ,21 + ,57786 + ,5118 + ,42 + ,3 + ,6 + ,0 + ,0 + ,40248 + ,528 + ,16 + ,183 + ,4 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,127628 + ,1121 + ,50 + ,342 + ,29 + ,28470 + ,88837 + ,1305 + ,38 + ,269 + ,26 + ,61849 + ,7131 + ,81 + ,4 + ,27 + ,0 + ,0 + ,9056 + ,262 + ,15 + ,99 + ,4 + ,2179 + ,87957 + ,1099 + ,26 + ,305 + ,19 + ,8019 + ,144470 + ,1290 + ,53 + ,327 + ,22 + ,39644 + ,111408 + ,1248 + ,20 + ,459 + ,22 + ,23494) + ,dim=c(6 + ,144) + ,dimnames=list(c('Time' + ,'Pageviews' + ,'Logins' + ,'Compendiumviews' + ,'reviewedcompendiums' + ,'caracters') + ,1:144)) > y <- array(NA,dim=c(6,144),dimnames=list(c('Time','Pageviews','Logins','Compendiumviews','reviewedcompendiums','caracters'),1:144)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'yes' > par3 = '2' > par2 = 'quantiles' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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 Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) 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] "Time" > x[,par1] [1] 162687 201906 7215 146367 257045 524450 188294 195674 177020 330194 [11] 121844 203938 113213 220751 172905 156326 145178 89171 172624 39790 [21] 87927 241285 195820 146946 159763 207078 212394 201536 394662 217892 [31] 182286 181740 137978 255929 236489 0 230761 132807 157118 253254 [41] 269329 161273 107181 195891 139667 171101 81407 247563 239807 172743 [51] 48188 169355 325322 241518 195583 159913 220241 101694 157258 202536 [61] 173505 150518 141491 125612 166049 124197 195043 138708 116552 31970 [71] 258158 151194 135926 119629 171518 108949 183471 159966 93786 84971 [81] 88882 304603 75101 145043 95827 173924 241957 115367 118408 164078 [91] 158931 184139 152856 144014 62535 245196 199841 19349 247280 159408 [101] 72128 104253 151090 137382 87448 27676 165507 132148 0 95778 [111] 109001 158833 147690 89887 3616 0 199005 160930 177948 136061 [121] 43410 184277 108858 151030 60493 19764 177559 140281 164249 11796 [131] 10674 151322 6836 174712 5118 40248 0 127628 88837 7131 [141] 9056 87957 144470 111408 > 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,151194) [151194,524450] 72 72 > colnames(x) [1] "Time" "Pageviews" "Logins" [4] "Compendiumviews" "reviewedcompendiums" "caracters" > colnames(x)[par1] [1] "Time" > x[,par1] [1] [151194,524450] [151194,524450] [ 0,151194) [ 0,151194) [5] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [9] [151194,524450] [151194,524450] [ 0,151194) [151194,524450] [13] [ 0,151194) [151194,524450] [151194,524450] [151194,524450] [17] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [21] [ 0,151194) [151194,524450] [151194,524450] [ 0,151194) [25] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [29] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [33] [ 0,151194) [151194,524450] [151194,524450] [ 0,151194) [37] [151194,524450] [ 0,151194) [151194,524450] [151194,524450] [41] [151194,524450] [151194,524450] [ 0,151194) [151194,524450] [45] [ 0,151194) [151194,524450] [ 0,151194) [151194,524450] [49] [151194,524450] [151194,524450] [ 0,151194) [151194,524450] [53] [151194,524450] [151194,524450] [151194,524450] [151194,524450] [57] [151194,524450] [ 0,151194) [151194,524450] [151194,524450] [61] [151194,524450] [ 0,151194) [ 0,151194) [ 0,151194) [65] [151194,524450] [ 0,151194) [151194,524450] [ 0,151194) [69] [ 0,151194) [ 0,151194) [151194,524450] [151194,524450] [73] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [77] [151194,524450] [151194,524450] [ 0,151194) [ 0,151194) [81] [ 0,151194) [151194,524450] [ 0,151194) [ 0,151194) [85] [ 0,151194) [151194,524450] [151194,524450] [ 0,151194) [89] [ 0,151194) [151194,524450] [151194,524450] [151194,524450] [93] [151194,524450] [ 0,151194) [ 0,151194) [151194,524450] [97] [151194,524450] [ 0,151194) [151194,524450] [151194,524450] [101] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) [105] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [109] [ 0,151194) [ 0,151194) [ 0,151194) [151194,524450] [113] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) [117] [151194,524450] [151194,524450] [151194,524450] [ 0,151194) [121] [ 0,151194) [151194,524450] [ 0,151194) [ 0,151194) [125] [ 0,151194) [ 0,151194) [151194,524450] [ 0,151194) [129] [151194,524450] [ 0,151194) [ 0,151194) [151194,524450] [133] [ 0,151194) [151194,524450] [ 0,151194) [ 0,151194) [137] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) [141] [ 0,151194) [ 0,151194) [ 0,151194) [ 0,151194) Levels: [ 0,151194) [151194,524450] > 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/1bbws1324568852.tab") + } + } m.ct.i.pred m.ct.i.actu 1 2 1 500 157 2 47 593 [1] 0.761035 [1] 0.9265625 [1] 0.842714 m.ct.x.pred m.ct.x.actu 1 2 1 42 21 2 7 73 [1] 0.6666667 [1] 0.9125 [1] 0.8041958 > m Conditional inference tree with 3 terminal nodes Response: as.factor(Time) Inputs: Pageviews, Logins, Compendiumviews, reviewedcompendiums, caracters Number of observations: 144 1) Compendiumviews <= 467; criterion = 1, statistic = 55.7 2) Logins <= 43; criterion = 0.989, statistic = 9.294 3)* weights = 41 2) Logins > 43 4)* weights = 25 1) Compendiumviews > 467 5)* weights = 78 > postscript(file="/var/wessaorg/rcomp/tmp/2jzwy1324568852.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/3wfsm1324568852.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) + } > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } [,1] [,2] [1,] 2 2 [2,] 2 2 [3,] 1 1 [4,] 1 2 [5,] 2 2 [6,] 2 2 [7,] 2 2 [8,] 2 2 [9,] 2 2 [10,] 2 2 [11,] 1 2 [12,] 2 2 [13,] 1 2 [14,] 2 2 [15,] 2 1 [16,] 2 2 [17,] 1 1 [18,] 1 1 [19,] 2 2 [20,] 1 1 [21,] 1 1 [22,] 2 2 [23,] 2 2 [24,] 1 2 [25,] 2 2 [26,] 2 2 [27,] 2 2 [28,] 2 1 [29,] 2 2 [30,] 2 2 [31,] 2 2 [32,] 2 2 [33,] 1 2 [34,] 2 2 [35,] 2 2 [36,] 1 1 [37,] 2 2 [38,] 1 2 [39,] 2 2 [40,] 2 2 [41,] 2 2 [42,] 2 2 [43,] 1 1 [44,] 2 2 [45,] 1 1 [46,] 2 1 [47,] 1 1 [48,] 2 2 [49,] 2 2 [50,] 2 2 [51,] 1 1 [52,] 2 2 [53,] 2 2 [54,] 2 2 [55,] 2 2 [56,] 2 2 [57,] 2 2 [58,] 1 1 [59,] 2 1 [60,] 2 2 [61,] 2 2 [62,] 1 2 [63,] 1 1 [64,] 1 1 [65,] 2 1 [66,] 1 2 [67,] 2 2 [68,] 1 2 [69,] 1 1 [70,] 1 1 [71,] 2 2 [72,] 2 2 [73,] 1 2 [74,] 1 2 [75,] 2 2 [76,] 1 1 [77,] 2 2 [78,] 2 2 [79,] 1 1 [80,] 1 1 [81,] 1 1 [82,] 2 2 [83,] 1 1 [84,] 1 2 [85,] 1 1 [86,] 2 2 [87,] 2 2 [88,] 1 1 [89,] 1 1 [90,] 2 2 [91,] 2 2 [92,] 2 2 [93,] 2 1 [94,] 1 2 [95,] 1 1 [96,] 2 2 [97,] 2 2 [98,] 1 1 [99,] 2 2 [100,] 2 2 [101,] 1 1 [102,] 1 1 [103,] 1 1 [104,] 1 1 [105,] 1 1 [106,] 1 1 [107,] 2 1 [108,] 1 1 [109,] 1 1 [110,] 1 1 [111,] 1 1 [112,] 2 2 [113,] 1 1 [114,] 1 1 [115,] 1 1 [116,] 1 1 [117,] 2 1 [118,] 2 2 [119,] 2 2 [120,] 1 1 [121,] 1 1 [122,] 2 2 [123,] 1 1 [124,] 1 2 [125,] 1 1 [126,] 1 1 [127,] 2 2 [128,] 1 1 [129,] 2 2 [130,] 1 1 [131,] 1 1 [132,] 2 2 [133,] 1 1 [134,] 2 2 [135,] 1 1 [136,] 1 1 [137,] 1 1 [138,] 1 1 [139,] 1 1 [140,] 1 1 [141,] 1 1 [142,] 1 1 [143,] 1 1 [144,] 1 1 [ 0,151194) [151194,524450] [ 0,151194) 58 14 [151194,524450] 8 64 > postscript(file="/var/wessaorg/rcomp/tmp/46ph41324568852.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/5cc3u1324568852.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/6y6vw1324568852.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/7kwc21324568852.tab") + } > > try(system("convert tmp/2jzwy1324568852.ps tmp/2jzwy1324568852.png",intern=TRUE)) character(0) > try(system("convert tmp/3wfsm1324568852.ps tmp/3wfsm1324568852.png",intern=TRUE)) character(0) > try(system("convert tmp/46ph41324568852.ps tmp/46ph41324568852.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.234 0.292 3.523