R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(41 + ,38 + ,7 + ,53 + ,145 + ,56 + ,39 + ,32 + ,5 + ,86 + ,101 + ,56 + ,30 + ,35 + ,5 + ,66 + ,98 + ,54 + ,31 + ,33 + ,5 + ,67 + ,132 + ,89 + ,34 + ,37 + ,8 + ,76 + ,60 + ,40 + ,35 + ,29 + ,6 + ,78 + ,38 + ,25 + ,39 + ,31 + ,5 + ,53 + ,144 + ,92 + ,34 + ,36 + ,6 + ,80 + ,5 + ,18 + ,36 + ,35 + ,5 + ,74 + ,28 + ,63 + ,37 + ,38 + ,4 + ,76 + ,84 + ,44 + ,38 + ,31 + ,6 + ,79 + ,79 + ,33 + ,36 + ,34 + ,5 + ,54 + ,127 + ,84 + ,38 + ,35 + ,5 + ,67 + ,78 + ,88 + ,39 + ,38 + ,6 + ,54 + ,60 + ,55 + ,33 + ,37 + ,7 + ,87 + ,131 + ,60 + ,32 + ,33 + ,6 + ,58 + ,84 + ,66 + ,36 + ,32 + ,7 + ,75 + ,133 + ,154 + ,38 + ,38 + ,6 + ,88 + ,150 + ,53 + ,39 + ,38 + ,8 + ,64 + ,91 + ,119 + ,32 + ,32 + ,7 + ,57 + ,132 + ,41 + ,32 + ,33 + ,5 + ,66 + ,136 + ,61 + ,31 + ,31 + ,5 + ,68 + ,124 + ,58 + ,39 + ,38 + ,7 + ,54 + ,118 + ,75 + ,37 + ,39 + ,7 + ,56 + ,70 + ,33 + ,39 + ,32 + ,5 + ,86 + ,107 + ,40 + ,41 + ,32 + ,4 + ,80 + ,119 + ,92 + ,36 + ,35 + ,10 + ,76 + ,89 + ,100 + ,33 + ,37 + ,6 + ,69 + ,112 + ,112 + ,33 + ,33 + ,5 + ,78 + ,108 + ,73 + ,34 + ,33 + ,5 + ,67 + ,52 + ,40 + ,31 + ,28 + ,5 + ,80 + ,112 + ,45 + ,27 + ,32 + ,5 + ,54 + ,116 + ,60 + ,37 + ,31 + ,6 + ,71 + ,123 + ,62 + ,34 + ,37 + ,5 + ,84 + ,125 + ,75 + ,34 + ,30 + ,5 + ,74 + ,27 + ,31 + ,32 + ,33 + ,5 + ,71 + ,162 + ,77 + ,29 + ,31 + ,5 + ,63 + ,32 + ,34 + ,36 + ,33 + ,5 + ,71 + ,64 + ,46 + ,29 + ,31 + ,5 + ,76 + ,92 + ,99 + ,35 + ,33 + ,5 + ,69 + ,0 + ,17 + ,37 + ,32 + ,5 + ,74 + ,83 + ,66 + ,34 + ,33 + ,7 + ,75 + ,41 + ,30 + ,38 + ,32 + ,5 + ,54 + ,47 + ,76 + ,35 + ,33 + ,6 + ,52 + ,120 + ,146 + ,38 + ,28 + ,7 + ,69 + ,105 + ,67 + ,37 + ,35 + ,7 + ,68 + ,79 + ,56 + ,38 + ,39 + ,5 + ,65 + ,65 + ,107 + ,33 + ,34 + ,5 + ,75 + ,70 + ,58 + ,36 + ,38 + ,4 + ,74 + ,55 + ,34 + ,38 + ,32 + ,5 + ,75 + ,39 + ,61 + ,32 + ,38 + ,4 + ,72 + ,67 + ,119 + ,32 + ,30 + ,5 + ,67 + ,21 + ,42 + ,32 + ,33 + ,5 + ,63 + ,127 + ,66 + ,34 + ,38 + ,7 + ,62 + ,152 + ,89 + ,32 + ,32 + ,5 + ,63 + ,113 + ,44 + ,37 + ,32 + ,5 + ,76 + ,99 + ,66 + ,39 + ,34 + ,6 + ,74 + ,7 + ,24 + ,29 + ,34 + ,4 + ,67 + ,141 + ,259 + ,37 + ,36 + ,6 + ,73 + ,21 + ,17 + ,35 + ,34 + ,6 + ,70 + ,35 + ,64 + ,30 + ,28 + ,5 + ,53 + ,109 + ,41 + ,38 + ,34 + ,7 + ,77 + ,133 + ,68 + ,34 + ,35 + ,6 + ,77 + ,123 + ,168 + ,31 + ,35 + ,8 + ,52 + ,26 + ,43 + ,34 + ,31 + ,7 + ,54 + ,230 + ,132 + ,35 + ,37 + ,5 + ,80 + ,166 + ,105 + ,36 + ,35 + ,6 + ,66 + ,68 + ,71 + ,30 + ,27 + ,6 + ,73 + ,147 + ,112 + ,39 + ,40 + ,5 + ,63 + ,179 + ,94 + ,35 + ,37 + ,5 + ,69 + ,61 + ,82 + ,38 + ,36 + ,5 + ,67 + ,101 + ,70 + ,31 + ,38 + ,5 + ,54 + ,108 + ,57 + ,34 + ,39 + ,4 + ,81 + ,90 + ,53 + ,38 + ,41 + ,6 + ,69 + ,114 + ,103 + ,34 + ,27 + ,6 + ,84 + ,103 + ,121 + ,39 + ,30 + ,6 + ,80 + ,142 + ,62 + ,37 + ,37 + ,6 + ,70 + ,79 + ,52 + ,34 + ,31 + ,7 + ,69 + ,88 + ,52 + ,28 + ,31 + ,5 + ,77 + ,25 + ,32 + ,37 + ,27 + ,7 + ,54 + ,83 + ,62 + ,33 + ,36 + ,6 + ,79 + ,113 + ,45 + ,37 + ,38 + ,5 + ,30 + ,118 + ,46 + ,35 + ,37 + ,5 + ,71 + ,110 + ,63 + ,37 + ,33 + ,4 + ,73 + ,129 + ,75 + ,32 + ,34 + ,8 + ,72 + ,51 + ,88 + ,33 + ,31 + ,8 + ,77 + ,93 + ,46 + ,38 + ,39 + ,5 + ,75 + ,76 + ,53 + ,33 + ,34 + ,5 + ,69 + ,49 + ,37 + ,29 + ,32 + ,6 + ,54 + ,118 + ,90 + ,33 + ,33 + ,4 + ,70 + ,38 + ,63 + ,31 + ,36 + ,5 + ,73 + ,141 + ,78 + ,36 + ,32 + ,5 + ,54 + ,58 + ,25 + ,35 + ,41 + ,5 + ,77 + ,27 + ,45 + ,32 + ,28 + ,5 + ,82 + ,91 + ,46 + ,29 + ,30 + ,6 + ,80 + ,48 + ,41 + ,39 + ,36 + ,6 + ,80 + ,63 + ,144 + ,37 + ,35 + ,5 + ,69 + ,56 + ,82 + ,35 + ,31 + ,6 + ,78 + ,144 + ,91 + ,37 + ,34 + ,5 + ,81 + ,73 + ,71 + ,32 + ,36 + ,7 + ,76 + ,168 + ,63 + ,38 + ,36 + ,5 + ,76 + ,64 + ,53 + ,37 + ,35 + ,6 + ,73 + ,97 + ,62 + ,36 + ,37 + ,6 + ,85 + ,117 + ,63 + ,32 + ,28 + ,6 + ,66 + ,100 + ,32 + ,33 + ,39 + ,4 + ,79 + ,149 + ,39 + ,40 + ,32 + ,5 + ,68 + ,187 + ,62 + ,38 + ,35 + ,5 + ,76 + ,127 + ,117 + ,41 + ,39 + ,7 + ,71 + ,37 + ,34 + ,36 + ,35 + ,6 + ,54 + ,245 + ,92 + ,43 + ,42 + ,9 + ,46 + ,87 + ,93 + ,30 + ,34 + ,6 + ,82 + ,177 + ,54 + ,31 + ,33 + ,6 + ,74 + ,49 + ,144 + ,32 + ,41 + ,5 + ,88 + ,49 + ,14 + ,32 + ,33 + ,6 + ,38 + ,73 + ,61 + ,37 + ,34 + ,5 + ,76 + ,177 + ,109 + ,37 + ,32 + ,8 + ,86 + ,94 + ,38 + ,33 + ,40 + ,7 + ,54 + ,117 + ,73 + ,34 + ,40 + ,5 + ,70 + ,60 + ,75 + ,33 + ,35 + ,7 + ,69 + ,55 + ,50 + ,38 + ,36 + ,6 + ,90 + ,39 + ,61 + ,33 + ,37 + ,6 + ,54 + ,64 + ,55 + ,31 + ,27 + ,9 + ,76 + ,26 + ,77 + ,38 + ,39 + ,7 + ,89 + ,64 + ,75 + ,37 + ,38 + ,6 + ,76 + ,58 + ,72 + ,33 + ,31 + ,5 + ,73 + ,95 + ,50 + ,31 + ,33 + ,5 + ,79 + ,25 + ,32 + ,39 + ,32 + ,6 + ,90 + ,26 + ,53 + ,44 + ,39 + ,6 + ,74 + ,76 + ,42 + ,33 + ,36 + ,7 + ,81 + ,129 + ,71 + ,35 + ,33 + ,5 + ,72 + ,11 + ,10 + ,32 + ,33 + ,5 + ,71 + ,2 + ,35 + ,28 + ,32 + ,5 + ,66 + ,101 + ,65 + ,40 + ,37 + ,6 + ,77 + ,28 + ,25 + ,27 + ,30 + ,4 + ,65 + ,36 + ,66 + ,37 + ,38 + ,5 + ,74 + ,89 + ,41 + ,32 + ,29 + ,7 + ,82 + ,193 + ,86 + ,28 + ,22 + ,5 + ,54 + ,4 + ,16 + ,34 + ,35 + ,7 + ,63 + ,84 + ,42 + ,30 + ,35 + ,7 + ,54 + ,23 + ,19 + ,35 + ,34 + ,6 + ,64 + ,39 + ,19 + ,31 + ,35 + ,5 + ,69 + ,14 + ,45 + ,32 + ,34 + ,8 + ,54 + ,78 + ,65 + ,30 + ,34 + ,5 + ,84 + ,14 + ,35 + ,30 + ,35 + ,5 + ,86 + ,101 + ,95 + ,31 + ,23 + ,5 + ,77 + ,82 + ,49 + ,40 + ,31 + ,6 + ,89 + ,24 + ,37 + ,32 + ,27 + ,4 + ,76 + ,36 + ,64 + ,36 + ,36 + ,5 + ,60 + ,75 + ,38 + ,32 + ,31 + ,5 + ,75 + ,16 + ,34 + ,35 + ,32 + ,7 + ,73 + ,55 + ,32 + ,38 + ,39 + ,6 + ,85 + ,131 + ,65 + ,42 + ,37 + ,7 + ,79 + ,131 + ,52 + ,34 + ,38 + ,10 + ,71 + ,39 + ,62 + ,35 + ,39 + ,6 + ,72 + ,144 + ,65 + ,35 + ,34 + ,8 + ,69 + ,139 + ,83 + ,33 + ,31 + ,4 + ,78 + ,211 + ,95 + ,36 + ,32 + ,5 + ,54 + ,78 + ,29 + ,32 + ,37 + ,6 + ,69 + ,50 + ,18 + ,33 + ,36 + ,7 + ,81 + ,39 + ,33 + ,34 + ,32 + ,7 + ,84 + ,90 + ,247 + ,32 + ,35 + ,6 + ,84 + ,166 + ,139 + ,34 + ,36 + ,6 + ,69 + ,12 + ,29) + ,dim=c(6 + ,162) + ,dimnames=list(c('Connected' + ,'Separate' + ,'age' + ,'beloning' + ,'totblogs' + ,'Login') + ,1:162)) > y <- array(NA,dim=c(6,162),dimnames=list(c('Connected','Separate','age','beloning','totblogs','Login'),1:162)) > 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 = '5' > par2 = 'none' > par1 = '6' > 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 Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 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] "Login" > x[,par1] [1] 56 56 54 89 40 25 92 18 63 44 33 84 88 55 60 66 154 53 [19] 119 41 61 58 75 33 40 92 100 112 73 40 45 60 62 75 31 77 [37] 34 46 99 17 66 30 76 146 67 56 107 58 34 61 119 42 66 89 [55] 44 66 24 259 17 64 41 68 168 43 132 105 71 112 94 82 70 57 [73] 53 103 121 62 52 52 32 62 45 46 63 75 88 46 53 37 90 63 [91] 78 25 45 46 41 144 82 91 71 63 53 62 63 32 39 62 117 34 [109] 92 93 54 144 14 61 109 38 73 75 50 61 55 77 75 72 50 32 [127] 53 42 71 10 35 65 25 66 41 86 16 42 19 19 45 65 35 95 [145] 49 37 64 38 34 32 65 52 62 65 83 95 29 18 33 247 139 29 > 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]) 10 14 16 17 18 19 24 25 29 30 31 32 33 34 35 37 38 39 40 41 1 1 1 2 2 2 1 3 2 1 1 4 3 4 2 2 2 1 3 4 42 43 44 45 46 49 50 52 53 54 55 56 57 58 60 61 62 63 64 65 3 1 2 4 4 1 2 3 5 2 2 3 1 2 2 4 6 5 2 4 66 67 68 70 71 72 73 75 76 77 78 82 83 84 86 88 89 90 91 92 5 1 1 1 3 1 2 5 1 2 1 2 1 1 1 2 2 1 1 3 93 94 95 99 100 103 105 107 109 112 117 119 121 132 139 144 146 154 168 247 1 1 2 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 259 1 > colnames(x) [1] "Connected" "Separate" "age" "beloning" "totblogs" "Login" > colnames(x)[par1] [1] "Login" > x[,par1] [1] 56 56 54 89 40 25 92 18 63 44 33 84 88 55 60 66 154 53 [19] 119 41 61 58 75 33 40 92 100 112 73 40 45 60 62 75 31 77 [37] 34 46 99 17 66 30 76 146 67 56 107 58 34 61 119 42 66 89 [55] 44 66 24 259 17 64 41 68 168 43 132 105 71 112 94 82 70 57 [73] 53 103 121 62 52 52 32 62 45 46 63 75 88 46 53 37 90 63 [91] 78 25 45 46 41 144 82 91 71 63 53 62 63 32 39 62 117 34 [109] 92 93 54 144 14 61 109 38 73 75 50 61 55 77 75 72 50 32 [127] 53 42 71 10 35 65 25 66 41 86 16 42 19 19 45 65 35 95 [145] 49 37 64 38 34 32 65 52 62 65 83 95 29 18 33 247 139 29 > 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/1x2i81354798080.tab") + } + } > m Conditional inference tree with 3 terminal nodes Response: Login Inputs: Connected, Separate, age, beloning, totblogs Number of observations: 162 1) totblogs <= 60; criterion = 1, statistic = 33.901 2) totblogs <= 25; criterion = 0.986, statistic = 8.869 3)* weights = 16 2) totblogs > 25 4)* weights = 37 1) totblogs > 60 5)* weights = 109 > postscript(file="/var/wessaorg/rcomp/tmp/20tv21354798080.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/37x7w1354798080.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 56 75.7156 -19.7155963 2 56 75.7156 -19.7155963 3 54 75.7156 -21.7155963 4 89 75.7156 13.2844037 5 40 50.7027 -10.7027027 6 25 50.7027 -25.7027027 7 92 75.7156 16.2844037 8 18 27.6250 -9.6250000 9 63 50.7027 12.2972973 10 44 75.7156 -31.7155963 11 33 75.7156 -42.7155963 12 84 75.7156 8.2844037 13 88 75.7156 12.2844037 14 55 50.7027 4.2972973 15 60 75.7156 -15.7155963 16 66 75.7156 -9.7155963 17 154 75.7156 78.2844037 18 53 75.7156 -22.7155963 19 119 75.7156 43.2844037 20 41 75.7156 -34.7155963 21 61 75.7156 -14.7155963 22 58 75.7156 -17.7155963 23 75 75.7156 -0.7155963 24 33 75.7156 -42.7155963 25 40 75.7156 -35.7155963 26 92 75.7156 16.2844037 27 100 75.7156 24.2844037 28 112 75.7156 36.2844037 29 73 75.7156 -2.7155963 30 40 50.7027 -10.7027027 31 45 75.7156 -30.7155963 32 60 75.7156 -15.7155963 33 62 75.7156 -13.7155963 34 75 75.7156 -0.7155963 35 31 50.7027 -19.7027027 36 77 75.7156 1.2844037 37 34 50.7027 -16.7027027 38 46 75.7156 -29.7155963 39 99 75.7156 23.2844037 40 17 27.6250 -10.6250000 41 66 75.7156 -9.7155963 42 30 50.7027 -20.7027027 43 76 50.7027 25.2972973 44 146 75.7156 70.2844037 45 67 75.7156 -8.7155963 46 56 75.7156 -19.7155963 47 107 75.7156 31.2844037 48 58 75.7156 -17.7155963 49 34 50.7027 -16.7027027 50 61 50.7027 10.2972973 51 119 75.7156 43.2844037 52 42 27.6250 14.3750000 53 66 75.7156 -9.7155963 54 89 75.7156 13.2844037 55 44 75.7156 -31.7155963 56 66 75.7156 -9.7155963 57 24 27.6250 -3.6250000 58 259 75.7156 183.2844037 59 17 27.6250 -10.6250000 60 64 50.7027 13.2972973 61 41 75.7156 -34.7155963 62 68 75.7156 -7.7155963 63 168 75.7156 92.2844037 64 43 50.7027 -7.7027027 65 132 75.7156 56.2844037 66 105 75.7156 29.2844037 67 71 75.7156 -4.7155963 68 112 75.7156 36.2844037 69 94 75.7156 18.2844037 70 82 75.7156 6.2844037 71 70 75.7156 -5.7155963 72 57 75.7156 -18.7155963 73 53 75.7156 -22.7155963 74 103 75.7156 27.2844037 75 121 75.7156 45.2844037 76 62 75.7156 -13.7155963 77 52 75.7156 -23.7155963 78 52 75.7156 -23.7155963 79 32 27.6250 4.3750000 80 62 75.7156 -13.7155963 81 45 75.7156 -30.7155963 82 46 75.7156 -29.7155963 83 63 75.7156 -12.7155963 84 75 75.7156 -0.7155963 85 88 50.7027 37.2972973 86 46 75.7156 -29.7155963 87 53 75.7156 -22.7155963 88 37 50.7027 -13.7027027 89 90 75.7156 14.2844037 90 63 50.7027 12.2972973 91 78 75.7156 2.2844037 92 25 50.7027 -25.7027027 93 45 50.7027 -5.7027027 94 46 75.7156 -29.7155963 95 41 50.7027 -9.7027027 96 144 75.7156 68.2844037 97 82 50.7027 31.2972973 98 91 75.7156 15.2844037 99 71 75.7156 -4.7155963 100 63 75.7156 -12.7155963 101 53 75.7156 -22.7155963 102 62 75.7156 -13.7155963 103 63 75.7156 -12.7155963 104 32 75.7156 -43.7155963 105 39 75.7156 -36.7155963 106 62 75.7156 -13.7155963 107 117 75.7156 41.2844037 108 34 50.7027 -16.7027027 109 92 75.7156 16.2844037 110 93 75.7156 17.2844037 111 54 75.7156 -21.7155963 112 144 50.7027 93.2972973 113 14 50.7027 -36.7027027 114 61 75.7156 -14.7155963 115 109 75.7156 33.2844037 116 38 75.7156 -37.7155963 117 73 75.7156 -2.7155963 118 75 50.7027 24.2972973 119 50 50.7027 -0.7027027 120 61 50.7027 10.2972973 121 55 75.7156 -20.7155963 122 77 50.7027 26.2972973 123 75 75.7156 -0.7155963 124 72 50.7027 21.2972973 125 50 75.7156 -25.7155963 126 32 27.6250 4.3750000 127 53 50.7027 2.2972973 128 42 75.7156 -33.7155963 129 71 75.7156 -4.7155963 130 10 27.6250 -17.6250000 131 35 27.6250 7.3750000 132 65 75.7156 -10.7155963 133 25 50.7027 -25.7027027 134 66 50.7027 15.2972973 135 41 75.7156 -34.7155963 136 86 75.7156 10.2844037 137 16 27.6250 -11.6250000 138 42 75.7156 -33.7155963 139 19 27.6250 -8.6250000 140 19 50.7027 -31.7027027 141 45 27.6250 17.3750000 142 65 75.7156 -10.7155963 143 35 27.6250 7.3750000 144 95 75.7156 19.2844037 145 49 75.7156 -26.7155963 146 37 27.6250 9.3750000 147 64 50.7027 13.2972973 148 38 75.7156 -37.7155963 149 34 27.6250 6.3750000 150 32 50.7027 -18.7027027 151 65 75.7156 -10.7155963 152 52 75.7156 -23.7155963 153 62 50.7027 11.2972973 154 65 75.7156 -10.7155963 155 83 75.7156 7.2844037 156 95 75.7156 19.2844037 157 29 75.7156 -46.7155963 158 18 50.7027 -32.7027027 159 33 50.7027 -17.7027027 160 247 75.7156 171.2844037 161 139 75.7156 63.2844037 162 29 27.6250 1.3750000 > 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/4t0781354798080.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/5uqhr1354798081.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/66dnb1354798081.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/7r27r1354798081.tab") + } > > try(system("convert tmp/20tv21354798080.ps tmp/20tv21354798080.png",intern=TRUE)) character(0) > try(system("convert tmp/37x7w1354798080.ps tmp/37x7w1354798080.png",intern=TRUE)) character(0) > try(system("convert tmp/4t0781354798080.ps tmp/4t0781354798080.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.445 0.435 5.860