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(18 + ,1760 + ,89 + ,20465 + ,70 + ,20 + ,1609 + ,56 + ,33629 + ,80 + ,0 + ,192 + ,18 + ,1423 + ,0 + ,26 + ,2182 + ,92 + ,25629 + ,81 + ,31 + ,3367 + ,131 + ,54002 + ,124 + ,36 + ,6727 + ,257 + ,151036 + ,140 + ,23 + ,1619 + ,55 + ,33287 + ,88 + ,30 + ,1507 + ,56 + ,31172 + ,115 + ,30 + ,1682 + ,42 + ,28113 + ,109 + ,26 + ,2812 + ,92 + ,57803 + ,104 + ,24 + ,1943 + ,74 + ,49830 + ,63 + ,30 + ,2017 + ,66 + ,52143 + ,118 + ,21 + ,1702 + ,96 + ,21055 + ,68 + ,25 + ,3034 + ,110 + ,47007 + ,100 + ,18 + ,1379 + ,55 + ,28735 + ,63 + ,19 + ,1517 + ,79 + ,59147 + ,74 + ,33 + ,1637 + ,53 + ,78950 + ,132 + ,15 + ,1169 + ,54 + ,13497 + ,54 + ,34 + ,2384 + ,84 + ,46154 + ,134 + ,18 + ,726 + ,24 + ,53249 + ,57 + ,15 + ,993 + ,55 + ,10726 + ,59 + ,30 + ,2683 + ,96 + ,83700 + ,113 + ,25 + ,1713 + ,70 + ,40400 + ,96 + ,34 + ,2027 + ,50 + ,33797 + ,96 + ,21 + ,1818 + ,81 + ,36205 + ,78 + ,21 + ,1393 + ,28 + ,30165 + ,80 + ,25 + ,2000 + ,154 + ,58534 + ,93 + ,31 + ,1346 + ,85 + ,44663 + ,109 + ,31 + ,2676 + ,115 + ,92556 + ,115 + ,20 + ,2106 + ,43 + ,40078 + ,79 + ,28 + ,1591 + ,43 + ,34711 + ,103 + ,20 + ,1519 + ,43 + ,31076 + ,65 + ,17 + ,2171 + ,101 + ,74608 + ,66 + ,25 + ,3003 + ,121 + ,58092 + ,100 + ,24 + ,2364 + ,52 + ,42009 + ,96 + ,0 + ,1 + ,1 + ,0 + ,0 + ,27 + ,2017 + ,60 + ,36022 + ,105 + ,14 + ,1564 + ,50 + ,23333 + ,51 + ,32 + ,2072 + ,47 + ,53349 + ,108 + ,31 + ,2106 + ,63 + ,92596 + ,124 + ,21 + ,2270 + ,69 + ,49598 + ,81 + ,34 + ,1643 + ,56 + ,44093 + ,136 + ,23 + ,957 + ,29 + ,84205 + ,84 + ,24 + ,2025 + ,77 + ,63369 + ,92 + ,26 + ,1236 + ,46 + ,60132 + ,103 + ,22 + ,1178 + ,91 + ,37403 + ,82 + ,35 + ,744 + ,31 + ,24460 + ,106 + ,21 + ,1976 + ,92 + ,46456 + ,84 + ,31 + ,2224 + ,85 + ,66616 + ,124 + ,26 + ,2561 + ,56 + ,41554 + ,97 + ,22 + ,658 + ,28 + ,22346 + ,82 + ,21 + ,1779 + ,65 + ,30874 + ,79 + ,27 + ,2355 + ,71 + ,68701 + ,97 + ,30 + ,2017 + ,77 + ,35728 + ,107 + ,33 + ,1758 + ,59 + ,29010 + ,126 + ,11 + ,1675 + ,54 + ,23110 + ,40 + ,26 + ,1760 + ,62 + ,38844 + ,96 + ,26 + ,875 + ,23 + ,27084 + ,100 + ,23 + ,1169 + ,65 + ,35139 + ,91 + ,38 + ,2789 + ,93 + ,57476 + ,136 + ,29 + ,1606 + ,56 + ,33277 + ,116 + ,19 + ,2020 + ,76 + ,31141 + ,76 + ,19 + ,1300 + ,58 + ,61281 + ,65 + ,26 + ,1235 + ,35 + ,25820 + ,96 + ,26 + ,1215 + ,32 + ,23284 + ,97 + ,29 + ,1230 + ,38 + ,35378 + ,107 + ,36 + ,2226 + ,67 + ,74990 + ,144 + ,25 + ,2897 + ,65 + ,29653 + ,90 + ,24 + ,1071 + ,38 + ,64622 + ,93 + ,21 + ,340 + ,15 + ,4157 + ,78 + ,19 + ,2704 + ,110 + ,29245 + ,72 + ,12 + ,1247 + ,64 + ,50008 + ,45 + ,30 + ,1422 + ,64 + ,52338 + ,120 + ,21 + ,1535 + ,68 + ,13310 + ,59 + ,34 + ,2593 + ,66 + ,92901 + ,133 + ,32 + ,1397 + ,42 + ,10956 + ,117 + ,28 + ,2162 + ,58 + ,34241 + ,123 + ,28 + ,2513 + ,94 + ,75043 + ,110 + ,21 + ,917 + ,26 + ,21152 + ,75 + ,31 + ,1234 + ,71 + ,42249 + ,114 + ,26 + ,917 + ,66 + ,42005 + ,94 + ,29 + ,1924 + ,59 + ,41152 + ,116 + ,23 + ,853 + ,27 + ,14399 + ,86 + ,25 + ,1398 + ,34 + ,28263 + ,90 + ,22 + ,986 + ,44 + ,17215 + ,87 + ,26 + ,1608 + ,47 + ,48140 + ,99 + ,33 + ,2577 + ,220 + ,62897 + ,132 + ,24 + ,1201 + ,108 + ,22883 + ,96 + ,24 + ,1189 + ,56 + ,41622 + ,91 + ,21 + ,1431 + ,50 + ,40715 + ,77 + ,28 + ,1698 + ,40 + ,65897 + ,104 + ,27 + ,2185 + ,74 + ,76542 + ,97 + ,25 + ,1228 + ,56 + ,37477 + ,94 + ,15 + ,1266 + ,58 + ,53216 + ,60 + ,13 + ,830 + ,36 + ,40911 + ,46 + ,36 + ,2238 + ,111 + ,57021 + ,135 + ,24 + ,1787 + ,68 + ,73116 + ,90 + ,1 + ,223 + ,12 + ,3895 + ,2 + ,24 + ,2254 + ,100 + ,46609 + ,96 + ,31 + ,1952 + ,75 + ,29351 + ,109 + ,4 + ,665 + ,28 + ,2325 + ,15 + ,20 + ,804 + ,22 + ,31747 + ,64 + ,23 + ,1211 + ,49 + ,32665 + ,88 + ,23 + ,1143 + ,57 + ,19249 + ,84 + ,12 + ,710 + ,38 + ,15292 + ,46 + ,16 + ,596 + ,22 + ,5842 + ,59 + ,29 + ,1353 + ,44 + ,33994 + ,116 + ,10 + ,971 + ,32 + ,13018 + ,29 + ,0 + ,0 + ,0 + ,0 + ,0 + ,25 + ,1030 + ,31 + ,98177 + ,91 + ,21 + ,1130 + ,66 + ,37941 + ,76 + ,23 + ,1284 + ,44 + ,31032 + ,83 + ,21 + ,1438 + ,61 + ,32683 + ,84 + ,21 + ,849 + ,57 + ,34545 + ,65 + ,0 + ,78 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,23 + ,925 + ,39 + ,27525 + ,84 + ,29 + ,1518 + ,78 + ,66856 + ,99 + ,28 + ,1946 + ,95 + ,28549 + ,112 + ,23 + ,914 + ,37 + ,38610 + ,92 + ,1 + ,778 + ,19 + ,2781 + ,3 + ,29 + ,1713 + ,71 + ,41211 + ,109 + ,17 + ,895 + ,40 + ,22698 + ,71 + ,29 + ,1756 + ,52 + ,41194 + ,106 + ,12 + ,701 + ,40 + ,32689 + ,48 + ,2 + ,285 + ,12 + ,5752 + ,8 + ,21 + ,1774 + ,55 + ,26757 + ,80 + ,25 + ,1071 + ,29 + ,22527 + ,95 + ,29 + ,1582 + ,46 + ,44810 + ,116 + ,2 + ,256 + ,9 + ,0 + ,8 + ,0 + ,98 + ,9 + ,0 + ,0 + ,18 + ,1358 + ,55 + ,100674 + ,56 + ,1 + ,41 + ,3 + ,0 + ,4 + ,21 + ,1771 + ,58 + ,57786 + ,70 + ,0 + ,42 + ,3 + ,0 + ,0 + ,4 + ,528 + ,16 + ,5444 + ,14 + ,0 + ,0 + ,0 + ,0 + ,0 + ,25 + ,1026 + ,45 + ,28470 + ,91 + ,26 + ,1296 + ,38 + ,61849 + ,89 + ,0 + ,81 + ,4 + ,0 + ,0 + ,4 + ,257 + ,13 + ,2179 + ,12 + ,17 + ,914 + ,23 + ,8019 + ,60 + ,21 + ,1178 + ,50 + ,39644 + ,80 + ,22 + ,1080 + ,19 + ,23494 + ,88) + ,dim=c(5 + ,144) + ,dimnames=list(c('CPR' + ,'PGVWS' + ,'LGNS' + ,'CMPCH' + ,'TNSFM') + ,1:144)) > y <- array(NA,dim=c(5,144),dimnames=list(c('CPR','PGVWS','LGNS','CMPCH','TNSFM'),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 = '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] "CPR" > x[,par1] [1] 18 20 0 26 31 36 23 30 30 26 24 30 21 25 18 19 33 15 34 18 15 30 25 34 21 [26] 21 25 31 31 20 28 20 17 25 24 0 27 14 32 31 21 34 23 24 26 22 35 21 31 26 [51] 22 21 27 30 33 11 26 26 23 38 29 19 19 26 26 29 36 25 24 21 19 12 30 21 34 [76] 32 28 28 21 31 26 29 23 25 22 26 33 24 24 21 28 27 25 15 13 36 24 1 24 31 [101] 4 20 23 23 12 16 29 10 0 25 21 23 21 21 0 0 23 29 28 23 1 29 17 29 12 [126] 2 21 25 29 2 0 18 1 21 0 4 0 25 26 0 4 17 21 22 > 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 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 9 3 2 3 1 1 3 1 1 3 1 3 4 4 4 16 4 9 8 10 11 3 5 8 6 7 32 33 34 35 36 38 2 3 4 1 3 1 > colnames(x) [1] "CPR" "PGVWS" "LGNS" "CMPCH" "TNSFM" > colnames(x)[par1] [1] "CPR" > x[,par1] [1] 18 20 0 26 31 36 23 30 30 26 24 30 21 25 18 19 33 15 34 18 15 30 25 34 21 [26] 21 25 31 31 20 28 20 17 25 24 0 27 14 32 31 21 34 23 24 26 22 35 21 31 26 [51] 22 21 27 30 33 11 26 26 23 38 29 19 19 26 26 29 36 25 24 21 19 12 30 21 34 [76] 32 28 28 21 31 26 29 23 25 22 26 33 24 24 21 28 27 25 15 13 36 24 1 24 31 [101] 4 20 23 23 12 16 29 10 0 25 21 23 21 21 0 0 23 29 28 23 1 29 17 29 12 [126] 2 21 25 29 2 0 18 1 21 0 4 0 25 26 0 4 17 21 22 > 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/1cprs1324643617.tab") + } + } > m Conditional inference tree with 9 terminal nodes Response: CPR Inputs: PGVWS, LGNS, CMPCH, TNSFM Number of observations: 144 1) TNSFM <= 51; criterion = 1, statistic = 137.916 2) TNSFM <= 15; criterion = 1, statistic = 22.752 3)* weights = 17 2) TNSFM > 15 4)* weights = 7 1) TNSFM > 51 5) TNSFM <= 95; criterion = 1, statistic = 104.458 6) TNSFM <= 80; criterion = 1, statistic = 43.212 7) TNSFM <= 60; criterion = 0.995, statistic = 10.542 8)* weights = 8 7) TNSFM > 60 9)* weights = 25 6) TNSFM > 80 10) TNSFM <= 88; criterion = 0.995, statistic = 10.439 11)* weights = 15 10) TNSFM > 88 12)* weights = 15 5) TNSFM > 95 13) TNSFM <= 105; criterion = 1, statistic = 37.2 14)* weights = 21 13) TNSFM > 105 15) TNSFM <= 124; criterion = 1, statistic = 18.277 16)* weights = 26 15) TNSFM > 124 17)* weights = 10 > postscript(file="/var/wessaorg/rcomp/tmp/2o29s1324643617.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/3f8fw1324643617.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 18 20.080000 -2.0800000 2 20 20.080000 -0.0800000 3 0 1.117647 -1.1176471 4 26 22.533333 3.4666667 5 31 30.115385 0.8846154 6 36 34.700000 1.3000000 7 23 22.533333 0.4666667 8 30 30.115385 -0.1153846 9 30 30.115385 -0.1153846 10 26 26.428571 -0.4285714 11 24 20.080000 3.9200000 12 30 30.115385 -0.1153846 13 21 20.080000 0.9200000 14 25 26.428571 -1.4285714 15 18 20.080000 -2.0800000 16 19 20.080000 -1.0800000 17 33 34.700000 -1.7000000 18 15 16.875000 -1.8750000 19 34 34.700000 -0.7000000 20 18 16.875000 1.1250000 21 15 16.875000 -1.8750000 22 30 30.115385 -0.1153846 23 25 26.428571 -1.4285714 24 34 26.428571 7.5714286 25 21 20.080000 0.9200000 26 21 20.080000 0.9200000 27 25 24.600000 0.4000000 28 31 30.115385 0.8846154 29 31 30.115385 0.8846154 30 20 20.080000 -0.0800000 31 28 26.428571 1.5714286 32 20 20.080000 -0.0800000 33 17 20.080000 -3.0800000 34 25 26.428571 -1.4285714 35 24 26.428571 -2.4285714 36 0 1.117647 -1.1176471 37 27 26.428571 0.5714286 38 14 12.000000 2.0000000 39 32 30.115385 1.8846154 40 31 30.115385 0.8846154 41 21 22.533333 -1.5333333 42 34 34.700000 -0.7000000 43 23 22.533333 0.4666667 44 24 24.600000 -0.6000000 45 26 26.428571 -0.4285714 46 22 22.533333 -0.5333333 47 35 30.115385 4.8846154 48 21 22.533333 -1.5333333 49 31 30.115385 0.8846154 50 26 26.428571 -0.4285714 51 22 22.533333 -0.5333333 52 21 20.080000 0.9200000 53 27 26.428571 0.5714286 54 30 30.115385 -0.1153846 55 33 34.700000 -1.7000000 56 11 12.000000 -1.0000000 57 26 26.428571 -0.4285714 58 26 26.428571 -0.4285714 59 23 24.600000 -1.6000000 60 38 34.700000 3.3000000 61 29 30.115385 -1.1153846 62 19 20.080000 -1.0800000 63 19 20.080000 -1.0800000 64 26 26.428571 -0.4285714 65 26 26.428571 -0.4285714 66 29 30.115385 -1.1153846 67 36 34.700000 1.3000000 68 25 24.600000 0.4000000 69 24 24.600000 -0.6000000 70 21 20.080000 0.9200000 71 19 20.080000 -1.0800000 72 12 12.000000 0.0000000 73 30 30.115385 -0.1153846 74 21 16.875000 4.1250000 75 34 34.700000 -0.7000000 76 32 30.115385 1.8846154 77 28 30.115385 -2.1153846 78 28 30.115385 -2.1153846 79 21 20.080000 0.9200000 80 31 30.115385 0.8846154 81 26 24.600000 1.4000000 82 29 30.115385 -1.1153846 83 23 22.533333 0.4666667 84 25 24.600000 0.4000000 85 22 22.533333 -0.5333333 86 26 26.428571 -0.4285714 87 33 34.700000 -1.7000000 88 24 26.428571 -2.4285714 89 24 24.600000 -0.6000000 90 21 20.080000 0.9200000 91 28 26.428571 1.5714286 92 27 26.428571 0.5714286 93 25 24.600000 0.4000000 94 15 16.875000 -1.8750000 95 13 12.000000 1.0000000 96 36 34.700000 1.3000000 97 24 24.600000 -0.6000000 98 1 1.117647 -0.1176471 99 24 26.428571 -2.4285714 100 31 30.115385 0.8846154 101 4 1.117647 2.8823529 102 20 20.080000 -0.0800000 103 23 22.533333 0.4666667 104 23 22.533333 0.4666667 105 12 12.000000 0.0000000 106 16 16.875000 -0.8750000 107 29 30.115385 -1.1153846 108 10 12.000000 -2.0000000 109 0 1.117647 -1.1176471 110 25 24.600000 0.4000000 111 21 20.080000 0.9200000 112 23 22.533333 0.4666667 113 21 22.533333 -1.5333333 114 21 20.080000 0.9200000 115 0 1.117647 -1.1176471 116 0 1.117647 -1.1176471 117 23 22.533333 0.4666667 118 29 26.428571 2.5714286 119 28 30.115385 -2.1153846 120 23 24.600000 -1.6000000 121 1 1.117647 -0.1176471 122 29 30.115385 -1.1153846 123 17 20.080000 -3.0800000 124 29 30.115385 -1.1153846 125 12 12.000000 0.0000000 126 2 1.117647 0.8823529 127 21 20.080000 0.9200000 128 25 24.600000 0.4000000 129 29 30.115385 -1.1153846 130 2 1.117647 0.8823529 131 0 1.117647 -1.1176471 132 18 16.875000 1.1250000 133 1 1.117647 -0.1176471 134 21 20.080000 0.9200000 135 0 1.117647 -1.1176471 136 4 1.117647 2.8823529 137 0 1.117647 -1.1176471 138 25 24.600000 0.4000000 139 26 24.600000 1.4000000 140 0 1.117647 -1.1176471 141 4 1.117647 2.8823529 142 17 16.875000 0.1250000 143 21 20.080000 0.9200000 144 22 22.533333 -0.5333333 > 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/45m9t1324643617.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/5w7y51324643617.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/6sh441324643617.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/7tvwl1324643617.tab") + } > > try(system("convert tmp/2o29s1324643617.ps tmp/2o29s1324643617.png",intern=TRUE)) character(0) > try(system("convert tmp/3f8fw1324643617.ps tmp/3f8fw1324643617.png",intern=TRUE)) character(0) > try(system("convert tmp/45m9t1324643617.ps tmp/45m9t1324643617.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.248 0.304 3.552