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(1818 + ,279055 + ,73 + ,1433 + ,212408 + ,75 + ,2059 + ,233939 + ,83 + ,2733 + ,222117 + ,106 + ,1399 + ,189911 + ,56 + ,631 + ,70849 + ,28 + ,5460 + ,605767 + ,135 + ,381 + ,33186 + ,19 + ,2150 + ,227332 + ,62 + ,2042 + ,267925 + ,49 + ,2536 + ,371987 + ,122 + ,2429 + ,276291 + ,132 + ,2100 + ,212638 + ,87 + ,3020 + ,368577 + ,85 + ,2265 + ,269455 + ,88 + ,5139 + ,398124 + ,191 + ,2363 + ,335567 + ,77 + ,3564 + ,432711 + ,173 + ,1516 + ,185822 + ,59 + ,2398 + ,267365 + ,89 + ,2546 + ,279428 + ,73 + ,3253 + ,527853 + ,112 + ,1705 + ,220142 + ,49 + ,1787 + ,200004 + ,58 + ,3792 + ,257139 + ,133 + ,3108 + ,270941 + ,138 + ,3230 + ,324969 + ,134 + ,2348 + ,329962 + ,92 + ,1780 + ,190867 + ,60 + ,3218 + ,393860 + ,79 + ,2692 + ,327660 + ,89 + ,2187 + ,269239 + ,83 + ,2577 + ,396136 + ,106 + ,1293 + ,130446 + ,49 + ,3567 + ,430118 + ,104 + ,2764 + ,273950 + ,56 + ,3755 + ,428077 + ,128 + ,2075 + ,254312 + ,93 + ,995 + ,120351 + ,35 + ,3750 + ,395658 + ,212 + ,3413 + ,345875 + ,86 + ,2053 + ,216827 + ,82 + ,1984 + ,224524 + ,83 + ,1825 + ,182485 + ,69 + ,2783 + ,168492 + ,86 + ,5572 + ,459455 + ,157 + ,918 + ,78800 + ,42 + ,2685 + ,255072 + ,85 + ,4145 + ,368086 + ,123 + ,2841 + ,230299 + ,70 + ,2175 + ,244782 + ,81 + ,496 + ,24188 + ,24 + ,2699 + ,400109 + ,334 + ,744 + ,65029 + ,17 + ,1161 + ,101097 + ,64 + ,3333 + ,309810 + ,67 + ,2970 + ,375638 + ,91 + ,3969 + ,367127 + ,205 + ,2919 + ,387748 + ,156 + ,2399 + ,280106 + ,90 + ,4121 + ,400971 + ,153 + ,3323 + ,322755 + ,123 + ,3132 + ,291391 + ,124 + ,2868 + ,295075 + ,93 + ,1778 + ,280018 + ,81 + ,2109 + ,267432 + ,71 + ,2148 + ,217181 + ,141 + ,3009 + ,258166 + ,159 + ,2562 + ,264771 + ,88 + ,1737 + ,182961 + ,73 + ,2680 + ,256967 + ,74 + ,893 + ,73566 + ,32 + ,2389 + ,272362 + ,93 + ,2197 + ,229056 + ,62 + ,2227 + ,229851 + ,70 + ,2370 + ,371391 + ,91 + ,3226 + ,398210 + ,104 + ,1978 + ,220419 + ,111 + ,2516 + ,231884 + ,72 + ,2147 + ,219381 + ,73 + ,2150 + ,206169 + ,54 + ,4229 + ,483074 + ,132 + ,1380 + ,146100 + ,72 + ,2449 + ,295224 + ,109 + ,870 + ,80953 + ,25 + ,2700 + ,217384 + ,63 + ,1574 + ,179344 + ,62 + ,4046 + ,415550 + ,222 + ,3259 + ,389059 + ,129 + ,3098 + ,180679 + ,106 + ,2615 + ,299505 + ,104 + ,2404 + ,292260 + ,84 + ,1932 + ,199481 + ,68 + ,3147 + ,282361 + ,78 + ,2598 + ,329281 + ,89 + ,2108 + ,234577 + ,48 + ,2193 + ,297995 + ,67 + ,2478 + ,342490 + ,90 + ,4198 + ,416463 + ,163 + ,4165 + ,429565 + ,120 + ,2842 + ,297080 + ,142 + ,2562 + ,331792 + ,71 + ,2449 + ,229772 + ,202 + ,602 + ,43287 + ,14 + ,2579 + ,238089 + ,87 + ,2591 + ,263322 + ,160 + ,2957 + ,302082 + ,61 + ,2786 + ,321797 + ,95 + ,1477 + ,193926 + ,96 + ,3350 + ,175138 + ,105 + ,2107 + ,354041 + ,78 + ,2332 + ,303273 + ,91 + ,400 + ,23668 + ,13 + ,2233 + ,196743 + ,79 + ,530 + ,61857 + ,25 + ,2033 + ,217543 + ,54 + ,3246 + ,440711 + ,128 + ,387 + ,21054 + ,16 + ,2137 + ,252805 + ,52 + ,492 + ,31961 + ,22 + ,3838 + ,360436 + ,125 + ,2193 + ,251948 + ,77 + ,1796 + ,187320 + ,97 + ,1907 + ,180842 + ,58 + ,568 + ,38214 + ,34 + ,2602 + ,280392 + ,56 + ,2819 + ,358276 + ,84 + ,1464 + ,211775 + ,67 + ,3946 + ,447335 + ,90 + ,2554 + ,348017 + ,99 + ,3506 + ,441946 + ,133 + ,1552 + ,215177 + ,43 + ,1389 + ,130177 + ,47 + ,3101 + ,318037 + ,365 + ,4541 + ,466139 + ,198 + ,1872 + ,162279 + ,62 + ,4403 + ,416643 + ,140 + ,2113 + ,178322 + ,86 + ,2046 + ,292443 + ,54 + ,2564 + ,283913 + ,100 + ,2145 + ,251070 + ,128 + ,4112 + ,387072 + ,125 + ,2340 + ,246963 + ,93 + ,2035 + ,173260 + ,63 + ,3241 + ,346748 + ,108 + ,1991 + ,178402 + ,60 + ,2864 + ,277892 + ,97 + ,2748 + ,314070 + ,112 + ,2 + ,1 + ,0 + ,207 + ,14688 + ,10 + ,5 + ,98 + ,1 + ,8 + ,455 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,2449 + ,291847 + ,95 + ,3490 + ,415421 + ,168 + ,0 + ,0 + ,0 + ,4 + ,203 + ,4 + ,151 + ,7199 + ,5 + ,475 + ,46660 + ,21 + ,141 + ,17547 + ,5 + ,1145 + ,121550 + ,46 + ,29 + ,969 + ,2 + ,2080 + ,242774 + ,75) + ,dim=c(3 + ,164) + ,dimnames=list(c('A' + ,'B' + ,'C') + ,1:164)) > y <- array(NA,dim=c(3,164),dimnames=list(c('A','B','C'),1:164)) > 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 = '3' > par2 = 'none' > par1 = '1' > 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] 1818 1433 2059 2733 1399 631 5460 381 2150 2042 2536 2429 2100 3020 2265 [16] 5139 2363 3564 1516 2398 2546 3253 1705 1787 3792 3108 3230 2348 1780 3218 [31] 2692 2187 2577 1293 3567 2764 3755 2075 995 3750 3413 2053 1984 1825 2783 [46] 5572 918 2685 4145 2841 2175 496 2699 744 1161 3333 2970 3969 2919 2399 [61] 4121 3323 3132 2868 1778 2109 2148 3009 2562 1737 2680 893 2389 2197 2227 [76] 2370 3226 1978 2516 2147 2150 4229 1380 2449 870 2700 1574 4046 3259 3098 [91] 2615 2404 1932 3147 2598 2108 2193 2478 4198 4165 2842 2562 2449 602 2579 [106] 2591 2957 2786 1477 3350 2107 2332 400 2233 530 2033 3246 387 2137 492 [121] 3838 2193 1796 1907 568 2602 2819 1464 3946 2554 3506 1552 1389 3101 4541 [136] 1872 4403 2113 2046 2564 2145 4112 2340 2035 3241 1991 2864 2748 2 207 [151] 5 8 0 0 2449 3490 0 4 151 475 141 1145 29 2080 > 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 4 5 8 29 141 151 207 381 387 400 475 492 496 530 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 568 602 631 744 870 893 918 995 1145 1161 1293 1380 1389 1399 1433 1464 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1477 1516 1552 1574 1705 1737 1778 1780 1787 1796 1818 1825 1872 1907 1932 1978 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1984 1991 2033 2035 2042 2046 2053 2059 2075 2080 2100 2107 2108 2109 2113 2137 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2145 2147 2148 2150 2175 2187 2193 2197 2227 2233 2265 2332 2340 2348 2363 2370 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 2389 2398 2399 2404 2429 2449 2478 2516 2536 2546 2554 2562 2564 2577 2579 2591 1 1 1 1 1 3 1 1 1 1 1 2 1 1 1 1 2598 2602 2615 2680 2685 2692 2699 2700 2733 2748 2764 2783 2786 2819 2841 2842 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2864 2868 2919 2957 2970 3009 3020 3098 3101 3108 3132 3147 3218 3226 3230 3241 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3246 3253 3259 3323 3333 3350 3413 3490 3506 3564 3567 3750 3755 3792 3838 3946 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3969 4046 4112 4121 4145 4165 4198 4229 4403 4541 5139 5460 5572 1 1 1 1 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "A" "B" "C" > colnames(x)[par1] [1] "A" > x[,par1] [1] 1818 1433 2059 2733 1399 631 5460 381 2150 2042 2536 2429 2100 3020 2265 [16] 5139 2363 3564 1516 2398 2546 3253 1705 1787 3792 3108 3230 2348 1780 3218 [31] 2692 2187 2577 1293 3567 2764 3755 2075 995 3750 3413 2053 1984 1825 2783 [46] 5572 918 2685 4145 2841 2175 496 2699 744 1161 3333 2970 3969 2919 2399 [61] 4121 3323 3132 2868 1778 2109 2148 3009 2562 1737 2680 893 2389 2197 2227 [76] 2370 3226 1978 2516 2147 2150 4229 1380 2449 870 2700 1574 4046 3259 3098 [91] 2615 2404 1932 3147 2598 2108 2193 2478 4198 4165 2842 2562 2449 602 2579 [106] 2591 2957 2786 1477 3350 2107 2332 400 2233 530 2033 3246 387 2137 492 [121] 3838 2193 1796 1907 568 2602 2819 1464 3946 2554 3506 1552 1389 3101 4541 [136] 1872 4403 2113 2046 2564 2145 4112 2340 2035 3241 1991 2864 2748 2 207 [151] 5 8 0 0 2449 3490 0 4 151 475 141 1145 29 2080 > 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/1ljsd1324655675.tab") + } + } > m Conditional inference tree with 10 terminal nodes Response: A Inputs: B, C Number of observations: 164 1) B <= 146100; criterion = 1, statistic = 135.692 2) B <= 61857; criterion = 1, statistic = 28.546 3) C <= 10; criterion = 1, statistic = 16.359 4)* weights = 11 3) C > 10 5)* weights = 9 2) B > 61857 6)* weights = 11 1) B > 146100 7) B <= 358276; criterion = 1, statistic = 81.079 8) B <= 254312; criterion = 1, statistic = 27.902 9) C <= 97; criterion = 0.977, statistic = 6.381 10) B <= 215177; criterion = 0.96, statistic = 5.398 11)* weights = 22 10) B > 215177 12)* weights = 20 9) C > 97 13)* weights = 7 8) B > 254312 14) C <= 104; criterion = 0.984, statistic = 7.016 15)* weights = 38 14) C > 104 16)* weights = 13 7) B > 358276 17) B <= 396136; criterion = 0.988, statistic = 7.602 18)* weights = 13 17) B > 396136 19)* weights = 20 > postscript(file="/var/www/rcomp/tmp/23tte1324655675.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/3j6lu1324655675.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 1818 2518.84211 -700.842105 2 1433 1838.90909 -405.909091 3 2059 2214.95000 -155.950000 4 2733 2557.28571 175.714286 5 1399 1838.90909 -439.909091 6 631 1038.09091 -407.090909 7 5460 4006.30000 1453.700000 8 381 481.22222 -100.222222 9 2150 2214.95000 -64.950000 10 2042 2518.84211 -476.842105 11 2536 3283.30769 -747.307692 12 2429 2999.61538 -570.615385 13 2100 1838.90909 261.090909 14 3020 3283.30769 -263.307692 15 2265 2518.84211 -253.842105 16 5139 4006.30000 1132.700000 17 2363 2518.84211 -155.842105 18 3564 4006.30000 -442.300000 19 1516 1838.90909 -322.909091 20 2398 2518.84211 -120.842105 21 2546 2518.84211 27.157895 22 3253 4006.30000 -753.300000 23 1705 2214.95000 -509.950000 24 1787 1838.90909 -51.909091 25 3792 2999.61538 792.384615 26 3108 2999.61538 108.384615 27 3230 2999.61538 230.384615 28 2348 2518.84211 -170.842105 29 1780 1838.90909 -58.909091 30 3218 3283.30769 -65.307692 31 2692 2518.84211 173.157895 32 2187 2518.84211 -331.842105 33 2577 3283.30769 -706.307692 34 1293 1038.09091 254.909091 35 3567 4006.30000 -439.300000 36 2764 2518.84211 245.157895 37 3755 4006.30000 -251.300000 38 2075 2214.95000 -139.950000 39 995 1038.09091 -43.090909 40 3750 3283.30769 466.692308 41 3413 2518.84211 894.157895 42 2053 2214.95000 -161.950000 43 1984 2214.95000 -230.950000 44 1825 1838.90909 -13.909091 45 2783 1838.90909 944.090909 46 5572 4006.30000 1565.700000 47 918 1038.09091 -120.090909 48 2685 2518.84211 166.157895 49 4145 3283.30769 861.692308 50 2841 2214.95000 626.050000 51 2175 2214.95000 -39.950000 52 496 481.22222 14.777778 53 2699 4006.30000 -1307.300000 54 744 1038.09091 -294.090909 55 1161 1038.09091 122.909091 56 3333 2518.84211 814.157895 57 2970 3283.30769 -313.307692 58 3969 3283.30769 685.692308 59 2919 3283.30769 -364.307692 60 2399 2518.84211 -119.842105 61 4121 4006.30000 114.700000 62 3323 2999.61538 323.384615 63 3132 2999.61538 132.384615 64 2868 2518.84211 349.157895 65 1778 2518.84211 -740.842105 66 2109 2518.84211 -409.842105 67 2148 2557.28571 -409.285714 68 3009 2999.61538 9.384615 69 2562 2518.84211 43.157895 70 1737 1838.90909 -101.909091 71 2680 2518.84211 161.157895 72 893 1038.09091 -145.090909 73 2389 2518.84211 -129.842105 74 2197 2214.95000 -17.950000 75 2227 2214.95000 12.050000 76 2370 3283.30769 -913.307692 77 3226 4006.30000 -780.300000 78 1978 2557.28571 -579.285714 79 2516 2214.95000 301.050000 80 2147 2214.95000 -67.950000 81 2150 1838.90909 311.090909 82 4229 4006.30000 222.700000 83 1380 1038.09091 341.909091 84 2449 2999.61538 -550.615385 85 870 1038.09091 -168.090909 86 2700 2214.95000 485.050000 87 1574 1838.90909 -264.909091 88 4046 4006.30000 39.700000 89 3259 3283.30769 -24.307692 90 3098 2557.28571 540.714286 91 2615 2518.84211 96.157895 92 2404 2518.84211 -114.842105 93 1932 1838.90909 93.090909 94 3147 2518.84211 628.157895 95 2598 2518.84211 79.157895 96 2108 2214.95000 -106.950000 97 2193 2518.84211 -325.842105 98 2478 2518.84211 -40.842105 99 4198 4006.30000 191.700000 100 4165 4006.30000 158.700000 101 2842 2999.61538 -157.615385 102 2562 2518.84211 43.157895 103 2449 2557.28571 -108.285714 104 602 481.22222 120.777778 105 2579 2214.95000 364.050000 106 2591 2999.61538 -408.615385 107 2957 2518.84211 438.157895 108 2786 2518.84211 267.157895 109 1477 1838.90909 -361.909091 110 3350 2557.28571 792.714286 111 2107 2518.84211 -411.842105 112 2332 2518.84211 -186.842105 113 400 481.22222 -81.222222 114 2233 1838.90909 394.090909 115 530 481.22222 48.777778 116 2033 2214.95000 -181.950000 117 3246 4006.30000 -760.300000 118 387 481.22222 -94.222222 119 2137 2214.95000 -77.950000 120 492 481.22222 10.777778 121 3838 3283.30769 554.692308 122 2193 2214.95000 -21.950000 123 1796 1838.90909 -42.909091 124 1907 1838.90909 68.090909 125 568 481.22222 86.777778 126 2602 2518.84211 83.157895 127 2819 2518.84211 300.157895 128 1464 1838.90909 -374.909091 129 3946 4006.30000 -60.300000 130 2554 2518.84211 35.157895 131 3506 4006.30000 -500.300000 132 1552 1838.90909 -286.909091 133 1389 1038.09091 350.909091 134 3101 2999.61538 101.384615 135 4541 4006.30000 534.700000 136 1872 1838.90909 33.090909 137 4403 4006.30000 396.700000 138 2113 1838.90909 274.090909 139 2046 2518.84211 -472.842105 140 2564 2518.84211 45.157895 141 2145 2557.28571 -412.285714 142 4112 3283.30769 828.692308 143 2340 2214.95000 125.050000 144 2035 1838.90909 196.090909 145 3241 2999.61538 241.384615 146 1991 1838.90909 152.090909 147 2864 2518.84211 345.157895 148 2748 2999.61538 -251.615385 149 2 49.72727 -47.727273 150 207 49.72727 157.272727 151 5 49.72727 -44.727273 152 8 49.72727 -41.727273 153 0 49.72727 -49.727273 154 0 49.72727 -49.727273 155 2449 2518.84211 -69.842105 156 3490 4006.30000 -516.300000 157 0 49.72727 -49.727273 158 4 49.72727 -45.727273 159 151 49.72727 101.272727 160 475 481.22222 -6.222222 161 141 49.72727 91.272727 162 1145 1038.09091 106.909091 163 29 49.72727 -20.727273 164 2080 2214.95000 -134.950000 > 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/4xmmg1324655675.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/539y41324655675.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/6c1or1324655675.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/7yqac1324655675.tab") + } > > try(system("convert tmp/23tte1324655675.ps tmp/23tte1324655675.png",intern=TRUE)) character(0) > try(system("convert tmp/3j6lu1324655675.ps tmp/3j6lu1324655675.png",intern=TRUE)) character(0) > try(system("convert tmp/4xmmg1324655675.ps tmp/4xmmg1324655675.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.930 0.190 3.094