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(127476 + ,20 + ,17 + ,59 + ,22622 + ,130358 + ,38 + ,17 + ,50 + ,73570 + ,7215 + ,0 + ,0 + ,0 + ,1929 + ,112861 + ,49 + ,22 + ,51 + ,36294 + ,210171 + ,74 + ,30 + ,112 + ,62378 + ,393802 + ,104 + ,31 + ,118 + ,167760 + ,117604 + ,37 + ,19 + ,59 + ,52443 + ,126029 + ,53 + ,25 + ,90 + ,57283 + ,99729 + ,42 + ,30 + ,50 + ,36614 + ,256310 + ,62 + ,26 + ,79 + ,93268 + ,113066 + ,50 + ,20 + ,49 + ,35439 + ,156212 + ,65 + ,25 + ,74 + ,72405 + ,69952 + ,28 + ,15 + ,32 + ,24044 + ,152673 + ,48 + ,22 + ,82 + ,55909 + ,125841 + ,42 + ,12 + ,43 + ,44689 + ,125769 + ,47 + ,19 + ,65 + ,49319 + ,123467 + ,71 + ,28 + ,111 + ,62075 + ,56232 + ,0 + ,12 + ,36 + ,2341 + ,108244 + ,50 + ,28 + ,89 + ,40551 + ,22762 + ,12 + ,13 + ,28 + ,11621 + ,48554 + ,16 + ,14 + ,35 + ,18741 + ,178697 + ,76 + ,27 + ,78 + ,84202 + ,139115 + ,29 + ,25 + ,67 + ,15334 + ,93773 + ,38 + ,30 + ,61 + ,28024 + ,133398 + ,50 + ,21 + ,58 + ,53306 + ,113933 + ,33 + ,17 + ,49 + ,37918 + ,144781 + ,45 + ,22 + ,77 + ,54819 + ,140711 + ,59 + ,28 + ,71 + ,89058 + ,283337 + ,49 + ,25 + ,82 + ,103354 + ,158146 + ,40 + ,16 + ,53 + ,70239 + ,123344 + ,40 + ,23 + ,71 + ,33045 + ,157640 + ,51 + ,20 + ,58 + ,63852 + ,91279 + ,41 + ,11 + ,25 + ,30905 + ,189374 + ,73 + ,20 + ,59 + ,24242 + ,167915 + ,43 + ,21 + ,77 + ,78907 + ,0 + ,0 + ,0 + ,0 + ,0 + ,175403 + ,46 + ,27 + ,75 + ,36005 + ,92342 + ,44 + ,14 + ,39 + ,31972 + ,100023 + ,31 + ,29 + ,83 + ,35853 + ,178277 + ,71 + ,31 + ,123 + ,115301 + ,145062 + ,61 + ,19 + ,67 + ,47689 + ,110980 + ,28 + ,30 + ,105 + ,34223 + ,86039 + ,21 + ,23 + ,76 + ,43431 + ,119514 + ,42 + ,20 + ,54 + ,52220 + ,95535 + ,44 + ,22 + ,82 + ,33863 + ,109894 + ,34 + ,19 + ,57 + ,46879 + ,61554 + ,15 + ,32 + ,57 + ,23228 + ,156520 + ,46 + ,18 + ,72 + ,42827 + ,159121 + ,43 + ,26 + ,94 + ,65765 + ,129362 + ,47 + ,25 + ,72 + ,38167 + ,48188 + ,12 + ,22 + ,39 + ,14812 + ,91198 + ,42 + ,19 + ,60 + ,32615 + ,229864 + ,56 + ,24 + ,84 + ,82188 + ,180317 + ,41 + ,26 + ,69 + ,51763 + ,150640 + ,48 + ,27 + ,102 + ,59325 + ,104416 + ,30 + ,10 + ,28 + ,48976 + ,159645 + ,44 + ,26 + ,65 + ,43384 + ,63205 + ,25 + ,23 + ,67 + ,26692 + ,100056 + ,42 + ,21 + ,80 + ,53279 + ,137214 + ,28 + ,34 + ,79 + ,20652 + ,99630 + ,33 + ,29 + ,107 + ,38338 + ,84557 + ,32 + ,18 + ,57 + ,36735 + ,91199 + ,28 + ,16 + ,44 + ,42764 + ,83419 + ,31 + ,23 + ,59 + ,44331 + ,101723 + ,13 + ,22 + ,80 + ,41354 + ,94982 + ,38 + ,29 + ,89 + ,47879 + ,129700 + ,39 + ,31 + ,115 + ,103793 + ,110708 + ,68 + ,21 + ,59 + ,52235 + ,81518 + ,32 + ,21 + ,66 + ,49825 + ,31970 + ,5 + ,21 + ,42 + ,4105 + ,192268 + ,53 + ,15 + ,35 + ,58687 + ,87611 + ,33 + ,9 + ,3 + ,40745 + ,77890 + ,48 + ,21 + ,68 + ,33187 + ,83261 + ,36 + ,18 + ,38 + ,14063 + ,116290 + ,52 + ,31 + ,107 + ,37407 + ,55254 + ,0 + ,24 + ,69 + ,7190 + ,116173 + ,52 + ,24 + ,80 + ,49562 + ,111488 + ,45 + ,22 + ,69 + ,76324 + ,60138 + ,16 + ,21 + ,46 + ,21928 + ,73422 + ,33 + ,26 + ,52 + ,27860 + ,67751 + ,48 + ,22 + ,58 + ,28078 + ,213351 + ,33 + ,26 + ,85 + ,49577 + ,51185 + ,24 + ,20 + ,13 + ,28145 + ,97181 + ,37 + ,25 + ,61 + ,36241 + ,42311 + ,16 + ,19 + ,49 + ,10824 + ,115801 + ,32 + ,22 + ,47 + ,46892 + ,183637 + ,55 + ,25 + ,93 + ,61264 + ,68161 + ,36 + ,22 + ,65 + ,22933 + ,76441 + ,29 + ,21 + ,64 + ,20787 + ,103613 + ,26 + ,20 + ,64 + ,43978 + ,98707 + ,37 + ,23 + ,57 + ,51305 + ,126527 + ,58 + ,22 + ,61 + ,55593 + ,136781 + ,35 + ,21 + ,71 + ,51648 + ,105863 + ,24 + ,12 + ,43 + ,30552 + ,38775 + ,18 + ,9 + ,18 + ,23470 + ,179984 + ,37 + ,32 + ,103 + ,77530 + ,164808 + ,86 + ,24 + ,76 + ,57299 + ,19349 + ,13 + ,1 + ,0 + ,9604 + ,143902 + ,20 + ,24 + ,83 + ,34684 + ,108660 + ,32 + ,22 + ,70 + ,41094 + ,43803 + ,8 + ,4 + ,4 + ,3439 + ,47062 + ,38 + ,15 + ,41 + ,25171 + ,110845 + ,45 + ,21 + ,57 + ,23437 + ,92517 + ,24 + ,23 + ,52 + ,34086 + ,58660 + ,23 + ,12 + ,24 + ,24649 + ,27676 + ,2 + ,16 + ,17 + ,2342 + ,98550 + ,52 + ,24 + ,89 + ,45571 + ,43284 + ,5 + ,9 + ,20 + ,3255 + ,0 + ,0 + ,0 + ,0 + ,0 + ,66016 + ,43 + ,22 + ,45 + ,30002 + ,57359 + ,18 + ,17 + ,63 + ,19360 + ,96933 + ,41 + ,18 + ,48 + ,43320 + ,70369 + ,45 + ,21 + ,70 + ,35513 + ,65494 + ,29 + ,17 + ,32 + ,23536 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,143931 + ,32 + ,20 + ,72 + ,54438 + ,109894 + ,58 + ,26 + ,56 + ,56812 + ,122973 + ,17 + ,26 + ,64 + ,33838 + ,84336 + ,24 + ,20 + ,77 + ,32366 + ,43410 + ,7 + ,1 + ,3 + ,13 + ,136250 + ,62 + ,24 + ,73 + ,55082 + ,79015 + ,30 + ,14 + ,37 + ,31334 + ,92937 + ,49 + ,26 + ,54 + ,16612 + ,57586 + ,3 + ,12 + ,32 + ,5084 + ,19764 + ,10 + ,2 + ,4 + ,9927 + ,105757 + ,42 + ,16 + ,55 + ,47413 + ,96410 + ,18 + ,22 + ,81 + ,27389 + ,113402 + ,40 + ,28 + ,90 + ,30425 + ,11796 + ,1 + ,2 + ,1 + ,0 + ,7627 + ,0 + ,0 + ,0 + ,0 + ,121085 + ,29 + ,17 + ,38 + ,33510 + ,6836 + ,0 + ,1 + ,0 + ,0 + ,139563 + ,46 + ,17 + ,36 + ,40389 + ,5118 + ,5 + ,0 + ,0 + ,0 + ,40248 + ,8 + ,4 + ,7 + ,6012 + ,0 + ,0 + ,0 + ,0 + ,0 + ,95079 + ,21 + ,25 + ,75 + ,22205 + ,80750 + ,21 + ,26 + ,52 + ,17231 + ,7131 + ,0 + ,0 + ,0 + ,0 + ,4194 + ,0 + ,0 + ,0 + ,0 + ,60378 + ,15 + ,15 + ,45 + ,11017 + ,96971 + ,40 + ,18 + ,60 + ,46741 + ,83484 + ,17 + ,19 + ,48 + ,39869) + ,dim=c(5 + ,144) + ,dimnames=list(c('TimeRFC' + ,'Blogs' + ,'ReviewedComp' + ,'Longfeedback' + ,'Comptime') + ,1:144)) > y <- array(NA,dim=c(5,144),dimnames=list(c('TimeRFC','Blogs','ReviewedComp','Longfeedback','Comptime'),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] "TimeRFC" > x[,par1] [1] 127476 130358 7215 112861 210171 393802 117604 126029 99729 256310 [11] 113066 156212 69952 152673 125841 125769 123467 56232 108244 22762 [21] 48554 178697 139115 93773 133398 113933 144781 140711 283337 158146 [31] 123344 157640 91279 189374 167915 0 175403 92342 100023 178277 [41] 145062 110980 86039 119514 95535 109894 61554 156520 159121 129362 [51] 48188 91198 229864 180317 150640 104416 159645 63205 100056 137214 [61] 99630 84557 91199 83419 101723 94982 129700 110708 81518 31970 [71] 192268 87611 77890 83261 116290 55254 116173 111488 60138 73422 [81] 67751 213351 51185 97181 42311 115801 183637 68161 76441 103613 [91] 98707 126527 136781 105863 38775 179984 164808 19349 143902 108660 [101] 43803 47062 110845 92517 58660 27676 98550 43284 0 66016 [111] 57359 96933 70369 65494 3616 0 143931 109894 122973 84336 [121] 43410 136250 79015 92937 57586 19764 105757 96410 113402 11796 [131] 7627 121085 6836 139563 5118 40248 0 95079 80750 7131 [141] 4194 60378 96971 83484 > 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 3616 4194 5118 6836 7131 7215 7627 11796 19349 19764 4 1 1 1 1 1 1 1 1 1 1 22762 27676 31970 38775 40248 42311 43284 43410 43803 47062 48188 1 1 1 1 1 1 1 1 1 1 1 48554 51185 55254 56232 57359 57586 58660 60138 60378 61554 63205 1 1 1 1 1 1 1 1 1 1 1 65494 66016 67751 68161 69952 70369 73422 76441 77890 79015 80750 1 1 1 1 1 1 1 1 1 1 1 81518 83261 83419 83484 84336 84557 86039 87611 91198 91199 91279 1 1 1 1 1 1 1 1 1 1 1 92342 92517 92937 93773 94982 95079 95535 96410 96933 96971 97181 1 1 1 1 1 1 1 1 1 1 1 98550 98707 99630 99729 100023 100056 101723 103613 104416 105757 105863 1 1 1 1 1 1 1 1 1 1 1 108244 108660 109894 110708 110845 110980 111488 112861 113066 113402 113933 1 1 2 1 1 1 1 1 1 1 1 115801 116173 116290 117604 119514 121085 122973 123344 123467 125769 125841 1 1 1 1 1 1 1 1 1 1 1 126029 126527 127476 129362 129700 130358 133398 136250 136781 137214 139115 1 1 1 1 1 1 1 1 1 1 1 139563 140711 143902 143931 144781 145062 150640 152673 156212 156520 157640 1 1 1 1 1 1 1 1 1 1 1 158146 159121 159645 164808 167915 175403 178277 178697 179984 180317 183637 1 1 1 1 1 1 1 1 1 1 1 189374 192268 210171 213351 229864 256310 283337 393802 1 1 1 1 1 1 1 1 > colnames(x) [1] "TimeRFC" "Blogs" "ReviewedComp" "Longfeedback" "Comptime" > colnames(x)[par1] [1] "TimeRFC" > x[,par1] [1] 127476 130358 7215 112861 210171 393802 117604 126029 99729 256310 [11] 113066 156212 69952 152673 125841 125769 123467 56232 108244 22762 [21] 48554 178697 139115 93773 133398 113933 144781 140711 283337 158146 [31] 123344 157640 91279 189374 167915 0 175403 92342 100023 178277 [41] 145062 110980 86039 119514 95535 109894 61554 156520 159121 129362 [51] 48188 91198 229864 180317 150640 104416 159645 63205 100056 137214 [61] 99630 84557 91199 83419 101723 94982 129700 110708 81518 31970 [71] 192268 87611 77890 83261 116290 55254 116173 111488 60138 73422 [81] 67751 213351 51185 97181 42311 115801 183637 68161 76441 103613 [91] 98707 126527 136781 105863 38775 179984 164808 19349 143902 108660 [101] 43803 47062 110845 92517 58660 27676 98550 43284 0 66016 [111] 57359 96933 70369 65494 3616 0 143931 109894 122973 84336 [121] 43410 136250 79015 92937 57586 19764 105757 96410 113402 11796 [131] 7627 121085 6836 139563 5118 40248 0 95079 80750 7131 [141] 4194 60378 96971 83484 > 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/1clu61323875927.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: TimeRFC Inputs: Blogs, ReviewedComp, Longfeedback, Comptime Number of observations: 144 1) Comptime <= 32615; criterion = 1, statistic = 104.497 2) Longfeedback <= 20; criterion = 1, statistic = 37.942 3) Blogs <= 1; criterion = 0.997, statistic = 11.342 4)* weights = 11 3) Blogs > 1 5)* weights = 10 2) Longfeedback > 20 6) Blogs <= 16; criterion = 0.999, statistic = 14.483 7)* weights = 11 6) Blogs > 16 8)* weights = 29 1) Comptime > 32615 9) Comptime <= 57283; criterion = 1, statistic = 47.769 10)* weights = 61 9) Comptime > 57283 11) Comptime <= 78907; criterion = 0.995, statistic = 10.293 12)* weights = 14 11) Comptime > 78907 13)* weights = 8 > postscript(file="/var/wessaorg/rcomp/tmp/2x7xg1323875927.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/3nhtx1323875927.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 127476 90248.000 37228.0000 2 130358 160418.214 -30060.2143 3 7215 4401.364 2813.6364 4 112861 116041.607 -3180.6066 5 210171 160418.214 49752.7857 6 393802 223837.250 169964.7500 7 117604 116041.607 1562.3934 8 126029 116041.607 9987.3934 9 99729 116041.607 -16312.6066 10 256310 223837.250 32472.7500 11 113066 116041.607 -2975.6066 12 156212 160418.214 -4206.2143 13 69952 90248.000 -20296.0000 14 152673 116041.607 36631.3934 15 125841 116041.607 9799.3934 16 125769 116041.607 9727.3934 17 123467 160418.214 -36951.2143 18 56232 49538.818 6693.1818 19 108244 116041.607 -7797.6066 20 22762 49538.818 -26776.8182 21 48554 49538.818 -984.8182 22 178697 223837.250 -45140.2500 23 139115 90248.000 48867.0000 24 93773 90248.000 3525.0000 25 133398 116041.607 17356.3934 26 113933 116041.607 -2108.6066 27 144781 116041.607 28739.3934 28 140711 223837.250 -83126.2500 29 283337 223837.250 59499.7500 30 158146 160418.214 -2272.2143 31 123344 116041.607 7302.3934 32 157640 160418.214 -2778.2143 33 91279 90248.000 1031.0000 34 189374 90248.000 99126.0000 35 167915 160418.214 7496.7857 36 0 4401.364 -4401.3636 37 175403 116041.607 59361.3934 38 92342 90248.000 2094.0000 39 100023 116041.607 -16018.6066 40 178277 223837.250 -45560.2500 41 145062 116041.607 29020.3934 42 110980 116041.607 -5061.6066 43 86039 116041.607 -30002.6066 44 119514 116041.607 3472.3934 45 95535 116041.607 -20506.6066 46 109894 116041.607 -6147.6066 47 61554 49538.818 12015.1818 48 156520 116041.607 40478.3934 49 159121 160418.214 -1297.2143 50 129362 116041.607 13320.3934 51 48188 49538.818 -1350.8182 52 91198 90248.000 950.0000 53 229864 223837.250 6026.7500 54 180317 116041.607 64275.3934 55 150640 160418.214 -9778.2143 56 104416 116041.607 -11625.6066 57 159645 116041.607 43603.3934 58 63205 90248.000 -27043.0000 59 100056 116041.607 -15985.6066 60 137214 90248.000 46966.0000 61 99630 116041.607 -16411.6066 62 84557 116041.607 -31484.6066 63 91199 116041.607 -24842.6066 64 83419 116041.607 -32622.6066 65 101723 116041.607 -14318.6066 66 94982 116041.607 -21059.6066 67 129700 223837.250 -94137.2500 68 110708 116041.607 -5333.6066 69 81518 116041.607 -34523.6066 70 31970 49538.818 -17568.8182 71 192268 160418.214 31849.7857 72 87611 116041.607 -28430.6066 73 77890 116041.607 -38151.6066 74 83261 90248.000 -6987.0000 75 116290 116041.607 248.3934 76 55254 49538.818 5715.1818 77 116173 116041.607 131.3934 78 111488 160418.214 -48930.2143 79 60138 49538.818 10599.1818 80 73422 90248.000 -16826.0000 81 67751 90248.000 -22497.0000 82 213351 116041.607 97309.3934 83 51185 33261.200 17923.8000 84 97181 116041.607 -18860.6066 85 42311 49538.818 -7227.8182 86 115801 116041.607 -240.6066 87 183637 160418.214 23218.7857 88 68161 90248.000 -22087.0000 89 76441 90248.000 -13807.0000 90 103613 116041.607 -12428.6066 91 98707 116041.607 -17334.6066 92 126527 116041.607 10485.3934 93 136781 116041.607 20739.3934 94 105863 90248.000 15615.0000 95 38775 33261.200 5513.8000 96 179984 160418.214 19565.7857 97 164808 160418.214 4389.7857 98 19349 33261.200 -13912.2000 99 143902 116041.607 27860.3934 100 108660 116041.607 -7381.6066 101 43803 33261.200 10541.8000 102 47062 90248.000 -43186.0000 103 110845 90248.000 20597.0000 104 92517 116041.607 -23524.6066 105 58660 90248.000 -31588.0000 106 27676 33261.200 -5585.2000 107 98550 116041.607 -17491.6066 108 43284 33261.200 10022.8000 109 0 4401.364 -4401.3636 110 66016 90248.000 -24232.0000 111 57359 90248.000 -32889.0000 112 96933 116041.607 -19108.6066 113 70369 116041.607 -45672.6066 114 65494 90248.000 -24754.0000 115 3616 4401.364 -785.3636 116 0 4401.364 -4401.3636 117 143931 116041.607 27889.3934 118 109894 116041.607 -6147.6066 119 122973 116041.607 6931.3934 120 84336 90248.000 -5912.0000 121 43410 33261.200 10148.8000 122 136250 116041.607 20208.3934 123 79015 90248.000 -11233.0000 124 92937 90248.000 2689.0000 125 57586 49538.818 8047.1818 126 19764 33261.200 -13497.2000 127 105757 116041.607 -10284.6066 128 96410 90248.000 6162.0000 129 113402 90248.000 23154.0000 130 11796 4401.364 7394.6364 131 7627 4401.364 3225.6364 132 121085 116041.607 5043.3934 133 6836 4401.364 2434.6364 134 139563 116041.607 23521.3934 135 5118 33261.200 -28143.2000 136 40248 33261.200 6986.8000 137 0 4401.364 -4401.3636 138 95079 90248.000 4831.0000 139 80750 90248.000 -9498.0000 140 7131 4401.364 2729.6364 141 4194 4401.364 -207.3636 142 60378 49538.818 10839.1818 143 96971 116041.607 -19070.6066 144 83484 116041.607 -32557.6066 > 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/4bb361323875927.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/53gxa1323875927.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/6oyen1323875927.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/7pt5z1323875927.tab") + } > > try(system("convert tmp/2x7xg1323875927.ps tmp/2x7xg1323875927.png",intern=TRUE)) character(0) > try(system("convert tmp/3nhtx1323875927.ps tmp/3nhtx1323875927.png",intern=TRUE)) character(0) > try(system("convert tmp/4bb361323875927.ps tmp/4bb361323875927.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.209 0.246 3.454