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(70 + ,500 + ,20 + ,18 + ,129404 + ,22622 + ,28 + ,68 + ,329 + ,38 + ,17 + ,130358 + ,73570 + ,39 + ,0 + ,72 + ,0 + ,0 + ,7215 + ,1929 + ,0 + ,68 + ,584 + ,49 + ,22 + ,112861 + ,36294 + ,54 + ,120 + ,1100 + ,76 + ,30 + ,219904 + ,62378 + ,80 + ,120 + ,1585 + ,104 + ,31 + ,397355 + ,167760 + ,144 + ,72 + ,442 + ,37 + ,19 + ,117604 + ,52443 + ,36 + ,96 + ,321 + ,53 + ,25 + ,126737 + ,57283 + ,48 + ,109 + ,406 + ,42 + ,30 + ,99729 + ,36614 + ,42 + ,104 + ,818 + ,62 + ,26 + ,256310 + ,93268 + ,71 + ,54 + ,568 + ,50 + ,20 + ,113066 + ,35439 + ,49 + ,98 + ,556 + ,65 + ,25 + ,157228 + ,72405 + ,74 + ,49 + ,494 + ,28 + ,15 + ,69952 + ,24044 + ,27 + ,88 + ,818 + ,48 + ,22 + ,152673 + ,55909 + ,83 + ,57 + ,338 + ,42 + ,16 + ,130642 + ,44689 + ,31 + ,74 + ,419 + ,47 + ,19 + ,125769 + ,49319 + ,28 + ,112 + ,364 + ,71 + ,28 + ,123467 + ,62075 + ,98 + ,45 + ,284 + ,0 + ,12 + ,56232 + ,2341 + ,2 + ,110 + ,674 + ,50 + ,28 + ,108330 + ,40551 + ,43 + ,39 + ,188 + ,12 + ,13 + ,22762 + ,11621 + ,24 + ,55 + ,286 + ,16 + ,14 + ,48554 + ,18741 + ,16 + ,102 + ,640 + ,77 + ,27 + ,182081 + ,84202 + ,95 + ,96 + ,520 + ,29 + ,25 + ,140857 + ,15334 + ,22 + ,86 + ,532 + ,38 + ,30 + ,93773 + ,28024 + ,33 + ,78 + ,547 + ,50 + ,21 + ,133398 + ,53306 + ,45 + ,64 + ,428 + ,33 + ,17 + ,113933 + ,37918 + ,59 + ,82 + ,561 + ,49 + ,22 + ,153851 + ,54819 + ,66 + ,100 + ,266 + ,59 + ,28 + ,140711 + ,89058 + ,70 + ,99 + ,783 + ,55 + ,26 + ,303804 + ,103354 + ,56 + ,67 + ,746 + ,40 + ,17 + ,161651 + ,70239 + ,55 + ,87 + ,394 + ,40 + ,23 + ,123344 + ,33045 + ,27 + ,65 + ,482 + ,51 + ,20 + ,157640 + ,63852 + ,37 + ,43 + ,568 + ,41 + ,11 + ,91279 + ,30905 + ,48 + ,80 + ,746 + ,73 + ,20 + ,189374 + ,24242 + ,26 + ,84 + ,668 + ,51 + ,21 + ,178768 + ,78907 + ,64 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,105 + ,835 + ,46 + ,27 + ,175403 + ,36005 + ,21 + ,51 + ,464 + ,44 + ,14 + ,92342 + ,31972 + ,44 + ,98 + ,418 + ,31 + ,29 + ,100023 + ,35853 + ,36 + ,124 + ,607 + ,71 + ,31 + ,178277 + ,115301 + ,89 + ,75 + ,539 + ,61 + ,19 + ,145062 + ,47689 + ,101 + ,120 + ,519 + ,28 + ,30 + ,110980 + ,34223 + ,31 + ,84 + ,309 + ,21 + ,23 + ,86039 + ,43431 + ,65 + ,82 + ,647 + ,42 + ,21 + ,125481 + ,52220 + ,71 + ,87 + ,321 + ,44 + ,22 + ,95535 + ,33863 + ,102 + ,78 + ,261 + ,40 + ,21 + ,126456 + ,46879 + ,53 + ,97 + ,180 + ,15 + ,32 + ,61554 + ,23228 + ,41 + ,76 + ,576 + ,46 + ,19 + ,164752 + ,42827 + ,46 + ,104 + ,544 + ,43 + ,26 + ,159121 + ,65765 + ,37 + ,93 + ,758 + ,47 + ,25 + ,129362 + ,38167 + ,51 + ,82 + ,205 + ,12 + ,22 + ,48188 + ,14812 + ,14 + ,73 + ,317 + ,46 + ,19 + ,95461 + ,32615 + ,40 + ,87 + ,709 + ,56 + ,24 + ,229864 + ,82188 + ,77 + ,95 + ,590 + ,47 + ,26 + ,191094 + ,51763 + ,51 + ,105 + ,526 + ,48 + ,27 + ,150640 + ,59325 + ,43 + ,37 + ,443 + ,35 + ,10 + ,111388 + ,48976 + ,33 + ,96 + ,419 + ,44 + ,26 + ,165098 + ,43384 + ,47 + ,88 + ,205 + ,25 + ,23 + ,63205 + ,26692 + ,31 + ,83 + ,310 + ,47 + ,21 + ,109102 + ,53279 + ,31 + ,124 + ,785 + ,28 + ,34 + ,137303 + ,20652 + ,40 + ,116 + ,434 + ,48 + ,29 + ,125304 + ,38338 + ,42 + ,76 + ,576 + ,32 + ,19 + ,85332 + ,36735 + ,35 + ,65 + ,317 + ,28 + ,19 + ,95808 + ,42764 + ,40 + ,86 + ,288 + ,31 + ,23 + ,83419 + ,44331 + ,30 + ,85 + ,285 + ,13 + ,22 + ,101723 + ,41354 + ,11 + ,107 + ,391 + ,38 + ,29 + ,94982 + ,47879 + ,41 + ,124 + ,446 + ,39 + ,31 + ,129700 + ,103793 + ,53 + ,78 + ,715 + ,68 + ,21 + ,113325 + ,52235 + ,82 + ,83 + ,208 + ,32 + ,21 + ,81518 + ,49825 + ,41 + ,78 + ,101 + ,5 + ,21 + ,31970 + ,4105 + ,6 + ,59 + ,858 + ,53 + ,15 + ,192268 + ,58687 + ,81 + ,33 + ,302 + ,33 + ,9 + ,91086 + ,40745 + ,47 + ,92 + ,360 + ,54 + ,23 + ,80820 + ,33187 + ,100 + ,52 + ,411 + ,36 + ,18 + ,83261 + ,14063 + ,46 + ,121 + ,561 + ,52 + ,31 + ,116290 + ,37407 + ,38 + ,92 + ,292 + ,0 + ,25 + ,56544 + ,7190 + ,0 + ,99 + ,492 + ,52 + ,24 + ,116173 + ,49562 + ,45 + ,86 + ,669 + ,45 + ,22 + ,111488 + ,76324 + ,56 + ,75 + ,253 + ,16 + ,21 + ,60138 + ,21928 + ,18 + ,96 + ,366 + ,33 + ,26 + ,73422 + ,27860 + ,54 + ,81 + ,192 + ,48 + ,22 + ,67751 + ,28078 + ,37 + ,104 + ,616 + ,33 + ,26 + ,213351 + ,49577 + ,40 + ,76 + ,221 + ,24 + ,20 + ,51185 + ,28145 + ,37 + ,90 + ,438 + ,37 + ,25 + ,97181 + ,36241 + ,36 + ,75 + ,247 + ,17 + ,19 + ,45100 + ,10824 + ,34 + ,86 + ,388 + ,32 + ,22 + ,115801 + ,46892 + ,49 + ,100 + ,541 + ,55 + ,25 + ,186310 + ,61264 + ,82 + ,88 + ,233 + ,39 + ,22 + ,71960 + ,22933 + ,36 + ,80 + ,333 + ,31 + ,21 + ,80105 + ,20787 + ,33 + ,73 + ,422 + ,26 + ,20 + ,103613 + ,43978 + ,55 + ,88 + ,452 + ,37 + ,23 + ,98707 + ,51305 + ,50 + ,79 + ,584 + ,66 + ,22 + ,136234 + ,55593 + ,71 + ,81 + ,366 + ,35 + ,21 + ,136781 + ,51648 + ,31 + ,48 + ,406 + ,24 + ,12 + ,105863 + ,30552 + ,42 + ,33 + ,254 + ,18 + ,9 + ,38775 + ,23470 + ,31 + ,120 + ,606 + ,37 + ,32 + ,179997 + ,77530 + ,51 + ,90 + ,491 + ,86 + ,24 + ,169406 + ,57299 + ,64 + ,2 + ,67 + ,13 + ,1 + ,19349 + ,9604 + ,14 + ,96 + ,607 + ,21 + ,24 + ,153069 + ,34684 + ,37 + ,86 + ,597 + ,32 + ,25 + ,109510 + ,41094 + ,37 + ,15 + ,240 + ,8 + ,4 + ,43803 + ,3439 + ,8 + ,48 + ,219 + ,38 + ,15 + ,47062 + ,25171 + ,38 + ,81 + ,349 + ,45 + ,21 + ,110845 + ,23437 + ,23 + ,84 + ,241 + ,24 + ,23 + ,92517 + ,34086 + ,22 + ,46 + ,136 + ,23 + ,12 + ,58660 + ,24649 + ,18 + ,59 + ,194 + ,2 + ,16 + ,27676 + ,2342 + ,1 + ,96 + ,222 + ,52 + ,24 + ,98550 + ,45571 + ,48 + ,29 + ,153 + ,5 + ,9 + ,43646 + ,3255 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,83 + ,251 + ,43 + ,23 + ,67312 + ,30002 + ,46 + ,63 + ,240 + ,18 + ,17 + ,57359 + ,19360 + ,33 + ,68 + ,358 + ,44 + ,18 + ,104330 + ,43320 + ,41 + ,84 + ,302 + ,45 + ,21 + ,70369 + ,35513 + ,57 + ,54 + ,267 + ,29 + ,17 + ,65494 + ,23536 + ,49 + ,0 + ,14 + ,0 + ,0 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,75 + ,287 + ,32 + ,20 + ,143931 + ,54438 + ,45 + ,87 + ,476 + ,65 + ,26 + ,117946 + ,56812 + ,78 + ,104 + ,509 + ,26 + ,26 + ,131175 + ,33838 + ,46 + ,80 + ,243 + ,24 + ,20 + ,84336 + ,32366 + ,25 + ,3 + ,292 + ,7 + ,1 + ,43410 + ,13 + ,1 + ,93 + ,410 + ,62 + ,24 + ,136250 + ,55082 + ,59 + ,55 + ,217 + ,30 + ,14 + ,79015 + ,31334 + ,29 + ,96 + ,422 + ,49 + ,26 + ,92937 + ,16612 + ,26 + ,48 + ,160 + ,3 + ,12 + ,57586 + ,5084 + ,4 + ,8 + ,75 + ,10 + ,2 + ,19764 + ,9927 + ,10 + ,60 + ,412 + ,42 + ,16 + ,105757 + ,47413 + ,43 + ,84 + ,309 + ,18 + ,22 + ,97213 + ,27389 + ,36 + ,112 + ,417 + ,40 + ,28 + ,113402 + ,30425 + ,41 + ,8 + ,79 + ,1 + ,2 + ,11796 + ,0 + ,0 + ,0 + ,25 + ,0 + ,0 + ,7627 + ,0 + ,0 + ,52 + ,431 + ,29 + ,17 + ,121085 + ,33510 + ,32 + ,4 + ,11 + ,0 + ,1 + ,6836 + ,0 + ,0 + ,57 + ,564 + ,46 + ,17 + ,139563 + ,40389 + ,53 + ,0 + ,6 + ,5 + ,0 + ,5118 + ,0 + ,0 + ,14 + ,183 + ,8 + ,4 + ,40248 + ,6012 + ,6 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,91 + ,295 + ,21 + ,25 + ,95079 + ,22205 + ,18 + ,89 + ,230 + ,21 + ,26 + ,80763 + ,17231 + ,26 + ,0 + ,27 + ,0 + ,0 + ,7131 + ,0 + ,0 + ,0 + ,14 + ,0 + ,0 + ,4194 + ,0 + ,0 + ,54 + ,240 + ,15 + ,15 + ,60378 + ,11017 + ,16 + ,77 + ,251 + ,47 + ,20 + ,109173 + ,46741 + ,84 + ,76 + ,347 + ,17 + ,19 + ,83484 + ,39869 + ,22) + ,dim=c(7 + ,144) + ,dimnames=list(c('FMPeerReview' + ,'CompendiumViews' + ,'BloggedComputations' + ,'ReviewedCompendiums' + ,'TimeRFC' + ,'CWSeconds' + ,'CWBlogs') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('FMPeerReview','CompendiumViews','BloggedComputations','ReviewedCompendiums','TimeRFC','CWSeconds','CWBlogs'),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 = 'none' > 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) Warning message: NAs introduced by coercion > 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] "FMPeerReview" > x[,par1] [1] 70 68 0 68 120 120 72 96 109 104 54 98 49 88 57 74 112 45 [19] 110 39 55 102 96 86 78 64 82 100 99 67 87 65 43 80 84 0 [37] 105 51 98 124 75 120 84 82 87 78 97 76 104 93 82 73 87 95 [55] 105 37 96 88 83 124 116 76 65 86 85 107 124 78 83 78 59 33 [73] 92 52 121 92 99 86 75 96 81 104 76 90 75 86 100 88 80 73 [91] 88 79 81 48 33 120 90 2 96 86 15 48 81 84 46 59 96 29 [109] 0 83 63 68 84 54 0 0 75 87 104 80 3 93 55 96 48 8 [127] 60 84 112 8 0 52 4 57 0 14 0 91 89 0 0 54 77 76 > 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 2 3 4 8 14 15 29 33 37 39 43 45 46 48 49 51 52 54 55 10 1 1 1 2 1 1 1 2 1 1 1 1 1 3 1 1 2 3 2 57 59 60 63 64 65 67 68 70 72 73 74 75 76 77 78 79 80 81 82 2 2 1 1 1 2 1 3 1 1 2 1 4 4 1 4 1 3 3 3 83 84 85 86 87 88 89 90 91 92 93 95 96 97 98 99 100 102 104 105 3 5 1 5 4 4 1 2 1 2 2 1 7 1 2 2 2 1 4 2 107 109 110 112 116 120 121 124 1 1 1 2 1 4 1 3 > colnames(x) [1] "FMPeerReview" "CompendiumViews" "BloggedComputations" [4] "ReviewedCompendiums" "TimeRFC" "CWSeconds" [7] "CWBlogs" > colnames(x)[par1] [1] "FMPeerReview" > x[,par1] [1] 70 68 0 68 120 120 72 96 109 104 54 98 49 88 57 74 112 45 [19] 110 39 55 102 96 86 78 64 82 100 99 67 87 65 43 80 84 0 [37] 105 51 98 124 75 120 84 82 87 78 97 76 104 93 82 73 87 95 [55] 105 37 96 88 83 124 116 76 65 86 85 107 124 78 83 78 59 33 [73] 92 52 121 92 99 86 75 96 81 104 76 90 75 86 100 88 80 73 [91] 88 79 81 48 33 120 90 2 96 86 15 48 81 84 46 59 96 29 [109] 0 83 63 68 84 54 0 0 75 87 104 80 3 93 55 96 48 8 [127] 60 84 112 8 0 52 4 57 0 14 0 91 89 0 0 54 77 76 > 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/1pyak1323975549.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: FMPeerReview Inputs: CompendiumViews, BloggedComputations, ReviewedCompendiums, TimeRFC, CWSeconds, CWBlogs Number of observations: 144 1) ReviewedCompendiums <= 15; criterion = 1, statistic = 138.545 2) ReviewedCompendiums <= 4; criterion = 1, statistic = 32.471 3)* weights = 17 2) ReviewedCompendiums > 4 4)* weights = 17 1) ReviewedCompendiums > 15 5) ReviewedCompendiums <= 23; criterion = 1, statistic = 93.764 6) ReviewedCompendiums <= 18; criterion = 1, statistic = 44.931 7)* weights = 13 6) ReviewedCompendiums > 18 8) ReviewedCompendiums <= 20; criterion = 1, statistic = 23.35 9)* weights = 17 8) ReviewedCompendiums > 20 10) ReviewedCompendiums <= 22; criterion = 0.981, statistic = 8.716 11)* weights = 25 10) ReviewedCompendiums > 22 12)* weights = 8 5) ReviewedCompendiums > 23 13) ReviewedCompendiums <= 26; criterion = 1, statistic = 26.499 14)* weights = 26 13) ReviewedCompendiums > 26 15)* weights = 21 > postscript(file="/var/wessaorg/rcomp/tmp/2v7f51323975549.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/30e5l1323975549.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 70 60.846154 9.15384615 2 68 60.846154 7.15384615 3 0 3.176471 -3.17647059 4 68 81.640000 -13.64000000 5 120 111.047619 8.95238095 6 120 111.047619 8.95238095 7 72 73.058824 -1.05882353 8 96 95.269231 0.73076923 9 109 111.047619 -2.04761905 10 104 95.269231 8.73076923 11 54 73.058824 -19.05882353 12 98 95.269231 2.73076923 13 49 45.411765 3.58823529 14 88 81.640000 6.36000000 15 57 60.846154 -3.84615385 16 74 73.058824 0.94117647 17 112 111.047619 0.95238095 18 45 45.411765 -0.41176471 19 110 111.047619 -1.04761905 20 39 45.411765 -6.41176471 21 55 45.411765 9.58823529 22 102 111.047619 -9.04761905 23 96 95.269231 0.73076923 24 86 111.047619 -25.04761905 25 78 81.640000 -3.64000000 26 64 60.846154 3.15384615 27 82 81.640000 0.36000000 28 100 111.047619 -11.04761905 29 99 95.269231 3.73076923 30 67 60.846154 6.15384615 31 87 86.500000 0.50000000 32 65 73.058824 -8.05882353 33 43 45.411765 -2.41176471 34 80 73.058824 6.94117647 35 84 81.640000 2.36000000 36 0 3.176471 -3.17647059 37 105 111.047619 -6.04761905 38 51 45.411765 5.58823529 39 98 111.047619 -13.04761905 40 124 111.047619 12.95238095 41 75 73.058824 1.94117647 42 120 111.047619 8.95238095 43 84 86.500000 -2.50000000 44 82 81.640000 0.36000000 45 87 81.640000 5.36000000 46 78 81.640000 -3.64000000 47 97 111.047619 -14.04761905 48 76 73.058824 2.94117647 49 104 95.269231 8.73076923 50 93 95.269231 -2.26923077 51 82 81.640000 0.36000000 52 73 73.058824 -0.05882353 53 87 95.269231 -8.26923077 54 95 95.269231 -0.26923077 55 105 111.047619 -6.04761905 56 37 45.411765 -8.41176471 57 96 95.269231 0.73076923 58 88 86.500000 1.50000000 59 83 81.640000 1.36000000 60 124 111.047619 12.95238095 61 116 111.047619 4.95238095 62 76 73.058824 2.94117647 63 65 73.058824 -8.05882353 64 86 86.500000 -0.50000000 65 85 81.640000 3.36000000 66 107 111.047619 -4.04761905 67 124 111.047619 12.95238095 68 78 81.640000 -3.64000000 69 83 81.640000 1.36000000 70 78 81.640000 -3.64000000 71 59 45.411765 13.58823529 72 33 45.411765 -12.41176471 73 92 86.500000 5.50000000 74 52 60.846154 -8.84615385 75 121 111.047619 9.95238095 76 92 95.269231 -3.26923077 77 99 95.269231 3.73076923 78 86 81.640000 4.36000000 79 75 81.640000 -6.64000000 80 96 95.269231 0.73076923 81 81 81.640000 -0.64000000 82 104 95.269231 8.73076923 83 76 73.058824 2.94117647 84 90 95.269231 -5.26923077 85 75 73.058824 1.94117647 86 86 81.640000 4.36000000 87 100 95.269231 4.73076923 88 88 81.640000 6.36000000 89 80 81.640000 -1.64000000 90 73 73.058824 -0.05882353 91 88 86.500000 1.50000000 92 79 81.640000 -2.64000000 93 81 81.640000 -0.64000000 94 48 45.411765 2.58823529 95 33 45.411765 -12.41176471 96 120 111.047619 8.95238095 97 90 95.269231 -5.26923077 98 2 3.176471 -1.17647059 99 96 95.269231 0.73076923 100 86 95.269231 -9.26923077 101 15 3.176471 11.82352941 102 48 45.411765 2.58823529 103 81 81.640000 -0.64000000 104 84 86.500000 -2.50000000 105 46 45.411765 0.58823529 106 59 60.846154 -1.84615385 107 96 95.269231 0.73076923 108 29 45.411765 -16.41176471 109 0 3.176471 -3.17647059 110 83 86.500000 -3.50000000 111 63 60.846154 2.15384615 112 68 60.846154 7.15384615 113 84 81.640000 2.36000000 114 54 60.846154 -6.84615385 115 0 3.176471 -3.17647059 116 0 3.176471 -3.17647059 117 75 73.058824 1.94117647 118 87 95.269231 -8.26923077 119 104 95.269231 8.73076923 120 80 73.058824 6.94117647 121 3 3.176471 -0.17647059 122 93 95.269231 -2.26923077 123 55 45.411765 9.58823529 124 96 95.269231 0.73076923 125 48 45.411765 2.58823529 126 8 3.176471 4.82352941 127 60 60.846154 -0.84615385 128 84 81.640000 2.36000000 129 112 111.047619 0.95238095 130 8 3.176471 4.82352941 131 0 3.176471 -3.17647059 132 52 60.846154 -8.84615385 133 4 3.176471 0.82352941 134 57 60.846154 -3.84615385 135 0 3.176471 -3.17647059 136 14 3.176471 10.82352941 137 0 3.176471 -3.17647059 138 91 95.269231 -4.26923077 139 89 95.269231 -6.26923077 140 0 3.176471 -3.17647059 141 0 3.176471 -3.17647059 142 54 45.411765 8.58823529 143 77 73.058824 3.94117647 144 76 73.058824 2.94117647 > 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/47xrl1323975549.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/57vsl1323975549.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/6k3m81323975549.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/79ds61323975549.tab") + } > > try(system("convert tmp/2v7f51323975549.ps tmp/2v7f51323975549.png",intern=TRUE)) character(0) > try(system("convert tmp/30e5l1323975549.ps tmp/30e5l1323975549.png",intern=TRUE)) character(0) > try(system("convert tmp/47xrl1323975549.ps tmp/47xrl1323975549.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.246 0.238 3.485