R version 2.12.1 (2010-12-16) 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(1 + ,78 + ,20 + ,17 + ,30 + ,28 + ,2 + ,46 + ,38 + ,17 + ,42 + ,39 + ,3 + ,18 + ,0 + ,0 + ,0 + ,0 + ,4 + ,84 + ,49 + ,22 + ,54 + ,54 + ,5 + ,125 + ,74 + ,30 + ,86 + ,80 + ,6 + ,215 + ,104 + ,31 + ,157 + ,144 + ,7 + ,50 + ,37 + ,19 + ,36 + ,36 + ,8 + ,48 + ,53 + ,25 + ,48 + ,48 + ,9 + ,37 + ,42 + ,30 + ,45 + ,42 + ,10 + ,86 + ,62 + ,26 + ,77 + ,71 + ,11 + ,69 + ,50 + ,20 + ,49 + ,49 + ,12 + ,59 + ,65 + ,25 + ,77 + ,74 + ,13 + ,85 + ,28 + ,15 + ,28 + ,27 + ,14 + ,84 + ,48 + ,22 + ,84 + ,83 + ,15 + ,44 + ,42 + ,12 + ,31 + ,31 + ,16 + ,67 + ,47 + ,19 + ,28 + ,28 + ,17 + ,49 + ,71 + ,28 + ,99 + ,98 + ,18 + ,47 + ,0 + ,12 + ,2 + ,2 + ,19 + ,77 + ,50 + ,28 + ,41 + ,43 + ,20 + ,20 + ,12 + ,13 + ,25 + ,24 + ,21 + ,49 + ,16 + ,14 + ,16 + ,16 + ,22 + ,81 + ,76 + ,27 + ,96 + ,95 + ,23 + ,58 + ,29 + ,25 + ,23 + ,22 + ,24 + ,45 + ,38 + ,30 + ,33 + ,33 + ,25 + ,73 + ,50 + ,18 + ,46 + ,45 + ,26 + ,22 + ,33 + ,17 + ,59 + ,59 + ,27 + ,138 + ,45 + ,22 + ,72 + ,66 + ,28 + ,74 + ,59 + ,28 + ,72 + ,70 + ,29 + ,102 + ,49 + ,25 + ,62 + ,56 + ,30 + ,35 + ,40 + ,16 + ,55 + ,55 + ,31 + ,39 + ,40 + ,23 + ,27 + ,27 + ,32 + ,38 + ,51 + ,20 + ,41 + ,37 + ,33 + ,88 + ,41 + ,11 + ,51 + ,48 + ,34 + ,102 + ,73 + ,20 + ,26 + ,26 + ,35 + ,42 + ,43 + ,21 + ,65 + ,64 + ,36 + ,1 + ,0 + ,0 + ,0 + ,0 + ,37 + ,54 + ,46 + ,27 + ,28 + ,21 + ,38 + ,46 + ,44 + ,14 + ,44 + ,44 + ,39 + ,41 + ,31 + ,29 + ,36 + ,36 + ,40 + ,49 + ,71 + ,31 + ,100 + ,89 + ,41 + ,56 + ,61 + ,19 + ,104 + ,101 + ,42 + ,47 + ,28 + ,30 + ,35 + ,31 + ,43 + ,25 + ,21 + ,23 + ,69 + ,65 + ,44 + ,62 + ,42 + ,20 + ,73 + ,71 + ,45 + ,41 + ,44 + ,22 + ,106 + ,102 + ,46 + ,72 + ,34 + ,19 + ,53 + ,53 + ,47 + ,26 + ,15 + ,32 + ,43 + ,41 + ,48 + ,77 + ,46 + ,18 + ,49 + ,46 + ,49 + ,75 + ,43 + ,26 + ,38 + ,37 + ,50 + ,51 + ,47 + ,25 + ,51 + ,51 + ,51 + ,28 + ,12 + ,22 + ,14 + ,14 + ,52 + ,54 + ,42 + ,19 + ,40 + ,40 + ,53 + ,64 + ,56 + ,24 + ,79 + ,77 + ,54 + ,67 + ,41 + ,26 + ,52 + ,51 + ,55 + ,48 + ,48 + ,27 + ,44 + ,43 + ,56 + ,44 + ,30 + ,10 + ,34 + ,33 + ,57 + ,55 + ,44 + ,26 + ,47 + ,47 + ,58 + ,17 + ,25 + ,21 + ,32 + ,31 + ,59 + ,55 + ,42 + ,21 + ,31 + ,31 + ,60 + ,72 + ,28 + ,34 + ,40 + ,40 + ,61 + ,47 + ,33 + ,29 + ,42 + ,42 + ,62 + ,62 + ,32 + ,18 + ,34 + ,35 + ,63 + ,45 + ,28 + ,16 + ,40 + ,40 + ,64 + ,29 + ,31 + ,23 + ,35 + ,30 + ,65 + ,25 + ,13 + ,22 + ,11 + ,11 + ,66 + ,37 + ,38 + ,29 + ,43 + ,41 + ,67 + ,60 + ,39 + ,31 + ,53 + ,53 + ,68 + ,57 + ,68 + ,21 + ,82 + ,82 + ,69 + ,32 + ,32 + ,21 + ,41 + ,41 + ,70 + ,15 + ,5 + ,21 + ,6 + ,6 + ,71 + ,102 + ,53 + ,15 + ,82 + ,81 + ,72 + ,52 + ,33 + ,9 + ,47 + ,47 + ,73 + ,53 + ,48 + ,21 + ,108 + ,100 + ,74 + ,58 + ,36 + ,18 + ,46 + ,46 + ,75 + ,51 + ,52 + ,31 + ,38 + ,38 + ,76 + ,31 + ,0 + ,24 + ,0 + ,0 + ,77 + ,50 + ,52 + ,24 + ,45 + ,45 + ,78 + ,78 + ,45 + ,22 + ,57 + ,56 + ,79 + ,23 + ,16 + ,21 + ,20 + ,18 + ,80 + ,66 + ,33 + ,26 + ,56 + ,54 + ,81 + ,56 + ,48 + ,22 + ,38 + ,37 + ,82 + ,51 + ,33 + ,26 + ,42 + ,40 + ,83 + ,24 + ,24 + ,20 + ,37 + ,37 + ,84 + ,32 + ,37 + ,25 + ,36 + ,36 + ,85 + ,36 + ,16 + ,19 + ,34 + ,34 + ,86 + ,42 + ,32 + ,22 + ,53 + ,49 + ,87 + ,180 + ,48 + ,25 + ,85 + ,82 + ,88 + ,83 + ,36 + ,19 + ,36 + ,36 + ,89 + ,46 + ,29 + ,21 + ,33 + ,33 + ,90 + ,40 + ,26 + ,20 + ,57 + ,55 + ,91 + ,33 + ,37 + ,23 + ,50 + ,50 + ,92 + ,66 + ,58 + ,22 + ,71 + ,71 + ,93 + ,52 + ,35 + ,21 + ,32 + ,31 + ,94 + ,51 + ,24 + ,12 + ,45 + ,42 + ,95 + ,30 + ,18 + ,9 + ,33 + ,31 + ,96 + ,89 + ,37 + ,32 + ,53 + ,51 + ,97 + ,49 + ,86 + ,24 + ,64 + ,64 + ,98 + ,12 + ,13 + ,1 + ,14 + ,14 + ,99 + ,83 + ,20 + ,24 + ,38 + ,37 + ,100 + ,51 + ,32 + ,20 + ,39 + ,37 + ,101 + ,24 + ,8 + ,4 + ,8 + ,8 + ,102 + ,19 + ,38 + ,15 + ,38 + ,38 + ,103 + ,44 + ,45 + ,21 + ,24 + ,23 + ,104 + ,52 + ,24 + ,23 + ,22 + ,22 + ,105 + ,35 + ,23 + ,12 + ,18 + ,18 + ,106 + ,22 + ,2 + ,16 + ,3 + ,1 + ,107 + ,32 + ,52 + ,24 + ,49 + ,48 + ,108 + ,22 + ,5 + ,9 + ,5 + ,5 + ,109 + ,0 + ,0 + ,0 + ,0 + ,0 + ,110 + ,26 + ,43 + ,22 + ,47 + ,46 + ,111 + ,48 + ,18 + ,17 + ,33 + ,33 + ,112 + ,35 + ,41 + ,18 + ,44 + ,41 + ,113 + ,47 + ,45 + ,21 + ,56 + ,57 + ,114 + ,55 + ,29 + ,17 + ,49 + ,49 + ,115 + ,5 + ,0 + ,0 + ,0 + ,0 + ,116 + ,0 + ,0 + ,0 + ,0 + ,0 + ,117 + ,37 + ,32 + ,20 + ,45 + ,45 + ,118 + ,65 + ,58 + ,26 + ,78 + ,78 + ,119 + ,81 + ,17 + ,26 + ,51 + ,46 + ,120 + ,32 + ,24 + ,20 + ,25 + ,25 + ,121 + ,19 + ,7 + ,1 + ,1 + ,1 + ,122 + ,58 + ,62 + ,24 + ,62 + ,59 + ,123 + ,33 + ,30 + ,14 + ,29 + ,29 + ,124 + ,42 + ,49 + ,26 + ,26 + ,26 + ,125 + ,37 + ,3 + ,12 + ,4 + ,4 + ,126 + ,12 + ,10 + ,2 + ,10 + ,10 + ,127 + ,41 + ,42 + ,16 + ,43 + ,43 + ,128 + ,23 + ,18 + ,22 + ,36 + ,36 + ,129 + ,35 + ,40 + ,28 + ,43 + ,41 + ,130 + ,9 + ,1 + ,2 + ,0 + ,0 + ,131 + ,9 + ,0 + ,0 + ,0 + ,0 + ,132 + ,49 + ,29 + ,17 + ,33 + ,32 + ,133 + ,3 + ,0 + ,1 + ,0 + ,0 + ,134 + ,41 + ,46 + ,17 + ,53 + ,53 + ,135 + ,3 + ,5 + ,0 + ,0 + ,0 + ,136 + ,16 + ,8 + ,4 + ,6 + ,6 + ,137 + ,0 + ,0 + ,0 + ,0 + ,0 + ,138 + ,41 + ,21 + ,25 + ,19 + ,18 + ,139 + ,31 + ,21 + ,26 + ,26 + ,26 + ,140 + ,4 + ,0 + ,0 + ,0 + ,0 + ,141 + ,11 + ,0 + ,0 + ,0 + ,0 + ,142 + ,20 + ,15 + ,15 + ,16 + ,16 + ,143 + ,40 + ,40 + ,18 + ,84 + ,84 + ,144 + ,16 + ,17 + ,19 + ,28 + ,22) + ,dim=c(6 + ,144) + ,dimnames=list(c('Ranking' + ,'Logins' + ,'BloggedComputations' + ,'ReviewedCompendiums' + ,'includedhyperlinks' + ,'includedblogs') + ,1:144)) > y <- array(NA,dim=c(6,144),dimnames=list(c('Ranking','Logins','BloggedComputations','ReviewedCompendiums','includedhyperlinks','includedblogs'),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 = '5' > 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] "includedhyperlinks" > x[,par1] [1] 30 42 0 54 86 157 36 48 45 77 49 77 28 84 31 28 99 2 [19] 41 25 16 96 23 33 46 59 72 72 62 55 27 41 51 26 65 0 [37] 28 44 36 100 104 35 69 73 106 53 43 49 38 51 14 40 79 52 [55] 44 34 47 32 31 40 42 34 40 35 11 43 53 82 41 6 82 47 [73] 108 46 38 0 45 57 20 56 38 42 37 36 34 53 85 36 33 57 [91] 50 71 32 45 33 53 64 14 38 39 8 38 24 22 18 3 49 5 [109] 0 47 33 44 56 49 0 0 45 78 51 25 1 62 29 26 4 10 [127] 43 36 43 0 0 33 0 53 0 6 0 19 26 0 0 16 84 28 > 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 3 4 5 6 8 10 11 14 16 18 19 20 22 23 24 25 26 13 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 1 1 2 3 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 1 4 1 1 2 2 5 3 2 5 1 5 1 3 3 3 4 3 4 2 47 48 49 50 51 52 53 54 55 56 57 59 62 64 65 69 71 72 73 77 3 1 4 1 3 1 5 1 1 2 2 1 2 1 1 1 1 2 1 2 78 79 82 84 85 86 96 99 100 104 106 108 157 1 1 2 2 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "Ranking" "Logins" "BloggedComputations" [4] "ReviewedCompendiums" "includedhyperlinks" "includedblogs" > colnames(x)[par1] [1] "includedhyperlinks" > x[,par1] [1] 30 42 0 54 86 157 36 48 45 77 49 77 28 84 31 28 99 2 [19] 41 25 16 96 23 33 46 59 72 72 62 55 27 41 51 26 65 0 [37] 28 44 36 100 104 35 69 73 106 53 43 49 38 51 14 40 79 52 [55] 44 34 47 32 31 40 42 34 40 35 11 43 53 82 41 6 82 47 [73] 108 46 38 0 45 57 20 56 38 42 37 36 34 53 85 36 33 57 [91] 50 71 32 45 33 53 64 14 38 39 8 38 24 22 18 3 49 5 [109] 0 47 33 44 56 49 0 0 45 78 51 25 1 62 29 26 4 10 [127] 43 36 43 0 0 33 0 53 0 6 0 19 26 0 0 16 84 28 > 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/1qhng1323867582.tab") + } + } > m Conditional inference tree with 12 terminal nodes Response: includedhyperlinks Inputs: Ranking, Logins, BloggedComputations, ReviewedCompendiums, includedblogs Number of observations: 144 1) includedblogs <= 53; criterion = 1, statistic = 142.303 2) includedblogs <= 18; criterion = 1, statistic = 109.217 3) includedblogs <= 8; criterion = 1, statistic = 28.843 4) includedblogs <= 0; criterion = 1, statistic = 19.427 5)* weights = 13 4) includedblogs > 0 6)* weights = 8 3) includedblogs > 8 7)* weights = 9 2) includedblogs > 18 8) includedblogs <= 38; criterion = 1, statistic = 77.213 9) includedblogs <= 29; criterion = 1, statistic = 36.397 10)* weights = 15 9) includedblogs > 29 11) includedblogs <= 35; criterion = 1, statistic = 18.861 12)* weights = 14 11) includedblogs > 35 13)* weights = 13 8) includedblogs > 38 14) includedblogs <= 45; criterion = 1, statistic = 33.408 15) includedblogs <= 41; criterion = 0.99, statistic = 9.494 16)* weights = 10 15) includedblogs > 41 17)* weights = 10 14) includedblogs > 45 18)* weights = 19 1) includedblogs > 53 19) includedblogs <= 84; criterion = 1, statistic = 31.465 20) includedblogs <= 64; criterion = 1, statistic = 24.018 21)* weights = 11 20) includedblogs > 64 22)* weights = 15 19) includedblogs > 84 23)* weights = 7 > postscript(file="/var/www/rcomp/tmp/2g3cl1323867582.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/3m37f1323867582.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 30 26.33333 3.66666667 2 42 41.80000 0.20000000 3 0 0.00000 0.00000000 4 54 58.81818 -4.81818182 5 86 78.06667 7.93333333 6 157 110.00000 47.00000000 7 36 37.46154 -1.46153846 8 48 50.05263 -2.05263158 9 45 44.00000 1.00000000 10 77 78.06667 -1.06666667 11 49 50.05263 -1.05263158 12 77 78.06667 -1.06666667 13 28 26.33333 1.66666667 14 84 78.06667 5.93333333 15 31 33.07143 -2.07142857 16 28 26.33333 1.66666667 17 99 110.00000 -11.00000000 18 2 4.37500 -2.37500000 19 41 44.00000 -3.00000000 20 25 26.33333 -1.33333333 21 16 15.33333 0.66666667 22 96 110.00000 -14.00000000 23 23 26.33333 -3.33333333 24 33 33.07143 -0.07142857 25 46 44.00000 2.00000000 26 59 58.81818 0.18181818 27 72 78.06667 -6.06666667 28 72 78.06667 -6.06666667 29 62 58.81818 3.18181818 30 55 58.81818 -3.81818182 31 27 26.33333 0.66666667 32 41 37.46154 3.53846154 33 51 50.05263 0.94736842 34 26 26.33333 -0.33333333 35 65 58.81818 6.18181818 36 0 0.00000 0.00000000 37 28 26.33333 1.66666667 38 44 44.00000 0.00000000 39 36 37.46154 -1.46153846 40 100 110.00000 -10.00000000 41 104 110.00000 -6.00000000 42 35 33.07143 1.92857143 43 69 78.06667 -9.06666667 44 73 78.06667 -5.06666667 45 106 110.00000 -4.00000000 46 53 50.05263 2.94736842 47 43 41.80000 1.20000000 48 49 50.05263 -1.05263158 49 38 37.46154 0.53846154 50 51 50.05263 0.94736842 51 14 15.33333 -1.33333333 52 40 41.80000 -1.80000000 53 79 78.06667 0.93333333 54 52 50.05263 1.94736842 55 44 44.00000 0.00000000 56 34 33.07143 0.92857143 57 47 50.05263 -3.05263158 58 32 33.07143 -1.07142857 59 31 33.07143 -2.07142857 60 40 41.80000 -1.80000000 61 42 44.00000 -2.00000000 62 34 33.07143 0.92857143 63 40 41.80000 -1.80000000 64 35 33.07143 1.92857143 65 11 15.33333 -4.33333333 66 43 41.80000 1.20000000 67 53 50.05263 2.94736842 68 82 78.06667 3.93333333 69 41 41.80000 -0.80000000 70 6 4.37500 1.62500000 71 82 78.06667 3.93333333 72 47 50.05263 -3.05263158 73 108 110.00000 -2.00000000 74 46 50.05263 -4.05263158 75 38 37.46154 0.53846154 76 0 0.00000 0.00000000 77 45 44.00000 1.00000000 78 57 58.81818 -1.81818182 79 20 15.33333 4.66666667 80 56 58.81818 -2.81818182 81 38 37.46154 0.53846154 82 42 41.80000 0.20000000 83 37 37.46154 -0.46153846 84 36 37.46154 -1.46153846 85 34 33.07143 0.92857143 86 53 50.05263 2.94736842 87 85 78.06667 6.93333333 88 36 37.46154 -1.46153846 89 33 33.07143 -0.07142857 90 57 58.81818 -1.81818182 91 50 50.05263 -0.05263158 92 71 78.06667 -7.06666667 93 32 33.07143 -1.07142857 94 45 44.00000 1.00000000 95 33 33.07143 -0.07142857 96 53 50.05263 2.94736842 97 64 58.81818 5.18181818 98 14 15.33333 -1.33333333 99 38 37.46154 0.53846154 100 39 37.46154 1.53846154 101 8 4.37500 3.62500000 102 38 37.46154 0.53846154 103 24 26.33333 -2.33333333 104 22 26.33333 -4.33333333 105 18 15.33333 2.66666667 106 3 4.37500 -1.37500000 107 49 50.05263 -1.05263158 108 5 4.37500 0.62500000 109 0 0.00000 0.00000000 110 47 50.05263 -3.05263158 111 33 33.07143 -0.07142857 112 44 41.80000 2.20000000 113 56 58.81818 -2.81818182 114 49 50.05263 -1.05263158 115 0 0.00000 0.00000000 116 0 0.00000 0.00000000 117 45 44.00000 1.00000000 118 78 78.06667 -0.06666667 119 51 50.05263 0.94736842 120 25 26.33333 -1.33333333 121 1 4.37500 -3.37500000 122 62 58.81818 3.18181818 123 29 26.33333 2.66666667 124 26 26.33333 -0.33333333 125 4 4.37500 -0.37500000 126 10 15.33333 -5.33333333 127 43 44.00000 -1.00000000 128 36 37.46154 -1.46153846 129 43 41.80000 1.20000000 130 0 0.00000 0.00000000 131 0 0.00000 0.00000000 132 33 33.07143 -0.07142857 133 0 0.00000 0.00000000 134 53 50.05263 2.94736842 135 0 0.00000 0.00000000 136 6 4.37500 1.62500000 137 0 0.00000 0.00000000 138 19 15.33333 3.66666667 139 26 26.33333 -0.33333333 140 0 0.00000 0.00000000 141 0 0.00000 0.00000000 142 16 15.33333 0.66666667 143 84 78.06667 5.93333333 144 28 26.33333 1.66666667 > 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/4bvy11323867582.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/5muv21323867582.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/6jtk51323867582.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/7nemm1323867582.tab") + } > > try(system("convert tmp/2g3cl1323867582.ps tmp/2g3cl1323867582.png",intern=TRUE)) character(0) > try(system("convert tmp/3m37f1323867582.ps tmp/3m37f1323867582.png",intern=TRUE)) character(0) > try(system("convert tmp/4bvy11323867582.ps tmp/4bvy11323867582.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.120 0.288 4.619