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 + ,89 + ,48 + ,63 + ,1760 + ,20 + ,56 + ,52 + ,56 + ,1609 + ,0 + ,18 + ,0 + ,0 + ,192 + ,26 + ,92 + ,49 + ,60 + ,2182 + ,31 + ,131 + ,76 + ,116 + ,3367 + ,36 + ,257 + ,125 + ,138 + ,6727 + ,23 + ,55 + ,46 + ,71 + ,1619 + ,30 + ,56 + ,68 + ,107 + ,1507 + ,30 + ,42 + ,52 + ,50 + ,1682 + ,26 + ,92 + ,67 + ,79 + ,2812 + ,24 + ,74 + ,50 + ,58 + ,1943 + ,30 + ,66 + ,71 + ,91 + ,2017 + ,21 + ,96 + ,41 + ,40 + ,1702 + ,25 + ,110 + ,79 + ,91 + ,3034 + ,18 + ,55 + ,49 + ,61 + ,1379 + ,19 + ,79 + ,54 + ,65 + ,1517 + ,33 + ,53 + ,75 + ,131 + ,1637 + ,15 + ,54 + ,1 + ,45 + ,1169 + ,34 + ,84 + ,54 + ,110 + ,2384 + ,18 + ,24 + ,13 + ,41 + ,726 + ,15 + ,55 + ,17 + ,37 + ,993 + ,30 + ,96 + ,89 + ,84 + ,2683 + ,25 + ,70 + ,37 + ,67 + ,1713 + ,34 + ,50 + ,44 + ,69 + ,2027 + ,21 + ,81 + ,50 + ,58 + ,1818 + ,21 + ,28 + ,39 + ,60 + ,1393 + ,25 + ,154 + ,59 + ,88 + ,2000 + ,31 + ,85 + ,79 + ,75 + ,1346 + ,31 + ,115 + ,60 + ,98 + ,2676 + ,20 + ,43 + ,52 + ,67 + ,2106 + ,28 + ,43 + ,50 + ,84 + ,1591 + ,20 + ,43 + ,54 + ,58 + ,1519 + ,17 + ,101 + ,53 + ,35 + ,2171 + ,25 + ,121 + ,76 + ,74 + ,3003 + ,24 + ,52 + ,60 + ,89 + ,2364 + ,0 + ,1 + ,0 + ,0 + ,1 + ,27 + ,60 + ,53 + ,75 + ,2017 + ,14 + ,50 + ,44 + ,39 + ,1564 + ,32 + ,47 + ,36 + ,93 + ,2072 + ,31 + ,63 + ,83 + ,123 + ,2106 + ,21 + ,69 + ,100 + ,73 + ,2270 + ,34 + ,56 + ,37 + ,118 + ,1643 + ,23 + ,29 + ,25 + ,76 + ,957 + ,24 + ,77 + ,59 + ,65 + ,2025 + ,26 + ,46 + ,55 + ,97 + ,1236 + ,22 + ,91 + ,41 + ,67 + ,1178 + ,35 + ,31 + ,23 + ,63 + ,744 + ,21 + ,92 + ,63 + ,84 + ,1976 + ,31 + ,85 + ,54 + ,112 + ,2224 + ,26 + ,56 + ,67 + ,75 + ,2561 + ,22 + ,28 + ,12 + ,39 + ,658 + ,21 + ,65 + ,84 + ,63 + ,1779 + ,27 + ,71 + ,64 + ,93 + ,2355 + ,30 + ,77 + ,56 + ,76 + ,2017 + ,33 + ,59 + ,54 + ,117 + ,1758 + ,11 + ,54 + ,35 + ,30 + ,1675 + ,26 + ,62 + ,52 + ,65 + ,1760 + ,26 + ,23 + ,25 + ,78 + ,875 + ,23 + ,65 + ,67 + ,87 + ,1169 + ,38 + ,93 + ,36 + ,85 + ,2789 + ,29 + ,56 + ,50 + ,107 + ,1606 + ,19 + ,76 + ,48 + ,60 + ,2020 + ,19 + ,58 + ,46 + ,53 + ,1300 + ,26 + ,35 + ,53 + ,67 + ,1235 + ,26 + ,32 + ,27 + ,90 + ,1215 + ,29 + ,38 + ,38 + ,89 + ,1230 + ,36 + ,67 + ,68 + ,135 + ,2226 + ,25 + ,65 + ,93 + ,71 + ,2897 + ,24 + ,38 + ,56 + ,75 + ,1071 + ,21 + ,15 + ,5 + ,42 + ,340 + ,19 + ,110 + ,53 + ,42 + ,2704 + ,12 + ,64 + ,36 + ,8 + ,1247 + ,30 + ,64 + ,72 + ,86 + ,1422 + ,21 + ,68 + ,46 + ,41 + ,1535 + ,34 + ,66 + ,73 + ,118 + ,2593 + ,32 + ,42 + ,12 + ,91 + ,1397 + ,28 + ,58 + ,76 + ,102 + ,2162 + ,28 + ,94 + ,71 + ,89 + ,2513 + ,21 + ,26 + ,17 + ,46 + ,917 + ,31 + ,71 + ,34 + ,60 + ,1234 + ,26 + ,66 + ,54 + ,69 + ,917 + ,29 + ,59 + ,39 + ,95 + ,1924 + ,23 + ,27 + ,26 + ,17 + ,853 + ,25 + ,34 + ,40 + ,61 + ,1398 + ,22 + ,44 + ,35 + ,55 + ,986 + ,26 + ,47 + ,32 + ,55 + ,1608 + ,33 + ,220 + ,55 + ,124 + ,2577 + ,24 + ,108 + ,58 + ,73 + ,1201 + ,24 + ,56 + ,39 + ,73 + ,1189 + ,21 + ,50 + ,39 + ,67 + ,1431 + ,28 + ,40 + ,48 + ,66 + ,1698 + ,27 + ,74 + ,72 + ,75 + ,2185 + ,25 + ,56 + ,39 + ,83 + ,1228 + ,15 + ,58 + ,27 + ,55 + ,1266 + ,13 + ,36 + ,22 + ,27 + ,830 + ,36 + ,111 + ,48 + ,115 + ,2238 + ,24 + ,68 + ,95 + ,76 + ,1787 + ,1 + ,12 + ,13 + ,0 + ,223 + ,24 + ,100 + ,32 + ,83 + ,2254 + ,31 + ,75 + ,41 + ,90 + ,1952 + ,4 + ,28 + ,22 + ,4 + ,665 + ,20 + ,22 + ,41 + ,56 + ,804 + ,23 + ,49 + ,55 + ,63 + ,1211 + ,23 + ,57 + ,28 + ,52 + ,1143 + ,12 + ,38 + ,30 + ,24 + ,710 + ,16 + ,22 + ,2 + ,17 + ,596 + ,29 + ,44 + ,79 + ,105 + ,1353 + ,10 + ,32 + ,18 + ,20 + ,971 + ,0 + ,0 + ,0 + ,0 + ,0 + ,25 + ,31 + ,46 + ,51 + ,1030 + ,21 + ,66 + ,25 + ,76 + ,1130 + ,23 + ,44 + ,50 + ,59 + ,1284 + ,21 + ,61 + ,59 + ,70 + ,1438 + ,21 + ,57 + ,36 + ,38 + ,849 + ,0 + ,5 + ,0 + ,0 + ,78 + ,0 + ,0 + ,0 + ,0 + ,0 + ,23 + ,39 + ,35 + ,81 + ,925 + ,29 + ,78 + ,68 + ,64 + ,1518 + ,28 + ,95 + ,26 + ,67 + ,1946 + ,23 + ,37 + ,36 + ,89 + ,914 + ,1 + ,19 + ,7 + ,3 + ,778 + ,29 + ,71 + ,67 + ,87 + ,1713 + ,17 + ,40 + ,30 + ,48 + ,895 + ,29 + ,52 + ,55 + ,62 + ,1756 + ,12 + ,40 + ,3 + ,32 + ,701 + ,2 + ,12 + ,10 + ,4 + ,285 + ,21 + ,55 + ,46 + ,70 + ,1774 + ,25 + ,29 + ,34 + ,90 + ,1071 + ,29 + ,46 + ,49 + ,91 + ,1582 + ,2 + ,9 + ,1 + ,1 + ,256 + ,0 + ,9 + ,0 + ,0 + ,98 + ,18 + ,55 + ,33 + ,39 + ,1358 + ,1 + ,3 + ,0 + ,0 + ,41 + ,21 + ,58 + ,48 + ,45 + ,1771 + ,0 + ,3 + ,5 + ,0 + ,42 + ,4 + ,16 + ,8 + ,7 + ,528 + ,0 + ,0 + ,0 + ,0 + ,0 + ,25 + ,45 + ,35 + ,75 + ,1026 + ,26 + ,38 + ,21 + ,52 + ,1296 + ,0 + ,4 + ,0 + ,0 + ,81 + ,4 + ,13 + ,0 + ,1 + ,257 + ,17 + ,23 + ,15 + ,49 + ,914 + ,21 + ,50 + ,50 + ,69 + ,1178 + ,22 + ,19 + ,17 + ,56 + ,1080) + ,dim=c(5 + ,144) + ,dimnames=list(c('TNORC' + ,'TNOLI' + ,'NOBC' + ,'NOSFBM' + ,'TNOPV') + ,1:144)) > y <- array(NA,dim=c(5,144),dimnames=list(c('TNORC','TNOLI','NOBC','NOSFBM','TNOPV'),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] "TNORC" > 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] "TNORC" "TNOLI" "NOBC" "NOSFBM" "TNOPV" > colnames(x)[par1] [1] "TNORC" > 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/1sk7y1324374095.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: TNORC Inputs: TNOLI, NOBC, NOSFBM, TNOPV Number of observations: 144 1) NOSFBM <= 32; criterion = 1, statistic = 113.698 2) NOSFBM <= 7; criterion = 1, statistic = 15.789 3)* weights = 17 2) NOSFBM > 7 4)* weights = 8 1) NOSFBM > 32 5) NOSFBM <= 84; criterion = 1, statistic = 66.132 6) NOSFBM <= 49; criterion = 1, statistic = 21.192 7)* weights = 16 6) NOSFBM > 49 8)* weights = 66 5) NOSFBM > 84 9) NOSFBM <= 107; criterion = 0.999, statistic = 14.087 10)* weights = 25 9) NOSFBM > 107 11)* weights = 12 > postscript(file="/var/wessaorg/rcomp/tmp/2bu0b1324374095.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/3slzv1324374095.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 24.181818 -6.1818182 2 20 24.181818 -4.1818182 3 0 1.117647 -1.1176471 4 26 24.181818 1.8181818 5 31 33.500000 -2.5000000 6 36 33.500000 2.5000000 7 23 24.181818 -1.1818182 8 30 28.320000 1.6800000 9 30 24.181818 5.8181818 10 26 24.181818 1.8181818 11 24 24.181818 -0.1818182 12 30 28.320000 1.6800000 13 21 18.625000 2.3750000 14 25 28.320000 -3.3200000 15 18 24.181818 -6.1818182 16 19 24.181818 -5.1818182 17 33 33.500000 -0.5000000 18 15 18.625000 -3.6250000 19 34 33.500000 0.5000000 20 18 18.625000 -0.6250000 21 15 18.625000 -3.6250000 22 30 24.181818 5.8181818 23 25 24.181818 0.8181818 24 34 24.181818 9.8181818 25 21 24.181818 -3.1818182 26 21 24.181818 -3.1818182 27 25 28.320000 -3.3200000 28 31 24.181818 6.8181818 29 31 28.320000 2.6800000 30 20 24.181818 -4.1818182 31 28 24.181818 3.8181818 32 20 24.181818 -4.1818182 33 17 18.625000 -1.6250000 34 25 24.181818 0.8181818 35 24 28.320000 -4.3200000 36 0 1.117647 -1.1176471 37 27 24.181818 2.8181818 38 14 18.625000 -4.6250000 39 32 28.320000 3.6800000 40 31 33.500000 -2.5000000 41 21 24.181818 -3.1818182 42 34 33.500000 0.5000000 43 23 24.181818 -1.1818182 44 24 24.181818 -0.1818182 45 26 28.320000 -2.3200000 46 22 24.181818 -2.1818182 47 35 24.181818 10.8181818 48 21 24.181818 -3.1818182 49 31 33.500000 -2.5000000 50 26 24.181818 1.8181818 51 22 18.625000 3.3750000 52 21 24.181818 -3.1818182 53 27 28.320000 -1.3200000 54 30 24.181818 5.8181818 55 33 33.500000 -0.5000000 56 11 13.625000 -2.6250000 57 26 24.181818 1.8181818 58 26 24.181818 1.8181818 59 23 28.320000 -5.3200000 60 38 28.320000 9.6800000 61 29 28.320000 0.6800000 62 19 24.181818 -5.1818182 63 19 24.181818 -5.1818182 64 26 24.181818 1.8181818 65 26 28.320000 -2.3200000 66 29 28.320000 0.6800000 67 36 33.500000 2.5000000 68 25 24.181818 0.8181818 69 24 24.181818 -0.1818182 70 21 18.625000 2.3750000 71 19 18.625000 0.3750000 72 12 13.625000 -1.6250000 73 30 28.320000 1.6800000 74 21 18.625000 2.3750000 75 34 33.500000 0.5000000 76 32 28.320000 3.6800000 77 28 28.320000 -0.3200000 78 28 28.320000 -0.3200000 79 21 18.625000 2.3750000 80 31 24.181818 6.8181818 81 26 24.181818 1.8181818 82 29 28.320000 0.6800000 83 23 13.625000 9.3750000 84 25 24.181818 0.8181818 85 22 24.181818 -2.1818182 86 26 24.181818 1.8181818 87 33 33.500000 -0.5000000 88 24 24.181818 -0.1818182 89 24 24.181818 -0.1818182 90 21 24.181818 -3.1818182 91 28 24.181818 3.8181818 92 27 24.181818 2.8181818 93 25 24.181818 0.8181818 94 15 24.181818 -9.1818182 95 13 13.625000 -0.6250000 96 36 33.500000 2.5000000 97 24 24.181818 -0.1818182 98 1 1.117647 -0.1176471 99 24 24.181818 -0.1818182 100 31 28.320000 2.6800000 101 4 1.117647 2.8823529 102 20 24.181818 -4.1818182 103 23 24.181818 -1.1818182 104 23 24.181818 -1.1818182 105 12 13.625000 -1.6250000 106 16 13.625000 2.3750000 107 29 28.320000 0.6800000 108 10 13.625000 -3.6250000 109 0 1.117647 -1.1176471 110 25 24.181818 0.8181818 111 21 24.181818 -3.1818182 112 23 24.181818 -1.1818182 113 21 24.181818 -3.1818182 114 21 18.625000 2.3750000 115 0 1.117647 -1.1176471 116 0 1.117647 -1.1176471 117 23 24.181818 -1.1818182 118 29 24.181818 4.8181818 119 28 24.181818 3.8181818 120 23 28.320000 -5.3200000 121 1 1.117647 -0.1176471 122 29 28.320000 0.6800000 123 17 18.625000 -1.6250000 124 29 24.181818 4.8181818 125 12 13.625000 -1.6250000 126 2 1.117647 0.8823529 127 21 24.181818 -3.1818182 128 25 28.320000 -3.3200000 129 29 28.320000 0.6800000 130 2 1.117647 0.8823529 131 0 1.117647 -1.1176471 132 18 18.625000 -0.6250000 133 1 1.117647 -0.1176471 134 21 18.625000 2.3750000 135 0 1.117647 -1.1176471 136 4 1.117647 2.8823529 137 0 1.117647 -1.1176471 138 25 24.181818 0.8181818 139 26 24.181818 1.8181818 140 0 1.117647 -1.1176471 141 4 1.117647 2.8823529 142 17 18.625000 -1.6250000 143 21 24.181818 -3.1818182 144 22 24.181818 -2.1818182 > 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/4mv5d1324374095.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/5yly21324374095.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/6r2v01324374095.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/7jlui1324374095.tab") + } > > try(system("convert tmp/2bu0b1324374095.ps tmp/2bu0b1324374095.png",intern=TRUE)) character(0) > try(system("convert tmp/3slzv1324374095.ps tmp/3slzv1324374095.png",intern=TRUE)) character(0) > try(system("convert tmp/4mv5d1324374095.ps tmp/4mv5d1324374095.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.334 0.255 3.601