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(1845 + ,162687 + ,95 + ,595 + ,115 + ,0 + ,48 + ,1917 + ,233285 + ,67 + ,580 + ,79 + ,1 + ,75 + ,192 + ,7215 + ,18 + ,72 + ,1 + ,0 + ,0 + ,2665 + ,164587 + ,99 + ,737 + ,158 + ,0 + ,74 + ,3709 + ,283430 + ,141 + ,1255 + ,127 + ,0 + ,92 + ,7138 + ,546996 + ,275 + ,2021 + ,278 + ,1 + ,137 + ,1888 + ,192501 + ,61 + ,606 + ,95 + ,1 + ,65 + ,1909 + ,213538 + ,64 + ,533 + ,64 + ,0 + ,97 + ,2140 + ,182282 + ,46 + ,687 + ,92 + ,0 + ,62 + ,3168 + ,336547 + ,102 + ,1074 + ,130 + ,1 + ,72 + ,1957 + ,122275 + ,77 + ,637 + ,158 + ,2 + ,50 + ,2370 + ,203938 + ,72 + ,743 + ,120 + ,0 + ,88 + ,1998 + ,119300 + ,110 + ,701 + ,87 + ,0 + ,68 + ,3203 + ,220796 + ,122 + ,1087 + ,264 + ,4 + ,79 + ,1505 + ,174005 + ,67 + ,422 + ,51 + ,4 + ,56 + ,1574 + ,156326 + ,89 + ,474 + ,85 + ,3 + ,54 + ,1965 + ,164063 + ,60 + ,483 + ,100 + ,0 + ,101 + ,1314 + ,90025 + ,63 + ,375 + ,72 + ,5 + ,13 + ,2921 + ,179987 + ,90 + ,929 + ,147 + ,0 + ,80 + ,823 + ,47066 + ,29 + ,262 + ,49 + ,0 + ,19 + ,1289 + ,109572 + ,64 + ,437 + ,40 + ,0 + ,33 + ,2818 + ,241285 + ,103 + ,850 + ,99 + ,0 + ,99 + ,1792 + ,208339 + ,77 + ,652 + ,127 + ,1 + ,38 + ,2474 + ,164166 + ,59 + ,754 + ,166 + ,1 + ,68 + ,1994 + ,159763 + ,89 + ,619 + ,41 + ,1 + ,54 + ,1806 + ,207078 + ,34 + ,657 + ,160 + ,0 + ,63 + ,2177 + ,217028 + ,169 + ,695 + ,92 + ,0 + ,66 + ,1458 + ,201536 + ,96 + ,366 + ,59 + ,0 + ,90 + ,3057 + ,408960 + ,124 + ,1015 + ,89 + ,0 + ,75 + ,2487 + ,250260 + ,48 + ,1029 + ,104 + ,0 + ,68 + ,1914 + ,216527 + ,46 + ,576 + ,81 + ,0 + ,69 + ,1825 + ,212949 + ,51 + ,656 + ,116 + ,2 + ,80 + ,2509 + ,164248 + ,110 + ,812 + ,105 + ,4 + ,59 + ,3634 + ,278911 + ,136 + ,1108 + ,388 + ,0 + ,135 + ,2608 + ,238654 + ,59 + ,852 + ,88 + ,1 + ,75 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,2157 + ,233971 + ,66 + ,1009 + ,63 + ,0 + ,54 + ,1978 + ,149649 + ,55 + ,658 + ,138 + ,3 + ,62 + ,2224 + ,161703 + ,52 + ,547 + ,270 + ,9 + ,46 + ,2215 + ,254893 + ,70 + ,826 + ,64 + ,0 + ,83 + ,2538 + ,269492 + ,73 + ,838 + ,96 + ,2 + ,106 + ,1881 + ,169526 + ,62 + ,704 + ,62 + ,0 + ,51 + ,1113 + ,107893 + ,35 + ,404 + ,35 + ,2 + ,27 + ,2380 + ,229714 + ,83 + ,848 + ,66 + ,1 + ,78 + ,1365 + ,139667 + ,51 + ,419 + ,56 + ,2 + ,71 + ,1294 + ,175983 + ,102 + ,349 + ,46 + ,2 + ,44 + ,756 + ,81407 + ,33 + ,216 + ,49 + ,1 + ,23 + ,2465 + ,251259 + ,110 + ,796 + ,121 + ,0 + ,78 + ,2327 + ,239807 + ,90 + ,752 + ,113 + ,1 + ,60 + ,2787 + ,172743 + ,60 + ,964 + ,190 + ,8 + ,73 + ,658 + ,48188 + ,28 + ,205 + ,37 + ,0 + ,12 + ,2013 + ,169355 + ,71 + ,506 + ,52 + ,0 + ,104 + ,2666 + ,335398 + ,78 + ,841 + ,89 + ,0 + ,95 + ,2086 + ,244729 + ,81 + ,699 + ,73 + ,0 + ,57 + ,2067 + ,208286 + ,62 + ,746 + ,61 + ,1 + ,68 + ,1776 + ,159913 + ,58 + ,547 + ,77 + ,8 + ,44 + ,2045 + ,232137 + ,72 + ,561 + ,63 + ,0 + ,62 + ,1047 + ,101694 + ,26 + ,329 + ,75 + ,1 + ,26 + ,1190 + ,157258 + ,68 + ,427 + ,32 + ,0 + ,67 + ,2932 + ,211586 + ,101 + ,993 + ,59 + ,10 + ,36 + ,1868 + ,181076 + ,66 + ,564 + ,71 + ,6 + ,56 + ,2316 + ,158024 + ,86 + ,858 + ,92 + ,0 + ,55 + ,1392 + ,141491 + ,64 + ,376 + ,87 + ,11 + ,54 + ,1355 + ,130108 + ,40 + ,471 + ,48 + ,3 + ,61 + ,1326 + ,166420 + ,39 + ,432 + ,63 + ,0 + ,27 + ,1587 + ,135509 + ,45 + ,500 + ,41 + ,0 + ,64 + ,2336 + ,195043 + ,72 + ,504 + ,86 + ,8 + ,76 + ,2898 + ,138708 + ,66 + ,887 + ,152 + ,2 + ,93 + ,1118 + ,116552 + ,40 + ,271 + ,49 + ,0 + ,59 + ,340 + ,31970 + ,15 + ,101 + ,40 + ,0 + ,5 + ,3224 + ,291993 + ,121 + ,1203 + ,148 + ,3 + ,62 + ,1552 + ,167825 + ,82 + ,506 + ,86 + ,1 + ,47 + ,1551 + ,135926 + ,69 + ,528 + ,62 + ,2 + ,88 + ,1794 + ,136647 + ,77 + ,501 + ,96 + ,1 + ,57 + ,2728 + ,171518 + ,71 + ,698 + ,95 + ,0 + ,81 + ,1580 + ,108980 + ,46 + ,426 + ,83 + ,2 + ,35 + ,2414 + ,183471 + ,61 + ,709 + ,112 + ,1 + ,102 + ,2640 + ,167426 + ,101 + ,847 + ,77 + ,0 + ,73 + ,1203 + ,112510 + ,49 + ,367 + ,78 + ,0 + ,32 + ,1313 + ,92421 + ,77 + ,413 + ,114 + ,0 + ,34 + ,1207 + ,117169 + ,84 + ,272 + ,55 + ,0 + ,80 + ,2246 + ,304603 + ,65 + ,830 + ,60 + ,0 + ,49 + ,1076 + ,75101 + ,30 + ,334 + ,49 + ,1 + ,30 + ,1638 + ,145043 + ,41 + ,524 + ,132 + ,0 + ,57 + ,1208 + ,95827 + ,48 + ,393 + ,49 + ,0 + ,54 + ,1868 + ,173931 + ,60 + ,574 + ,71 + ,0 + ,38 + ,2829 + ,250424 + ,252 + ,695 + ,102 + ,0 + ,63 + ,1209 + ,115367 + ,116 + ,284 + ,74 + ,0 + ,58 + ,1463 + ,125839 + ,66 + ,462 + ,49 + ,7 + ,49 + ,1610 + ,164078 + ,54 + ,653 + ,74 + ,0 + ,46 + ,1865 + ,158931 + ,42 + ,684 + ,59 + ,5 + ,51 + ,2444 + ,190382 + ,85 + ,714 + ,91 + ,1 + ,90 + ,1253 + ,155226 + ,59 + ,420 + ,68 + ,0 + ,45 + ,1468 + ,146159 + ,61 + ,551 + ,81 + ,0 + ,28 + ,979 + ,62641 + ,44 + ,396 + ,33 + ,0 + ,26 + ,2365 + ,258585 + ,121 + ,741 + ,166 + ,0 + ,54 + ,1890 + ,199841 + ,71 + ,571 + ,97 + ,0 + ,96 + ,223 + ,19349 + ,12 + ,67 + ,15 + ,0 + ,13 + ,2527 + ,247280 + ,109 + ,877 + ,105 + ,3 + ,43 + ,2186 + ,173152 + ,88 + ,885 + ,61 + ,0 + ,46 + ,778 + ,72128 + ,30 + ,306 + ,11 + ,0 + ,30 + ,1194 + ,104253 + ,26 + ,382 + ,45 + ,0 + ,59 + ,1424 + ,151090 + ,57 + ,435 + ,89 + ,0 + ,73 + ,1386 + ,147990 + ,68 + ,348 + ,72 + ,1 + ,40 + ,839 + ,87448 + ,42 + ,227 + ,27 + ,1 + ,36 + ,596 + ,27676 + ,22 + ,194 + ,59 + ,0 + ,2 + ,1684 + ,170326 + ,52 + ,413 + ,127 + ,0 + ,103 + ,1168 + ,132148 + ,38 + ,273 + ,48 + ,1 + ,30 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1315 + ,133868 + ,36 + ,390 + ,58 + ,0 + ,78 + ,1149 + ,109001 + ,68 + ,376 + ,57 + ,0 + ,25 + ,1485 + ,158833 + ,46 + ,495 + ,60 + ,0 + ,59 + ,1529 + ,150013 + ,66 + ,448 + ,77 + ,1 + ,60 + ,962 + ,89887 + ,63 + ,313 + ,71 + ,0 + ,36 + ,78 + ,3616 + ,5 + ,14 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1295 + ,216479 + ,48 + ,445 + ,78 + ,0 + ,51 + ,1751 + ,177323 + ,102 + ,637 + ,76 + ,0 + ,79 + ,2142 + ,177948 + ,102 + ,593 + ,124 + ,2 + ,30 + ,1070 + ,140106 + ,41 + ,326 + ,67 + ,0 + ,43 + ,778 + ,43410 + ,19 + ,292 + ,63 + ,0 + ,7 + ,1986 + ,206059 + ,76 + ,573 + ,92 + ,1 + ,92 + ,1084 + ,109873 + ,45 + ,315 + ,58 + ,0 + ,32 + ,2400 + ,157084 + ,61 + ,683 + ,65 + ,10 + ,84 + ,731 + ,60493 + ,40 + ,174 + ,29 + ,3 + ,3 + ,285 + ,19764 + ,12 + ,75 + ,19 + ,1 + ,10 + ,1873 + ,177559 + ,57 + ,572 + ,64 + ,3 + ,47 + ,1269 + ,154169 + ,36 + ,414 + ,79 + ,0 + ,44 + ,1725 + ,164249 + ,54 + ,562 + ,104 + ,0 + ,54 + ,256 + ,11796 + ,9 + ,79 + ,22 + ,0 + ,1 + ,98 + ,10674 + ,9 + ,33 + ,7 + ,0 + ,0 + ,1435 + ,151322 + ,59 + ,487 + ,37 + ,0 + ,46 + ,41 + ,6836 + ,3 + ,11 + ,5 + ,0 + ,0 + ,1931 + ,174712 + ,68 + ,664 + ,48 + ,6 + ,51 + ,42 + ,5118 + ,3 + ,6 + ,1 + ,0 + ,5 + ,528 + ,40248 + ,16 + ,183 + ,34 + ,1 + ,8 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1122 + ,127628 + ,51 + ,342 + ,53 + ,0 + ,38 + ,1305 + ,88837 + ,38 + ,269 + ,44 + ,0 + ,21 + ,81 + ,7131 + ,4 + ,27 + ,0 + ,1 + ,0 + ,262 + ,9056 + ,15 + ,99 + ,18 + ,0 + ,0 + ,1165 + ,97191 + ,31 + ,322 + ,52 + ,1 + ,26 + ,1405 + ,157478 + ,59 + ,367 + ,60 + ,0 + ,53 + ,1409 + ,125583 + ,23 + ,521 + ,50 + ,1 + ,31) + ,dim=c(7 + ,144) + ,dimnames=list(c('a' + ,'b' + ,'c' + ,'d' + ,'e' + ,'f' + ,'g') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('a','b','c','d','e','f','g'),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 = '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] "a" > x[,par1] [1] 1845 1917 192 2665 3709 7138 1888 1909 2140 3168 1957 2370 1998 3203 1505 [16] 1574 1965 1314 2921 823 1289 2818 1792 2474 1994 1806 2177 1458 3057 2487 [31] 1914 1825 2509 3634 2608 1 2157 1978 2224 2215 2538 1881 1113 2380 1365 [46] 1294 756 2465 2327 2787 658 2013 2666 2086 2067 1776 2045 1047 1190 2932 [61] 1868 2316 1392 1355 1326 1587 2336 2898 1118 340 3224 1552 1551 1794 2728 [76] 1580 2414 2640 1203 1313 1207 2246 1076 1638 1208 1868 2829 1209 1463 1610 [91] 1865 2444 1253 1468 979 2365 1890 223 2527 2186 778 1194 1424 1386 839 [106] 596 1684 1168 0 1315 1149 1485 1529 962 78 0 1295 1751 2142 1070 [121] 778 1986 1084 2400 731 285 1873 1269 1725 256 98 1435 41 1931 42 [136] 528 0 1122 1305 81 262 1165 1405 1409 > 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 41 42 78 81 98 192 223 256 262 285 340 528 596 658 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 731 756 778 823 839 962 979 1047 1070 1076 1084 1113 1118 1122 1149 1165 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1168 1190 1194 1203 1207 1208 1209 1253 1269 1289 1294 1295 1305 1313 1314 1315 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1326 1355 1365 1386 1392 1405 1409 1424 1435 1458 1463 1468 1485 1505 1529 1551 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1552 1574 1580 1587 1610 1638 1684 1725 1751 1776 1792 1794 1806 1825 1845 1865 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1868 1873 1881 1888 1890 1909 1914 1917 1931 1957 1965 1978 1986 1994 1998 2013 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2045 2067 2086 2140 2142 2157 2177 2186 2215 2224 2246 2316 2327 2336 2365 2370 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2380 2400 2414 2444 2465 2474 2487 2509 2527 2538 2608 2640 2665 2666 2728 2787 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2818 2829 2898 2921 2932 3057 3168 3203 3224 3634 3709 7138 1 1 1 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "a" "b" "c" "d" "e" "f" "g" > colnames(x)[par1] [1] "a" > x[,par1] [1] 1845 1917 192 2665 3709 7138 1888 1909 2140 3168 1957 2370 1998 3203 1505 [16] 1574 1965 1314 2921 823 1289 2818 1792 2474 1994 1806 2177 1458 3057 2487 [31] 1914 1825 2509 3634 2608 1 2157 1978 2224 2215 2538 1881 1113 2380 1365 [46] 1294 756 2465 2327 2787 658 2013 2666 2086 2067 1776 2045 1047 1190 2932 [61] 1868 2316 1392 1355 1326 1587 2336 2898 1118 340 3224 1552 1551 1794 2728 [76] 1580 2414 2640 1203 1313 1207 2246 1076 1638 1208 1868 2829 1209 1463 1610 [91] 1865 2444 1253 1468 979 2365 1890 223 2527 2186 778 1194 1424 1386 839 [106] 596 1684 1168 0 1315 1149 1485 1529 962 78 0 1295 1751 2142 1070 [121] 778 1986 1084 2400 731 285 1873 1269 1725 256 98 1435 41 1931 42 [136] 528 0 1122 1305 81 262 1165 1405 1409 > 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/1jj121324619781.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: a Inputs: b, c, d, e, f, g Number of observations: 144 1) d <= 500; criterion = 1, statistic = 133.371 2) d <= 205; criterion = 1, statistic = 62.395 3)* weights = 19 2) d > 205 4) d <= 342; criterion = 1, statistic = 27.058 5)* weights = 17 4) d > 342 6) g <= 33; criterion = 0.998, statistic = 12.481 7)* weights = 7 6) g > 33 8)* weights = 26 1) d > 500 9) d <= 1009; criterion = 1, statistic = 61.868 10) d <= 687; criterion = 1, statistic = 37.508 11) f <= 3; criterion = 0.98, statistic = 8.609 12)* weights = 28 11) f > 3 13)* weights = 7 10) d > 687 14)* weights = 32 9) d > 1009 15)* weights = 8 > postscript(file="/var/wessaorg/rcomp/tmp/2bmi41324619781.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/32u8y1324619781.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 1845 1831.4286 13.571429 2 1917 1831.4286 85.571429 3 192 232.2105 -40.210526 4 2665 2457.3125 207.687500 5 3709 3702.5000 6.500000 6 7138 3702.5000 3435.500000 7 1888 1831.4286 56.571429 8 1909 1831.4286 77.571429 9 2140 1831.4286 308.571429 10 3168 3702.5000 -534.500000 11 1957 1831.4286 125.571429 12 2370 2457.3125 -87.312500 13 1998 2457.3125 -459.312500 14 3203 3702.5000 -499.500000 15 1505 1420.1154 84.884615 16 1574 1420.1154 153.884615 17 1965 1420.1154 544.884615 18 1314 1196.1429 117.857143 19 2921 2457.3125 463.687500 20 823 1029.8235 -206.823529 21 1289 1196.1429 92.857143 22 2818 2457.3125 360.687500 23 1792 1831.4286 -39.428571 24 2474 2457.3125 16.687500 25 1994 1831.4286 162.571429 26 1806 1831.4286 -25.428571 27 2177 2457.3125 -280.312500 28 1458 1420.1154 37.884615 29 3057 3702.5000 -645.500000 30 2487 3702.5000 -1215.500000 31 1914 1831.4286 82.571429 32 1825 1831.4286 -6.428571 33 2509 2457.3125 51.687500 34 3634 3702.5000 -68.500000 35 2608 2457.3125 150.687500 36 1 232.2105 -231.210526 37 2157 2457.3125 -300.312500 38 1978 1831.4286 146.571429 39 2224 2057.1429 166.857143 40 2215 2457.3125 -242.312500 41 2538 2457.3125 80.687500 42 1881 2457.3125 -576.312500 43 1113 1196.1429 -83.142857 44 2380 2457.3125 -77.312500 45 1365 1420.1154 -55.115385 46 1294 1420.1154 -126.115385 47 756 1029.8235 -273.823529 48 2465 2457.3125 7.687500 49 2327 2457.3125 -130.312500 50 2787 2457.3125 329.687500 51 658 232.2105 425.789474 52 2013 1831.4286 181.571429 53 2666 2457.3125 208.687500 54 2086 2457.3125 -371.312500 55 2067 2457.3125 -390.312500 56 1776 2057.1429 -281.142857 57 2045 1831.4286 213.571429 58 1047 1029.8235 17.176471 59 1190 1420.1154 -230.115385 60 2932 2457.3125 474.687500 61 1868 2057.1429 -189.142857 62 2316 2457.3125 -141.312500 63 1392 1420.1154 -28.115385 64 1355 1420.1154 -65.115385 65 1326 1196.1429 129.857143 66 1587 1420.1154 166.884615 67 2336 2057.1429 278.857143 68 2898 2457.3125 440.687500 69 1118 1029.8235 88.176471 70 340 232.2105 107.789474 71 3224 3702.5000 -478.500000 72 1552 1831.4286 -279.428571 73 1551 1831.4286 -280.428571 74 1794 1831.4286 -37.428571 75 2728 2457.3125 270.687500 76 1580 1420.1154 159.884615 77 2414 2457.3125 -43.312500 78 2640 2457.3125 182.687500 79 1203 1196.1429 6.857143 80 1313 1420.1154 -107.115385 81 1207 1029.8235 177.176471 82 2246 2457.3125 -211.312500 83 1076 1029.8235 46.176471 84 1638 1831.4286 -193.428571 85 1208 1420.1154 -212.115385 86 1868 1831.4286 36.571429 87 2829 2457.3125 371.687500 88 1209 1029.8235 179.176471 89 1463 1420.1154 42.884615 90 1610 1831.4286 -221.428571 91 1865 2057.1429 -192.142857 92 2444 2457.3125 -13.312500 93 1253 1420.1154 -167.115385 94 1468 1831.4286 -363.428571 95 979 1196.1429 -217.142857 96 2365 2457.3125 -92.312500 97 1890 1831.4286 58.571429 98 223 232.2105 -9.210526 99 2527 2457.3125 69.687500 100 2186 2457.3125 -271.312500 101 778 1029.8235 -251.823529 102 1194 1420.1154 -226.115385 103 1424 1420.1154 3.884615 104 1386 1420.1154 -34.115385 105 839 1029.8235 -190.823529 106 596 232.2105 363.789474 107 1684 1420.1154 263.884615 108 1168 1029.8235 138.176471 109 0 232.2105 -232.210526 110 1315 1420.1154 -105.115385 111 1149 1196.1429 -47.142857 112 1485 1420.1154 64.884615 113 1529 1420.1154 108.884615 114 962 1029.8235 -67.823529 115 78 232.2105 -154.210526 116 0 232.2105 -232.210526 117 1295 1420.1154 -125.115385 118 1751 1831.4286 -80.428571 119 2142 1831.4286 310.571429 120 1070 1029.8235 40.176471 121 778 1029.8235 -251.823529 122 1986 1831.4286 154.571429 123 1084 1029.8235 54.176471 124 2400 2057.1429 342.857143 125 731 232.2105 498.789474 126 285 232.2105 52.789474 127 1873 1831.4286 41.571429 128 1269 1420.1154 -151.115385 129 1725 1831.4286 -106.428571 130 256 232.2105 23.789474 131 98 232.2105 -134.210526 132 1435 1420.1154 14.884615 133 41 232.2105 -191.210526 134 1931 2057.1429 -126.142857 135 42 232.2105 -190.210526 136 528 232.2105 295.789474 137 0 232.2105 -232.210526 138 1122 1029.8235 92.176471 139 1305 1029.8235 275.176471 140 81 232.2105 -151.210526 141 262 232.2105 29.789474 142 1165 1029.8235 135.176471 143 1405 1420.1154 -15.115385 144 1409 1831.4286 -422.428571 > 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/4udqb1324619781.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/52if61324619781.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/6tt921324619781.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/7r9xj1324619781.tab") + } > > try(system("convert tmp/2bmi41324619781.ps tmp/2bmi41324619781.png",intern=TRUE)) character(0) > try(system("convert tmp/32u8y1324619781.ps tmp/32u8y1324619781.png",intern=TRUE)) character(0) > try(system("convert tmp/4udqb1324619781.ps tmp/4udqb1324619781.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.445 0.300 3.747