R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(1407 + ,118540 + ,20 + ,15 + ,59 + ,18158 + ,22622 + ,30 + ,1072 + ,127145 + ,38 + ,16 + ,64 + ,30461 + ,73570 + ,42 + ,192 + ,7215 + ,0 + ,0 + ,0 + ,1423 + ,1929 + ,0 + ,2032 + ,112861 + ,49 + ,22 + ,68 + ,25629 + ,36294 + ,54 + ,3033 + ,197581 + ,70 + ,25 + ,100 + ,48758 + ,62378 + ,86 + ,5519 + ,377410 + ,104 + ,26 + ,100 + ,129230 + ,167760 + ,157 + ,1321 + ,117604 + ,37 + ,19 + ,72 + ,27376 + ,52443 + ,36 + ,1034 + ,120102 + ,46 + ,25 + ,96 + ,26706 + ,57283 + ,48 + ,1388 + ,96175 + ,42 + ,25 + ,90 + ,26505 + ,36614 + ,45 + ,2552 + ,253517 + ,62 + ,26 + ,104 + ,49801 + ,93268 + ,77 + ,1735 + ,108994 + ,50 + ,20 + ,54 + ,46580 + ,35439 + ,49 + ,1788 + ,156212 + ,65 + ,25 + ,98 + ,48352 + ,72405 + ,77 + ,1292 + ,68810 + ,28 + ,15 + ,49 + ,13899 + ,24044 + ,28 + ,2362 + ,149246 + ,48 + ,21 + ,84 + ,39342 + ,55909 + ,84 + ,1150 + ,125503 + ,42 + ,12 + ,45 + ,27465 + ,44689 + ,31 + ,1374 + ,125769 + ,47 + ,19 + ,74 + ,55211 + ,49319 + ,28 + ,1503 + ,123467 + ,71 + ,28 + ,112 + ,74098 + ,62075 + ,99 + ,965 + ,56088 + ,0 + ,12 + ,45 + ,13497 + ,2341 + ,2 + ,2164 + ,108128 + ,50 + ,28 + ,110 + ,38338 + ,40551 + ,41 + ,633 + ,22762 + ,12 + ,13 + ,39 + ,52505 + ,11621 + ,25 + ,837 + ,48554 + ,16 + ,14 + ,55 + ,10663 + ,18741 + ,16 + ,1991 + ,159102 + ,73 + ,23 + ,87 + ,74484 + ,84202 + ,96 + ,1450 + ,139108 + ,29 + ,25 + ,96 + ,28895 + ,15334 + ,23 + ,1765 + ,92058 + ,38 + ,30 + ,86 + ,32827 + ,28024 + ,33 + ,1612 + ,126311 + ,50 + ,17 + ,64 + ,36188 + ,53306 + ,46 + ,1173 + ,113807 + ,33 + ,17 + ,64 + ,28173 + ,37918 + ,59 + ,1603 + ,133994 + ,44 + ,21 + ,79 + ,54926 + ,54819 + ,72 + ,1046 + ,131810 + ,59 + ,24 + ,87 + ,38900 + ,89058 + ,72 + ,2176 + ,279065 + ,47 + ,22 + ,86 + ,88530 + ,103354 + ,62 + ,1767 + ,158146 + ,40 + ,16 + ,63 + ,35482 + ,70239 + ,55 + ,1167 + ,107352 + ,33 + ,23 + ,87 + ,26730 + ,33045 + ,27 + ,1394 + ,149827 + ,50 + ,18 + ,59 + ,29806 + ,63852 + ,41 + ,1733 + ,90912 + ,41 + ,11 + ,43 + ,41799 + ,30905 + ,51 + ,2374 + ,169510 + ,73 + ,20 + ,80 + ,54289 + ,24242 + ,26 + ,1852 + ,162204 + ,43 + ,20 + ,80 + ,36805 + ,78907 + ,65 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1677 + ,163310 + ,41 + ,24 + ,93 + ,33146 + ,36005 + ,28 + ,1505 + ,92342 + ,44 + ,14 + ,51 + ,23333 + ,31972 + ,44 + ,1813 + ,98357 + ,31 + ,29 + ,98 + ,47686 + ,35853 + ,36 + ,1648 + ,178277 + ,71 + ,31 + ,124 + ,77783 + ,115301 + ,100 + ,1560 + ,134927 + ,61 + ,15 + ,60 + ,36042 + ,47689 + ,104 + ,1301 + ,104577 + ,27 + ,30 + ,120 + ,34541 + ,34223 + ,35 + ,784 + ,81614 + ,21 + ,20 + ,75 + ,75620 + ,43431 + ,69 + ,1580 + ,119111 + ,42 + ,20 + ,78 + ,60610 + ,52220 + ,73 + ,897 + ,83923 + ,40 + ,18 + ,71 + ,55041 + ,33863 + ,106 + ,959 + ,109885 + ,34 + ,19 + ,70 + ,32087 + ,46879 + ,53 + ,567 + ,52851 + ,15 + ,28 + ,84 + ,16356 + ,23228 + ,43 + ,1519 + ,153621 + ,46 + ,18 + ,72 + ,40161 + ,42827 + ,49 + ,1625 + ,152572 + ,43 + ,26 + ,104 + ,55459 + ,65765 + ,38 + ,1817 + ,114073 + ,38 + ,23 + ,87 + ,36679 + ,38167 + ,51 + ,658 + ,48188 + ,12 + ,22 + ,82 + ,22346 + ,14812 + ,14 + ,1187 + ,90994 + ,42 + ,19 + ,73 + ,27377 + ,32615 + ,40 + ,1863 + ,215588 + ,56 + ,20 + ,75 + ,50273 + ,82188 + ,79 + ,1559 + ,176489 + ,41 + ,25 + ,92 + ,32104 + ,51763 + ,52 + ,1340 + ,138871 + ,46 + ,27 + ,105 + ,27016 + ,59325 + ,44 + ,1342 + ,104416 + ,30 + ,10 + ,37 + ,19715 + ,48976 + ,34 + ,1505 + ,156186 + ,44 + ,26 + ,96 + ,33629 + ,43384 + ,47 + ,669 + ,60368 + ,25 + ,21 + ,80 + ,27084 + ,26692 + ,32 + ,814 + ,95391 + ,42 + ,19 + ,76 + ,32352 + ,53279 + ,31 + ,2189 + ,126048 + ,28 + ,32 + ,118 + ,51845 + ,20652 + ,40 + ,1291 + ,96388 + ,33 + ,28 + ,112 + ,26591 + ,38338 + ,42 + ,1378 + ,77353 + ,32 + ,16 + ,64 + ,29677 + ,36735 + ,34 + ,1008 + ,83867 + ,22 + ,16 + ,55 + ,54237 + ,42764 + ,40 + ,823 + ,79772 + ,30 + ,20 + ,75 + ,20284 + ,44331 + ,35 + ,789 + ,96945 + ,13 + ,20 + ,73 + ,22741 + ,41354 + ,11 + ,1135 + ,88300 + ,35 + ,24 + ,90 + ,34178 + ,47879 + ,43 + ,1875 + ,126203 + ,39 + ,31 + ,124 + ,69551 + ,103793 + ,53 + ,2289 + ,110681 + ,68 + ,21 + ,78 + ,29653 + ,52235 + ,82 + ,817 + ,81299 + ,32 + ,21 + ,83 + ,38071 + ,49825 + ,41 + ,340 + ,31970 + ,5 + ,21 + ,78 + ,4157 + ,4105 + ,6 + ,2354 + ,185321 + ,53 + ,15 + ,59 + ,28321 + ,58687 + ,82 + ,992 + ,87611 + ,33 + ,9 + ,33 + ,40195 + ,40745 + ,47 + ,984 + ,73165 + ,44 + ,21 + ,84 + ,48158 + ,33187 + ,108 + ,1357 + ,82167 + ,36 + ,18 + ,52 + ,13310 + ,14063 + ,46 + ,2048 + ,109099 + ,52 + ,27 + ,106 + ,78474 + ,37407 + ,38 + ,933 + ,49164 + ,0 + ,24 + ,88 + ,6386 + ,7190 + ,0 + ,1600 + ,105181 + ,49 + ,22 + ,93 + ,31588 + ,49562 + ,45 + ,1821 + ,105922 + ,29 + ,21 + ,83 + ,61254 + ,76324 + ,57 + ,816 + ,60138 + ,16 + ,21 + ,75 + ,21152 + ,21928 + ,20 + ,1121 + ,73422 + ,33 + ,26 + ,96 + ,41272 + ,27860 + ,56 + ,800 + ,67727 + ,48 + ,22 + ,81 + ,34165 + ,28078 + ,38 + ,1447 + ,188098 + ,33 + ,22 + ,88 + ,37054 + ,49577 + ,42 + ,750 + ,51185 + ,24 + ,20 + ,76 + ,12368 + ,28145 + ,37 + ,1171 + ,84448 + ,33 + ,21 + ,78 + ,23168 + ,36241 + ,36 + ,662 + ,41956 + ,16 + ,19 + ,75 + ,16380 + ,10824 + ,34 + ,1284 + ,110827 + ,32 + ,19 + ,74 + ,41242 + ,46892 + ,53 + ,1980 + ,167055 + ,41 + ,25 + ,100 + ,48259 + ,60865 + ,83 + ,879 + ,63603 + ,36 + ,19 + ,76 + ,20790 + ,22933 + ,36 + ,869 + ,64995 + ,22 + ,21 + ,80 + ,34585 + ,20787 + ,33 + ,1000 + ,93424 + ,26 + ,18 + ,65 + ,35672 + ,43978 + ,57 + ,1240 + ,97229 + ,37 + ,23 + ,88 + ,52168 + ,51305 + ,50 + ,1771 + ,112819 + ,57 + ,18 + ,67 + ,53933 + ,55593 + ,71 + ,945 + ,111538 + ,20 + ,21 + ,81 + ,34474 + ,51648 + ,32 + ,1042 + ,102220 + ,24 + ,12 + ,48 + ,43753 + ,30552 + ,45 + ,629 + ,38721 + ,18 + ,9 + ,33 + ,36456 + ,23470 + ,33 + ,1770 + ,168764 + ,37 + ,26 + ,99 + ,51183 + ,77530 + ,53 + ,1454 + ,151588 + ,70 + ,21 + ,81 + ,52742 + ,57299 + ,64 + ,222 + ,19349 + ,13 + ,1 + ,2 + ,3895 + ,9604 + ,14 + ,1529 + ,125440 + ,18 + ,24 + ,96 + ,37076 + ,34684 + ,38 + ,1303 + ,101954 + ,32 + ,18 + ,65 + ,24079 + ,41094 + ,39 + ,552 + ,43803 + ,8 + ,4 + ,15 + ,2325 + ,3439 + ,8 + ,708 + ,47062 + ,38 + ,15 + ,48 + ,29354 + ,25171 + ,38 + ,998 + ,104220 + ,41 + ,19 + ,73 + ,30341 + ,23437 + ,24 + ,872 + ,85939 + ,24 + ,20 + ,72 + ,18992 + ,34086 + ,22 + ,584 + ,58660 + ,23 + ,12 + ,46 + ,15292 + ,24649 + ,18 + ,596 + ,27676 + ,2 + ,16 + ,59 + ,5842 + ,2342 + ,3 + ,926 + ,93448 + ,52 + ,21 + ,84 + ,28918 + ,45571 + ,49 + ,576 + ,43284 + ,5 + ,9 + ,29 + ,3738 + ,3255 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,868 + ,64333 + ,43 + ,21 + ,75 + ,95352 + ,30002 + ,47 + ,736 + ,57050 + ,18 + ,17 + ,63 + ,37478 + ,19360 + ,33 + ,998 + ,96933 + ,41 + ,18 + ,68 + ,26839 + ,43320 + ,44 + ,915 + ,70088 + ,45 + ,21 + ,84 + ,26783 + ,35513 + ,56 + ,782 + ,65494 + ,29 + ,17 + ,54 + ,33392 + ,23536 + ,49 + ,78 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,782 + ,135104 + ,32 + ,19 + ,72 + ,25446 + ,54438 + ,45 + ,1159 + ,95554 + ,41 + ,26 + ,87 + ,60038 + ,56815 + ,80 + ,1646 + ,120307 + ,17 + ,25 + ,100 + ,28162 + ,33838 + ,51 + ,749 + ,84336 + ,24 + ,20 + ,80 + ,33298 + ,32366 + ,25 + ,778 + ,43410 + ,7 + ,1 + ,3 + ,2781 + ,13 + ,1 + ,1335 + ,131452 + ,62 + ,21 + ,82 + ,37121 + ,55082 + ,62 + ,806 + ,79015 + ,30 + ,14 + ,55 + ,22698 + ,31334 + ,29 + ,1390 + ,88043 + ,49 + ,24 + ,88 + ,27615 + ,16612 + ,26 + ,680 + ,57578 + ,3 + ,12 + ,48 + ,32689 + ,5084 + ,4 + ,285 + ,19764 + ,10 + ,2 + ,8 + ,5752 + ,9927 + ,10 + ,1335 + ,105757 + ,42 + ,16 + ,60 + ,23164 + ,47413 + ,43 + ,840 + ,96410 + ,18 + ,22 + ,84 + ,20304 + ,27389 + ,36 + ,1231 + ,105056 + ,39 + ,28 + ,112 + ,34409 + ,30425 + ,43 + ,256 + ,11796 + ,1 + ,2 + ,8 + ,0 + ,0 + ,0 + ,80 + ,7627 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1163 + ,117413 + ,29 + ,17 + ,52 + ,92538 + ,33510 + ,33 + ,41 + ,6836 + ,0 + ,1 + ,4 + ,0 + ,0 + ,0 + ,1540 + ,131955 + ,45 + ,17 + ,57 + ,46037 + ,40389 + ,53 + ,42 + ,5118 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,528 + ,40248 + ,8 + ,4 + ,14 + ,5444 + ,6012 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,799 + ,77813 + ,16 + ,21 + ,78 + ,23924 + ,22205 + ,19 + ,1086 + ,67140 + ,16 + ,24 + ,82 + ,52230 + ,17231 + ,26 + ,81 + ,7131 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,61 + ,4194 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,849 + ,60378 + ,15 + ,15 + ,54 + ,8019 + ,11017 + ,16 + ,970 + ,96971 + ,40 + ,18 + ,69 + ,34542 + ,46741 + ,84 + ,964 + ,83484 + ,17 + ,19 + ,76 + ,21157 + ,39869 + ,28) + ,dim=c(8 + ,144) + ,dimnames=list(c('pageviews' + ,'timeinrfc' + ,'bloggedcomputatuon' + ,'reviewedcompendiums' + ,'totalnumberofsubfeedbackmessagesinPR' + ,'totalnumberofcharactersincompendium' + ,'totalnumberofsecondsincompendium' + ,'totalnumberofhyperlinksincompendium') + ,1:144)) > y <- array(NA,dim=c(8,144),dimnames=list(c('pageviews','timeinrfc','bloggedcomputatuon','reviewedcompendiums','totalnumberofsubfeedbackmessagesinPR','totalnumberofcharactersincompendium','totalnumberofsecondsincompendium','totalnumberofhyperlinksincompendium'),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 = '3' > par2 = 'none' > par1 = '4' > #'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] "reviewedcompendiums" > x[,par1] [1] 15 16 0 22 25 26 19 25 25 26 20 25 15 21 12 19 28 12 28 13 14 23 25 30 17 [26] 17 21 24 22 16 23 18 11 20 20 0 24 14 29 31 15 30 20 20 18 19 28 18 26 23 [51] 22 19 20 25 27 10 26 21 19 32 28 16 16 20 20 24 31 21 21 21 15 9 21 18 27 [76] 24 22 21 21 26 22 22 20 21 19 19 25 19 21 18 23 18 21 12 9 26 21 1 24 18 [101] 4 15 19 20 12 16 21 9 0 21 17 18 21 17 0 0 19 26 25 20 1 21 14 24 12 [126] 2 16 22 28 2 0 17 1 17 0 4 0 21 24 0 0 15 18 19 > 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 2 4 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 10 3 2 2 3 1 1 5 1 3 6 6 6 9 11 11 18 7 4 7 8 7 2 5 1 2 31 32 2 1 > colnames(x) [1] "pageviews" [2] "timeinrfc" [3] "bloggedcomputatuon" [4] "reviewedcompendiums" [5] "totalnumberofsubfeedbackmessagesinPR" [6] "totalnumberofcharactersincompendium" [7] "totalnumberofsecondsincompendium" [8] "totalnumberofhyperlinksincompendium" > colnames(x)[par1] [1] "reviewedcompendiums" > x[,par1] [1] 15 16 0 22 25 26 19 25 25 26 20 25 15 21 12 19 28 12 28 13 14 23 25 30 17 [26] 17 21 24 22 16 23 18 11 20 20 0 24 14 29 31 15 30 20 20 18 19 28 18 26 23 [51] 22 19 20 25 27 10 26 21 19 32 28 16 16 20 20 24 31 21 21 21 15 9 21 18 27 [76] 24 22 21 21 26 22 22 20 21 19 19 25 19 21 18 23 18 21 12 9 26 21 1 24 18 [101] 4 15 19 20 12 16 21 9 0 21 17 18 21 17 0 0 19 26 25 20 1 21 14 24 12 [126] 2 16 22 28 2 0 17 1 17 0 4 0 21 24 0 0 15 18 19 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/1193k1323705136.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: reviewedcompendiums Inputs: pageviews, timeinrfc, bloggedcomputatuon, totalnumberofsubfeedbackmessagesinPR, totalnumberofcharactersincompendium, totalnumberofsecondsincompendium, totalnumberofhyperlinksincompendium Number of observations: 144 1) totalnumberofsubfeedbackmessagesinPR <= 48; criterion = 1, statistic = 138.24 2) totalnumberofsubfeedbackmessagesinPR <= 15; criterion = 1, statistic = 27.528 3)* weights = 17 2) totalnumberofsubfeedbackmessagesinPR > 15 4)* weights = 12 1) totalnumberofsubfeedbackmessagesinPR > 48 5) totalnumberofsubfeedbackmessagesinPR <= 83; criterion = 1, statistic = 99.43 6) totalnumberofsubfeedbackmessagesinPR <= 67; criterion = 1, statistic = 49.062 7)* weights = 26 6) totalnumberofsubfeedbackmessagesinPR > 67 8) totalnumberofsubfeedbackmessagesinPR <= 76; criterion = 1, statistic = 18.595 9)* weights = 24 8) totalnumberofsubfeedbackmessagesinPR > 76 10)* weights = 19 5) totalnumberofsubfeedbackmessagesinPR > 83 11) totalnumberofsubfeedbackmessagesinPR <= 104; criterion = 1, statistic = 28.502 12) totalnumberofsubfeedbackmessagesinPR <= 93; criterion = 0.973, statistic = 8.334 13)* weights = 22 12) totalnumberofsubfeedbackmessagesinPR > 93 14)* weights = 14 11) totalnumberofsubfeedbackmessagesinPR > 104 15)* weights = 10 > postscript(file="/var/www/rcomp/tmp/2hc6x1323705136.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/www/rcomp/tmp/3y3vo1323705136.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 15 16.346154 -1.34615385 2 16 16.346154 -0.34615385 3 0 0.882353 -0.88235294 4 22 19.375000 2.62500000 5 25 25.642857 -0.64285714 6 26 25.642857 0.35714286 7 19 19.375000 -0.37500000 8 25 25.642857 -0.64285714 9 25 23.545455 1.45454545 10 26 25.642857 0.35714286 11 20 16.346154 3.65384615 12 25 25.642857 -0.64285714 13 15 16.346154 -1.34615385 14 21 23.545455 -2.54545455 15 12 11.333333 0.66666667 16 19 19.375000 -0.37500000 17 28 29.000000 -1.00000000 18 12 11.333333 0.66666667 19 28 29.000000 -1.00000000 20 13 11.333333 1.66666667 21 14 16.346154 -2.34615385 22 23 23.545455 -0.54545455 23 25 25.642857 -0.64285714 24 30 23.545455 6.45454545 25 17 16.346154 0.65384615 26 17 16.346154 0.65384615 27 21 21.052632 -0.05263158 28 24 23.545455 0.45454545 29 22 23.545455 -1.54545455 30 16 16.346154 -0.34615385 31 23 23.545455 -0.54545455 32 18 16.346154 1.65384615 33 11 11.333333 -0.33333333 34 20 21.052632 -1.05263158 35 20 21.052632 -1.05263158 36 0 0.882353 -0.88235294 37 24 23.545455 0.45454545 38 14 16.346154 -2.34615385 39 29 25.642857 3.35714286 40 31 29.000000 2.00000000 41 15 16.346154 -1.34615385 42 30 29.000000 1.00000000 43 20 19.375000 0.62500000 44 20 21.052632 -1.05263158 45 18 19.375000 -1.37500000 46 19 19.375000 -0.37500000 47 28 23.545455 4.45454545 48 18 19.375000 -1.37500000 49 26 25.642857 0.35714286 50 23 23.545455 -0.54545455 51 22 21.052632 0.94736842 52 19 19.375000 -0.37500000 53 20 19.375000 0.62500000 54 25 23.545455 1.45454545 55 27 29.000000 -2.00000000 56 10 11.333333 -1.33333333 57 26 25.642857 0.35714286 58 21 21.052632 -0.05263158 59 19 19.375000 -0.37500000 60 32 29.000000 3.00000000 61 28 29.000000 -1.00000000 62 16 16.346154 -0.34615385 63 16 16.346154 -0.34615385 64 20 19.375000 0.62500000 65 20 19.375000 0.62500000 66 24 23.545455 0.45454545 67 31 29.000000 2.00000000 68 21 21.052632 -0.05263158 69 21 21.052632 -0.05263158 70 21 21.052632 -0.05263158 71 15 16.346154 -1.34615385 72 9 11.333333 -2.33333333 73 21 23.545455 -2.54545455 74 18 16.346154 1.65384615 75 27 29.000000 -2.00000000 76 24 23.545455 0.45454545 77 22 23.545455 -1.54545455 78 21 21.052632 -0.05263158 79 21 19.375000 1.62500000 80 26 25.642857 0.35714286 81 22 21.052632 0.94736842 82 22 23.545455 -1.54545455 83 20 19.375000 0.62500000 84 21 21.052632 -0.05263158 85 19 19.375000 -0.37500000 86 19 19.375000 -0.37500000 87 25 25.642857 -0.64285714 88 19 19.375000 -0.37500000 89 21 21.052632 -0.05263158 90 18 16.346154 1.65384615 91 23 23.545455 -0.54545455 92 18 16.346154 1.65384615 93 21 21.052632 -0.05263158 94 12 11.333333 0.66666667 95 9 11.333333 -2.33333333 96 26 25.642857 0.35714286 97 21 21.052632 -0.05263158 98 1 0.882353 0.11764706 99 24 25.642857 -1.64285714 100 18 16.346154 1.65384615 101 4 0.882353 3.11764706 102 15 11.333333 3.66666667 103 19 19.375000 -0.37500000 104 20 19.375000 0.62500000 105 12 11.333333 0.66666667 106 16 16.346154 -0.34615385 107 21 23.545455 -2.54545455 108 9 11.333333 -2.33333333 109 0 0.882353 -0.88235294 110 21 19.375000 1.62500000 111 17 16.346154 0.65384615 112 18 19.375000 -1.37500000 113 21 23.545455 -2.54545455 114 17 16.346154 0.65384615 115 0 0.882353 -0.88235294 116 0 0.882353 -0.88235294 117 19 19.375000 -0.37500000 118 26 23.545455 2.45454545 119 25 25.642857 -0.64285714 120 20 21.052632 -1.05263158 121 1 0.882353 0.11764706 122 21 21.052632 -0.05263158 123 14 16.346154 -2.34615385 124 24 23.545455 0.45454545 125 12 11.333333 0.66666667 126 2 0.882353 1.11764706 127 16 16.346154 -0.34615385 128 22 23.545455 -1.54545455 129 28 29.000000 -1.00000000 130 2 0.882353 1.11764706 131 0 0.882353 -0.88235294 132 17 16.346154 0.65384615 133 1 0.882353 0.11764706 134 17 16.346154 0.65384615 135 0 0.882353 -0.88235294 136 4 0.882353 3.11764706 137 0 0.882353 -0.88235294 138 21 21.052632 -0.05263158 139 24 21.052632 2.94736842 140 0 0.882353 -0.88235294 141 0 0.882353 -0.88235294 142 15 16.346154 -1.34615385 143 18 19.375000 -1.37500000 144 19 19.375000 -0.37500000 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/rcomp/tmp/4o3fg1323705136.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/www/rcomp/tmp/5vaaq1323705136.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/www/rcomp/tmp/6xk0d1323705136.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/www/rcomp/tmp/7b99o1323705136.tab") + } > > try(system("convert tmp/2hc6x1323705136.ps tmp/2hc6x1323705136.png",intern=TRUE)) character(0) > try(system("convert tmp/3y3vo1323705136.ps tmp/3y3vo1323705136.png",intern=TRUE)) character(0) > try(system("convert tmp/4o3fg1323705136.ps tmp/4o3fg1323705136.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.430 0.250 2.651