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(158147 + ,1760 + ,89 + ,48 + ,18 + ,20465 + ,182462 + ,1609 + ,56 + ,52 + ,20 + ,33629 + ,7215 + ,192 + ,18 + ,0 + ,0 + ,1423 + ,122259 + ,2182 + ,92 + ,49 + ,26 + ,25629 + ,222405 + ,3367 + ,131 + ,76 + ,31 + ,54002 + ,485890 + ,6658 + ,253 + ,124 + ,36 + ,151036 + ,150777 + ,1548 + ,54 + ,42 + ,23 + ,33287 + ,160529 + ,1507 + ,56 + ,68 + ,30 + ,31172 + ,133238 + ,1682 + ,42 + ,52 + ,30 + ,28113 + ,275326 + ,2811 + ,91 + ,67 + ,26 + ,57803 + ,121821 + ,1943 + ,74 + ,50 + ,24 + ,49830 + ,172489 + ,2017 + ,66 + ,71 + ,30 + ,52143 + ,89942 + ,1702 + ,96 + ,41 + ,21 + ,21055 + ,208851 + ,3034 + ,110 + ,79 + ,25 + ,47007 + ,151886 + ,1379 + ,55 + ,49 + ,18 + ,28735 + ,145427 + ,1517 + ,79 + ,54 + ,19 + ,59147 + ,134153 + ,1637 + ,53 + ,75 + ,33 + ,78950 + ,64149 + ,1077 + ,53 + ,0 + ,15 + ,13497 + ,122417 + ,2384 + ,84 + ,54 + ,34 + ,46154 + ,27997 + ,726 + ,24 + ,13 + ,18 + ,53249 + ,65004 + ,993 + ,55 + ,17 + ,15 + ,10726 + ,205417 + ,2446 + ,91 + ,83 + ,27 + ,83700 + ,188103 + ,1713 + ,70 + ,37 + ,25 + ,40400 + ,118698 + ,2027 + ,50 + ,44 + ,34 + ,33797 + ,143682 + ,1818 + ,81 + ,50 + ,21 + ,36205 + ,140172 + ,1393 + ,28 + ,39 + ,21 + ,30165 + ,186377 + ,2000 + ,154 + ,59 + ,25 + ,58534 + ,174870 + ,1346 + ,85 + ,79 + ,31 + ,44663 + ,317699 + ,2522 + ,114 + ,55 + ,30 + ,92556 + ,192335 + ,2106 + ,43 + ,52 + ,20 + ,40078 + ,151621 + ,1515 + ,42 + ,50 + ,28 + ,34711 + ,167466 + ,1519 + ,43 + ,54 + ,20 + ,31076 + ,125909 + ,2165 + ,100 + ,53 + ,17 + ,74608 + ,221896 + ,2959 + ,120 + ,76 + ,25 + ,58092 + ,217447 + ,2364 + ,52 + ,60 + ,24 + ,42009 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,207163 + ,2009 + ,59 + ,53 + ,27 + ,36022 + ,93107 + ,1564 + ,50 + ,44 + ,14 + ,23333 + ,133763 + ,2072 + ,47 + ,36 + ,32 + ,53349 + ,246427 + ,2106 + ,63 + ,83 + ,31 + ,92596 + ,224097 + ,2270 + ,69 + ,100 + ,21 + ,49598 + ,142057 + ,1643 + ,56 + ,37 + ,34 + ,44093 + ,94332 + ,957 + ,29 + ,25 + ,23 + ,84205 + ,171724 + ,2025 + ,77 + ,59 + ,24 + ,63369 + ,101683 + ,1115 + ,45 + ,44 + ,26 + ,60132 + ,156753 + ,1176 + ,90 + ,41 + ,22 + ,37403 + ,81293 + ,744 + ,31 + ,23 + ,35 + ,24460 + ,201984 + ,1974 + ,91 + ,63 + ,21 + ,46456 + ,219875 + ,2224 + ,85 + ,54 + ,31 + ,66616 + ,156589 + ,2561 + ,56 + ,67 + ,26 + ,41554 + ,48188 + ,658 + ,28 + ,12 + ,22 + ,22346 + ,138146 + ,1716 + ,64 + ,82 + ,21 + ,30874 + ,279590 + ,2355 + ,71 + ,64 + ,27 + ,68701 + ,234829 + ,2017 + ,77 + ,56 + ,30 + ,35728 + ,181731 + ,1686 + ,57 + ,54 + ,33 + ,29010 + ,141014 + ,1675 + ,54 + ,35 + ,11 + ,23110 + ,189220 + ,1760 + ,62 + ,52 + ,26 + ,38844 + ,76419 + ,875 + ,23 + ,25 + ,26 + ,27084 + ,151898 + ,1169 + ,65 + ,67 + ,23 + ,35139 + ,189402 + ,2789 + ,93 + ,36 + ,38 + ,57476 + ,140189 + ,1606 + ,56 + ,50 + ,29 + ,33277 + ,123181 + ,1986 + ,75 + ,48 + ,19 + ,31141 + ,124234 + ,1300 + ,58 + ,46 + ,19 + ,61281 + ,107277 + ,1176 + ,34 + ,53 + ,24 + ,25820 + ,153813 + ,1215 + ,32 + ,27 + ,26 + ,23284 + ,94982 + ,1230 + ,38 + ,38 + ,29 + ,35378 + ,178613 + ,2226 + ,67 + ,68 + ,36 + ,74990 + ,138708 + ,2897 + ,65 + ,93 + ,25 + ,29653 + ,102378 + ,1008 + ,37 + ,48 + ,24 + ,64622 + ,31970 + ,340 + ,15 + ,5 + ,21 + ,4157 + ,211635 + ,2704 + ,110 + ,53 + ,19 + ,29245 + ,111885 + ,1209 + ,63 + ,36 + ,12 + ,50008 + ,99687 + ,1290 + ,63 + ,62 + ,30 + ,52338 + ,102900 + ,1535 + ,68 + ,46 + ,21 + ,13310 + ,156475 + ,2585 + ,65 + ,73 + ,34 + ,92901 + ,74513 + ,1315 + ,41 + ,2 + ,32 + ,10956 + ,159186 + ,2142 + ,57 + ,76 + ,27 + ,34241 + ,155818 + ,2513 + ,94 + ,71 + ,28 + ,75043 + ,60138 + ,817 + ,24 + ,16 + ,21 + ,21152 + ,84971 + ,1234 + ,71 + ,34 + ,31 + ,42249 + ,80478 + ,917 + ,66 + ,54 + ,26 + ,42005 + ,244325 + ,1924 + ,59 + ,39 + ,29 + ,41152 + ,56486 + ,853 + ,27 + ,26 + ,23 + ,14399 + ,110743 + ,1398 + ,34 + ,40 + ,25 + ,28263 + ,75092 + ,986 + ,44 + ,35 + ,22 + ,17215 + ,148286 + ,1608 + ,47 + ,32 + ,26 + ,48140 + ,222914 + ,2576 + ,219 + ,55 + ,33 + ,62897 + ,115019 + ,1201 + ,108 + ,58 + ,24 + ,22883 + ,93083 + ,1189 + ,56 + ,39 + ,24 + ,41622 + ,143258 + ,1383 + ,49 + ,33 + ,21 + ,40715 + ,117794 + ,1563 + ,39 + ,45 + ,28 + ,65897 + ,158586 + ,2185 + ,74 + ,72 + ,27 + ,76542 + ,151465 + ,1228 + ,56 + ,39 + ,25 + ,37477 + ,124626 + ,1266 + ,58 + ,27 + ,15 + ,53216 + ,51801 + ,830 + ,36 + ,22 + ,13 + ,40911 + ,223020 + ,2217 + ,110 + ,47 + ,36 + ,57021 + ,188957 + ,1787 + ,68 + ,95 + ,24 + ,73116 + ,19349 + ,223 + ,12 + ,13 + ,1 + ,3895 + ,188069 + ,2170 + ,99 + ,27 + ,24 + ,46609 + ,150561 + ,1927 + ,74 + ,40 + ,31 + ,29351 + ,53921 + ,665 + ,28 + ,22 + ,4 + ,2325 + ,58280 + ,804 + ,22 + ,41 + ,20 + ,31747 + ,124951 + ,1211 + ,49 + ,55 + ,23 + ,32665 + ,112263 + ,1143 + ,57 + ,28 + ,23 + ,19249 + ,72904 + ,710 + ,38 + ,30 + ,12 + ,15292 + ,27676 + ,596 + ,22 + ,2 + ,16 + ,5842 + ,131274 + ,1353 + ,44 + ,79 + ,29 + ,33994 + ,117451 + ,971 + ,32 + ,18 + ,10 + ,13018 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,85610 + ,1030 + ,31 + ,46 + ,25 + ,98177 + ,107175 + ,1130 + ,66 + ,25 + ,21 + ,37941 + ,133024 + ,1284 + ,44 + ,50 + ,23 + ,31032 + ,136473 + ,1438 + ,61 + ,59 + ,21 + ,32683 + ,71894 + ,849 + ,57 + ,36 + ,21 + ,34545 + ,3616 + ,78 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,154806 + ,925 + ,39 + ,35 + ,23 + ,27525 + ,137977 + ,1518 + ,78 + ,68 + ,29 + ,66856 + ,149846 + ,1946 + ,95 + ,26 + ,28 + ,28549 + ,113245 + ,914 + ,37 + ,36 + ,23 + ,38610 + ,43410 + ,778 + ,19 + ,7 + ,1 + ,2781 + ,170330 + ,1713 + ,71 + ,67 + ,29 + ,41211 + ,89410 + ,895 + ,40 + ,30 + ,17 + ,22698 + ,112749 + ,1756 + ,52 + ,55 + ,29 + ,41194 + ,60373 + ,701 + ,40 + ,3 + ,12 + ,32689 + ,19764 + ,285 + ,12 + ,10 + ,2 + ,5752 + ,160995 + ,1774 + ,55 + ,46 + ,21 + ,26757 + ,121052 + ,1021 + ,28 + ,26 + ,25 + ,22527 + ,150039 + ,1582 + ,46 + ,49 + ,29 + ,44810 + ,11796 + ,256 + ,9 + ,1 + ,2 + ,0 + ,10674 + ,98 + ,9 + ,0 + ,0 + ,0 + ,134836 + ,1358 + ,55 + ,33 + ,18 + ,100674 + ,6836 + ,41 + ,3 + ,0 + ,1 + ,0 + ,153278 + ,1770 + ,57 + ,48 + ,21 + ,57786 + ,5118 + ,42 + ,3 + ,5 + ,0 + ,0 + ,40248 + ,528 + ,16 + ,8 + ,4 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,117842 + ,1026 + ,45 + ,35 + ,25 + ,28470 + ,87635 + ,1296 + ,38 + ,21 + ,26 + ,61849 + ,7131 + ,81 + ,4 + ,0 + ,0 + ,0 + ,8812 + ,257 + ,13 + ,0 + ,4 + ,2179 + ,68916 + ,914 + ,23 + ,15 + ,17 + ,8019 + ,132686 + ,1178 + ,50 + ,50 + ,21 + ,39644 + ,94127 + ,1080 + ,19 + ,17 + ,22 + ,23494) + ,dim=c(6 + ,144) + ,dimnames=list(c('time' + ,'pageviews' + ,'logins' + ,'BC' + ,'review' + ,'char') + ,1:144)) > y <- array(NA,dim=c(6,144),dimnames=list(c('time','pageviews','logins','BC','review','char'),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 = 'no' > par3 = '' > par2 = 'none' > 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] 158147 182462 7215 122259 222405 485890 150777 160529 133238 275326 [11] 121821 172489 89942 208851 151886 145427 134153 64149 122417 27997 [21] 65004 205417 188103 118698 143682 140172 186377 174870 317699 192335 [31] 151621 167466 125909 221896 217447 0 207163 93107 133763 246427 [41] 224097 142057 94332 171724 101683 156753 81293 201984 219875 156589 [51] 48188 138146 279590 234829 181731 141014 189220 76419 151898 189402 [61] 140189 123181 124234 107277 153813 94982 178613 138708 102378 31970 [71] 211635 111885 99687 102900 156475 74513 159186 155818 60138 84971 [81] 80478 244325 56486 110743 75092 148286 222914 115019 93083 143258 [91] 117794 158586 151465 124626 51801 223020 188957 19349 188069 150561 [101] 53921 58280 124951 112263 72904 27676 131274 117451 0 85610 [111] 107175 133024 136473 71894 3616 0 154806 137977 149846 113245 [121] 43410 170330 89410 112749 60373 19764 160995 121052 150039 11796 [131] 10674 134836 6836 153278 5118 40248 0 117842 87635 7131 [141] 8812 68916 132686 94127 > 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 3616 5118 6836 7131 7215 8812 10674 11796 19349 19764 4 1 1 1 1 1 1 1 1 1 1 27676 27997 31970 40248 43410 48188 51801 53921 56486 58280 60138 1 1 1 1 1 1 1 1 1 1 1 60373 64149 65004 68916 71894 72904 74513 75092 76419 80478 81293 1 1 1 1 1 1 1 1 1 1 1 84971 85610 87635 89410 89942 93083 93107 94127 94332 94982 99687 1 1 1 1 1 1 1 1 1 1 1 101683 102378 102900 107175 107277 110743 111885 112263 112749 113245 115019 1 1 1 1 1 1 1 1 1 1 1 117451 117794 117842 118698 121052 121821 122259 122417 123181 124234 124626 1 1 1 1 1 1 1 1 1 1 1 124951 125909 131274 132686 133024 133238 133763 134153 134836 136473 137977 1 1 1 1 1 1 1 1 1 1 1 138146 138708 140172 140189 141014 142057 143258 143682 145427 148286 149846 1 1 1 1 1 1 1 1 1 1 1 150039 150561 150777 151465 151621 151886 151898 153278 153813 154806 155818 1 1 1 1 1 1 1 1 1 1 1 156475 156589 156753 158147 158586 159186 160529 160995 167466 170330 171724 1 1 1 1 1 1 1 1 1 1 1 172489 174870 178613 181731 182462 186377 188069 188103 188957 189220 189402 1 1 1 1 1 1 1 1 1 1 1 192335 201984 205417 207163 208851 211635 217447 219875 221896 222405 222914 1 1 1 1 1 1 1 1 1 1 1 223020 224097 234829 244325 246427 275326 279590 317699 485890 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "time" "pageviews" "logins" "BC" "review" "char" > colnames(x)[par1] [1] "time" > x[,par1] [1] 158147 182462 7215 122259 222405 485890 150777 160529 133238 275326 [11] 121821 172489 89942 208851 151886 145427 134153 64149 122417 27997 [21] 65004 205417 188103 118698 143682 140172 186377 174870 317699 192335 [31] 151621 167466 125909 221896 217447 0 207163 93107 133763 246427 [41] 224097 142057 94332 171724 101683 156753 81293 201984 219875 156589 [51] 48188 138146 279590 234829 181731 141014 189220 76419 151898 189402 [61] 140189 123181 124234 107277 153813 94982 178613 138708 102378 31970 [71] 211635 111885 99687 102900 156475 74513 159186 155818 60138 84971 [81] 80478 244325 56486 110743 75092 148286 222914 115019 93083 143258 [91] 117794 158586 151465 124626 51801 223020 188957 19349 188069 150561 [101] 53921 58280 124951 112263 72904 27676 131274 117451 0 85610 [111] 107175 133024 136473 71894 3616 0 154806 137977 149846 113245 [121] 43410 170330 89410 112749 60373 19764 160995 121052 150039 11796 [131] 10674 134836 6836 153278 5118 40248 0 117842 87635 7131 [141] 8812 68916 132686 94127 > 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/1192y1324477288.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: time Inputs: pageviews, logins, BC, review, char Number of observations: 144 1) pageviews <= 1130; criterion = 1, statistic = 113.242 2) pageviews <= 596; criterion = 1, statistic = 36.513 3)* weights = 17 2) pageviews > 596 4) pageviews <= 875; criterion = 0.995, statistic = 10.856 5)* weights = 13 4) pageviews > 875 6)* weights = 17 1) pageviews > 1130 7) pageviews <= 2185; criterion = 1, statistic = 57.777 8) pageviews <= 1702; criterion = 1, statistic = 19.668 9) BC <= 46; criterion = 0.976, statistic = 7.956 10)* weights = 24 9) BC > 46 11)* weights = 22 8) pageviews > 1702 12)* weights = 30 7) pageviews > 2185 13) pageviews <= 2704; criterion = 0.996, statistic = 11.192 14)* weights = 14 13) pageviews > 2704 15)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2zvzp1324477288.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/3i4qf1324477288.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 158147 167104.63 -8957.63333 2 182462 142903.50 39558.50000 3 7215 11776.76 -4561.76471 4 122259 167104.63 -44845.63333 5 222405 248925.43 -26520.42857 6 485890 248925.43 236964.57143 7 150777 120212.88 30564.12500 8 160529 142903.50 17625.50000 9 133238 142903.50 -9665.50000 10 275326 248925.43 26400.57143 11 121821 167104.63 -45283.63333 12 172489 167104.63 5384.36667 13 89942 120212.88 -30270.87500 14 208851 248925.43 -40074.42857 15 151886 142903.50 8982.50000 16 145427 142903.50 2523.50000 17 134153 142903.50 -8750.50000 18 64149 97220.59 -33071.58824 19 122417 206543.29 -84126.28571 20 27997 58700.31 -30703.30769 21 65004 97220.59 -32216.58824 22 205417 206543.29 -1126.28571 23 188103 167104.63 20998.36667 24 118698 167104.63 -48406.63333 25 143682 167104.63 -23422.63333 26 140172 120212.88 19959.12500 27 186377 167104.63 19272.36667 28 174870 142903.50 31966.50000 29 317699 206543.29 111155.71429 30 192335 167104.63 25230.36667 31 151621 142903.50 8717.50000 32 167466 142903.50 24562.50000 33 125909 167104.63 -41195.63333 34 221896 248925.43 -27029.42857 35 217447 206543.29 10903.71429 36 0 11776.76 -11776.76471 37 207163 167104.63 40058.36667 38 93107 120212.88 -27105.87500 39 133763 167104.63 -33341.63333 40 246427 167104.63 79322.36667 41 224097 206543.29 17553.71429 42 142057 120212.88 21844.12500 43 94332 97220.59 -2888.58824 44 171724 167104.63 4619.36667 45 101683 97220.59 4462.41176 46 156753 120212.88 36540.12500 47 81293 58700.31 22592.69231 48 201984 167104.63 34879.36667 49 219875 206543.29 13331.71429 50 156589 206543.29 -49954.28571 51 48188 58700.31 -10512.30769 52 138146 167104.63 -28958.63333 53 279590 206543.29 73046.71429 54 234829 167104.63 67724.36667 55 181731 142903.50 38827.50000 56 141014 120212.88 20801.12500 57 189220 167104.63 22115.36667 58 76419 58700.31 17718.69231 59 151898 142903.50 8994.50000 60 189402 248925.43 -59523.42857 61 140189 142903.50 -2714.50000 62 123181 167104.63 -43923.63333 63 124234 120212.88 4021.12500 64 107277 142903.50 -35626.50000 65 153813 120212.88 33600.12500 66 94982 120212.88 -25230.87500 67 178613 206543.29 -27930.28571 68 138708 248925.43 -110217.42857 69 102378 97220.59 5157.41176 70 31970 11776.76 20193.23529 71 211635 206543.29 5091.71429 72 111885 120212.88 -8327.87500 73 99687 142903.50 -43216.50000 74 102900 120212.88 -17312.87500 75 156475 206543.29 -50068.28571 76 74513 120212.88 -45699.87500 77 159186 167104.63 -7918.63333 78 155818 206543.29 -50725.28571 79 60138 58700.31 1437.69231 80 84971 120212.88 -35241.87500 81 80478 97220.59 -16742.58824 82 244325 167104.63 77220.36667 83 56486 58700.31 -2214.30769 84 110743 120212.88 -9469.87500 85 75092 97220.59 -22128.58824 86 148286 120212.88 28073.12500 87 222914 206543.29 16370.71429 88 115019 142903.50 -27884.50000 89 93083 120212.88 -27129.87500 90 143258 120212.88 23045.12500 91 117794 120212.88 -2418.87500 92 158586 167104.63 -8518.63333 93 151465 120212.88 31252.12500 94 124626 120212.88 4413.12500 95 51801 58700.31 -6899.30769 96 223020 206543.29 16476.71429 97 188957 167104.63 21852.36667 98 19349 11776.76 7572.23529 99 188069 167104.63 20964.36667 100 150561 167104.63 -16543.63333 101 53921 58700.31 -4779.30769 102 58280 58700.31 -420.30769 103 124951 142903.50 -17952.50000 104 112263 120212.88 -7949.87500 105 72904 58700.31 14203.69231 106 27676 11776.76 15899.23529 107 131274 142903.50 -11629.50000 108 117451 97220.59 20230.41176 109 0 11776.76 -11776.76471 110 85610 97220.59 -11610.58824 111 107175 97220.59 9954.41176 112 133024 142903.50 -9879.50000 113 136473 142903.50 -6430.50000 114 71894 58700.31 13193.69231 115 3616 11776.76 -8160.76471 116 0 11776.76 -11776.76471 117 154806 97220.59 57585.41176 118 137977 142903.50 -4926.50000 119 149846 167104.63 -17258.63333 120 113245 97220.59 16024.41176 121 43410 58700.31 -15290.30769 122 170330 167104.63 3225.36667 123 89410 97220.59 -7810.58824 124 112749 167104.63 -54355.63333 125 60373 58700.31 1672.69231 126 19764 11776.76 7987.23529 127 160995 167104.63 -6109.63333 128 121052 97220.59 23831.41176 129 150039 142903.50 7135.50000 130 11796 11776.76 19.23529 131 10674 11776.76 -1102.76471 132 134836 120212.88 14623.12500 133 6836 11776.76 -4940.76471 134 153278 167104.63 -13826.63333 135 5118 11776.76 -6658.76471 136 40248 11776.76 28471.23529 137 0 11776.76 -11776.76471 138 117842 97220.59 20621.41176 139 87635 120212.88 -32577.87500 140 7131 11776.76 -4645.76471 141 8812 11776.76 -2964.76471 142 68916 97220.59 -28304.58824 143 132686 142903.50 -10217.50000 144 94127 97220.59 -3093.58824 > 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/4qzau1324477288.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/5yniv1324477288.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/6sygx1324477288.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/7o4vd1324477288.tab") + } > > try(system("convert tmp/2zvzp1324477288.ps tmp/2zvzp1324477288.png",intern=TRUE)) character(0) > try(system("convert tmp/3i4qf1324477288.ps tmp/3i4qf1324477288.png",intern=TRUE)) character(0) > try(system("convert tmp/4qzau1324477288.ps tmp/4qzau1324477288.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.726 0.388 4.111