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(1565 + ,129404 + ,20 + ,18 + ,63 + ,18158 + ,1134 + ,130358 + ,38 + ,17 + ,50 + ,30461 + ,192 + ,7215 + ,0 + ,0 + ,0 + ,1423 + ,2033 + ,112861 + ,49 + ,22 + ,51 + ,25629 + ,3283 + ,219904 + ,76 + ,30 + ,112 + ,48758 + ,5877 + ,402036 + ,104 + ,31 + ,118 + ,129230 + ,1322 + ,117604 + ,37 + ,19 + ,59 + ,27376 + ,1225 + ,131822 + ,57 + ,25 + ,90 + ,26706 + ,1463 + ,99729 + ,42 + ,30 + ,50 + ,26505 + ,2568 + ,256310 + ,62 + ,26 + ,79 + ,49801 + ,1810 + ,113066 + ,50 + ,20 + ,49 + ,46580 + ,1915 + ,165392 + ,66 + ,30 + ,91 + ,48352 + ,1452 + ,78240 + ,38 + ,15 + ,32 + ,13899 + ,2415 + ,152673 + ,48 + ,22 + ,82 + ,39342 + ,1254 + ,134368 + ,42 + ,17 + ,58 + ,27465 + ,1374 + ,125769 + ,47 + ,19 + ,65 + ,55211 + ,1504 + ,123467 + ,71 + ,28 + ,111 + ,74098 + ,999 + ,56232 + ,0 + ,12 + ,36 + ,13497 + ,2222 + ,108458 + ,50 + ,28 + ,89 + ,38338 + ,634 + ,22762 + ,12 + ,13 + ,28 + ,52505 + ,849 + ,48633 + ,16 + ,14 + ,35 + ,10663 + ,2189 + ,182081 + ,77 + ,27 + ,78 + ,74484 + ,1469 + ,140857 + ,29 + ,25 + ,67 + ,28895 + ,1791 + ,93773 + ,38 + ,30 + ,61 + ,32827 + ,1743 + ,133398 + ,50 + ,21 + ,58 + ,36188 + ,1180 + ,113933 + ,33 + ,17 + ,49 + ,28173 + ,1749 + ,153851 + ,49 + ,22 + ,77 + ,54926 + ,1101 + ,140711 + ,59 + ,28 + ,71 + ,38900 + ,2391 + ,303844 + ,55 + ,26 + ,85 + ,88530 + ,1826 + ,163810 + ,42 + ,17 + ,56 + ,35482 + ,1301 + ,123344 + ,40 + ,23 + ,71 + ,26730 + ,1433 + ,157640 + ,51 + ,20 + ,58 + ,29806 + ,1893 + ,103274 + ,45 + ,16 + ,34 + ,41799 + ,2525 + ,193500 + ,73 + ,20 + ,59 + ,54289 + ,2033 + ,178768 + ,51 + ,21 + ,77 + ,36805 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1817 + ,181412 + ,46 + ,27 + ,75 + ,33146 + ,1506 + ,92342 + ,44 + ,14 + ,39 + ,23333 + ,1820 + ,100023 + ,31 + ,29 + ,83 + ,47686 + ,1649 + ,178277 + ,71 + ,31 + ,123 + ,77783 + ,1672 + ,145067 + ,61 + ,19 + ,67 + ,36042 + ,1433 + ,114146 + ,28 + ,30 + ,105 + ,34541 + ,864 + ,86039 + ,21 + ,23 + ,76 + ,75620 + ,1683 + ,125481 + ,42 + ,21 + ,57 + ,60610 + ,1024 + ,95535 + ,44 + ,22 + ,82 + ,55041 + ,1029 + ,129221 + ,40 + ,21 + ,64 + ,32087 + ,629 + ,61554 + ,15 + ,32 + ,57 + ,16356 + ,1679 + ,168048 + ,46 + ,20 + ,80 + ,40161 + ,1715 + ,159121 + ,43 + ,26 + ,94 + ,55459 + ,2093 + ,129362 + ,47 + ,25 + ,72 + ,36679 + ,658 + ,48188 + ,12 + ,22 + ,39 + ,22346 + ,1234 + ,95461 + ,46 + ,19 + ,60 + ,27377 + ,2059 + ,229864 + ,56 + ,24 + ,84 + ,50273 + ,1725 + ,191094 + ,47 + ,26 + ,69 + ,32104 + ,1504 + ,161082 + ,50 + ,27 + ,102 + ,27016 + ,1454 + ,111388 + ,35 + ,10 + ,28 + ,19715 + ,1620 + ,172614 + ,45 + ,26 + ,65 + ,33629 + ,733 + ,63205 + ,25 + ,23 + ,67 + ,27084 + ,894 + ,109102 + ,47 + ,21 + ,80 + ,32352 + ,2343 + ,137303 + ,28 + ,34 + ,79 + ,51845 + ,1503 + ,125304 + ,48 + ,29 + ,107 + ,26591 + ,1627 + ,88620 + ,32 + ,19 + ,60 + ,29677 + ,1119 + ,95808 + ,28 + ,19 + ,53 + ,54237 + ,897 + ,83419 + ,31 + ,23 + ,59 + ,20284 + ,855 + ,101723 + ,13 + ,22 + ,80 + ,22741 + ,1229 + ,94982 + ,38 + ,29 + ,89 + ,34178 + ,1991 + ,143566 + ,48 + ,31 + ,115 + ,69551 + ,2393 + ,113325 + ,68 + ,21 + ,59 + ,29653 + ,820 + ,81518 + ,32 + ,21 + ,66 + ,38071 + ,340 + ,31970 + ,5 + ,21 + ,42 + ,4157 + ,2443 + ,192268 + ,53 + ,15 + ,35 + ,28321 + ,1030 + ,91261 + ,33 + ,9 + ,3 + ,40195 + ,1091 + ,80820 + ,54 + ,23 + ,72 + ,48158 + ,1414 + ,85829 + ,37 + ,18 + ,38 + ,13310 + ,2192 + ,116322 + ,52 + ,31 + ,107 + ,78474 + ,1082 + ,56544 + ,0 + ,25 + ,73 + ,6386 + ,1764 + ,116173 + ,52 + ,24 + ,80 + ,31588 + ,2072 + ,118781 + ,51 + ,22 + ,69 + ,61254 + ,816 + ,60138 + ,16 + ,21 + ,46 + ,21152 + ,1121 + ,73422 + ,33 + ,26 + ,52 + ,41272 + ,810 + ,67751 + ,48 + ,22 + ,58 + ,34165 + ,1699 + ,214002 + ,33 + ,26 + ,85 + ,37054 + ,751 + ,51185 + ,24 + ,20 + ,13 + ,12368 + ,1309 + ,97181 + ,37 + ,25 + ,61 + ,23168 + ,732 + ,45100 + ,17 + ,19 + ,49 + ,16380 + ,1327 + ,115801 + ,32 + ,22 + ,47 + ,41242 + ,2246 + ,186310 + ,55 + ,25 + ,93 + ,48450 + ,968 + ,71960 + ,39 + ,22 + ,65 + ,20790 + ,1015 + ,80105 + ,31 + ,21 + ,64 + ,34585 + ,1100 + ,103613 + ,26 + ,20 + ,64 + ,35672 + ,1300 + ,98707 + ,37 + ,23 + ,57 + ,52168 + ,1982 + ,136234 + ,66 + ,22 + ,61 + ,53933 + ,1091 + ,136781 + ,35 + ,21 + ,71 + ,34474 + ,1107 + ,105863 + ,24 + ,12 + ,43 + ,43753 + ,666 + ,42228 + ,22 + ,9 + ,18 + ,36456 + ,1903 + ,179997 + ,37 + ,32 + ,103 + ,51183 + ,1608 + ,169406 + ,86 + ,24 + ,76 + ,52742 + ,223 + ,19349 + ,13 + ,1 + ,0 + ,3895 + ,1807 + ,160819 + ,21 + ,24 + ,83 + ,37076 + ,1466 + ,109510 + ,32 + ,25 + ,73 + ,24079 + ,552 + ,43803 + ,8 + ,4 + ,4 + ,2325 + ,708 + ,47062 + ,38 + ,15 + ,41 + ,29354 + ,1079 + ,110845 + ,45 + ,21 + ,57 + ,30341 + ,957 + ,92517 + ,24 + ,23 + ,52 + ,18992 + ,585 + ,58660 + ,23 + ,12 + ,24 + ,15292 + ,596 + ,27676 + ,2 + ,16 + ,17 + ,5842 + ,980 + ,98550 + ,52 + ,24 + ,89 + ,28918 + ,585 + ,43646 + ,5 + ,9 + ,20 + ,3738 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,975 + ,75566 + ,43 + ,25 + ,51 + ,95352 + ,750 + ,57359 + ,18 + ,17 + ,63 + ,37478 + ,1071 + ,104330 + ,44 + ,18 + ,48 + ,26839 + ,931 + ,70369 + ,45 + ,21 + ,70 + ,26783 + ,783 + ,65494 + ,29 + ,17 + ,32 + ,33392 + ,78 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,874 + ,143931 + ,32 + ,20 + ,72 + ,25446 + ,1327 + ,117946 + ,65 + ,26 + ,56 + ,59847 + ,1831 + ,137332 + ,26 + ,27 + ,66 + ,28162 + ,750 + ,84336 + ,24 + ,20 + ,77 + ,33298 + ,778 + ,43410 + ,7 + ,1 + ,3 + ,2781 + ,1373 + ,136250 + ,62 + ,24 + ,73 + ,37121 + ,807 + ,79015 + ,30 + ,14 + ,37 + ,22698 + ,1562 + ,101354 + ,49 + ,27 + ,57 + ,27615 + ,685 + ,57586 + ,3 + ,12 + ,32 + ,32689 + ,285 + ,19764 + ,10 + ,2 + ,4 + ,5752 + ,1336 + ,105757 + ,42 + ,16 + ,55 + ,23164 + ,954 + ,103651 + ,23 + ,23 + ,84 + ,20304 + ,1283 + ,113402 + ,40 + ,28 + ,90 + ,34409 + ,256 + ,11796 + ,1 + ,2 + ,1 + ,0 + ,81 + ,7627 + ,0 + ,0 + ,0 + ,0 + ,1214 + ,121085 + ,29 + ,17 + ,38 + ,92538 + ,41 + ,6836 + ,0 + ,1 + ,0 + ,0 + ,1634 + ,139563 + ,46 + ,17 + ,36 + ,46037 + ,42 + ,5118 + ,5 + ,0 + ,0 + ,0 + ,528 + ,40248 + ,8 + ,4 + ,7 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,890 + ,95079 + ,21 + ,25 + ,75 + ,23924 + ,1203 + ,80763 + ,21 + ,26 + ,52 + ,52230 + ,81 + ,7131 + ,0 + ,0 + ,0 + ,0 + ,61 + ,4194 + ,0 + ,0 + ,0 + ,0 + ,849 + ,60378 + ,15 + ,15 + ,45 + ,8019 + ,1035 + ,109173 + ,47 + ,20 + ,66 + ,34542 + ,964 + ,83484 + ,17 + ,19 + ,48 + ,21157) + ,dim=c(6 + ,144) + ,dimnames=list(c('pageviews' + ,'time' + ,'blogs' + ,'peerreviews' + ,'peerreviews+' + ,'compcharachters') + ,1:144)) > y <- array(NA,dim=c(6,144),dimnames=list(c('pageviews','time','blogs','peerreviews','peerreviews+','compcharachters'),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] "pageviews" > x[,par1] [1] 1565 1134 192 2033 3283 5877 1322 1225 1463 2568 1810 1915 1452 2415 1254 [16] 1374 1504 999 2222 634 849 2189 1469 1791 1743 1180 1749 1101 2391 1826 [31] 1301 1433 1893 2525 2033 1 1817 1506 1820 1649 1672 1433 864 1683 1024 [46] 1029 629 1679 1715 2093 658 1234 2059 1725 1504 1454 1620 733 894 2343 [61] 1503 1627 1119 897 855 1229 1991 2393 820 340 2443 1030 1091 1414 2192 [76] 1082 1764 2072 816 1121 810 1699 751 1309 732 1327 2246 968 1015 1100 [91] 1300 1982 1091 1107 666 1903 1608 223 1807 1466 552 708 1079 957 585 [106] 596 980 585 0 975 750 1071 931 783 78 0 874 1327 1831 750 [121] 778 1373 807 1562 685 285 1336 954 1283 256 81 1214 41 1634 42 [136] 528 0 890 1203 81 61 849 1035 964 > 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 41 42 61 78 81 192 223 256 285 340 528 552 585 596 3 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 629 634 658 666 685 708 732 733 750 751 778 783 807 810 816 820 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 849 855 864 874 890 894 897 931 954 957 964 968 975 980 999 1015 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1024 1029 1030 1035 1071 1079 1082 1091 1100 1101 1107 1119 1121 1134 1180 1203 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1214 1225 1229 1234 1254 1283 1300 1301 1309 1322 1327 1336 1373 1374 1414 1433 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1452 1454 1463 1466 1469 1503 1504 1506 1562 1565 1608 1620 1627 1634 1649 1672 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1679 1683 1699 1715 1725 1743 1749 1764 1791 1807 1810 1817 1820 1826 1831 1893 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1903 1915 1982 1991 2033 2059 2072 2093 2189 2192 2222 2246 2343 2391 2393 2415 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2443 2525 2568 3283 5877 1 1 1 1 1 > colnames(x) [1] "pageviews" "time" "blogs" "peerreviews" [5] "peerreviews." "compcharachters" > colnames(x)[par1] [1] "pageviews" > x[,par1] [1] 1565 1134 192 2033 3283 5877 1322 1225 1463 2568 1810 1915 1452 2415 1254 [16] 1374 1504 999 2222 634 849 2189 1469 1791 1743 1180 1749 1101 2391 1826 [31] 1301 1433 1893 2525 2033 1 1817 1506 1820 1649 1672 1433 864 1683 1024 [46] 1029 629 1679 1715 2093 658 1234 2059 1725 1504 1454 1620 733 894 2343 [61] 1503 1627 1119 897 855 1229 1991 2393 820 340 2443 1030 1091 1414 2192 [76] 1082 1764 2072 816 1121 810 1699 751 1309 732 1327 2246 968 1015 1100 [91] 1300 1982 1091 1107 666 1903 1608 223 1807 1466 552 708 1079 957 585 [106] 596 980 585 0 975 750 1071 931 783 78 0 874 1327 1831 750 [121] 778 1373 807 1562 685 285 1336 954 1283 256 81 1214 41 1634 42 [136] 528 0 890 1203 81 61 849 1035 964 > 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/11nx81323946492.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: pageviews Inputs: time, blogs, peerreviews, peerreviews., compcharachters Number of observations: 144 1) time <= 84336; criterion = 1, statistic = 111.53 2) time <= 19764; criterion = 1, statistic = 42.268 3)* weights = 14 2) time > 19764 4) time <= 67751; criterion = 1, statistic = 16.835 5) time <= 43803; criterion = 0.95, statistic = 6.607 6)* weights = 8 5) time > 43803 7)* weights = 16 4) time > 67751 8)* weights = 13 1) time > 84336 9) time <= 191094; criterion = 1, statistic = 53.363 10) time <= 111388; criterion = 1, statistic = 18.63 11)* weights = 31 10) time > 111388 12)* weights = 54 9) time > 191094 13)* weights = 8 > postscript(file="/var/wessaorg/rcomp/tmp/2m7uo1323946492.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/3j7lx1323946492.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 1565 1647.25926 -82.259259 2 1134 1647.25926 -513.259259 3 192 95.78571 96.214286 4 2033 1647.25926 385.740741 5 3283 2855.62500 427.375000 6 5877 2855.62500 3021.375000 7 1322 1647.25926 -325.259259 8 1225 1647.25926 -422.259259 9 1463 1276.93548 186.064516 10 2568 2855.62500 -287.625000 11 1810 1647.25926 162.740741 12 1915 1647.25926 267.740741 13 1452 999.53846 452.461538 14 2415 1647.25926 767.740741 15 1254 1647.25926 -393.259259 16 1374 1647.25926 -273.259259 17 1504 1647.25926 -143.259259 18 999 776.18750 222.812500 19 2222 1276.93548 945.064516 20 634 584.87500 49.125000 21 849 776.18750 72.812500 22 2189 1647.25926 541.740741 23 1469 1647.25926 -178.259259 24 1791 1276.93548 514.064516 25 1743 1647.25926 95.740741 26 1180 1647.25926 -467.259259 27 1749 1647.25926 101.740741 28 1101 1647.25926 -546.259259 29 2391 2855.62500 -464.625000 30 1826 1647.25926 178.740741 31 1301 1647.25926 -346.259259 32 1433 1647.25926 -214.259259 33 1893 1276.93548 616.064516 34 2525 2855.62500 -330.625000 35 2033 1647.25926 385.740741 36 1 95.78571 -94.785714 37 1817 1647.25926 169.740741 38 1506 1276.93548 229.064516 39 1820 1276.93548 543.064516 40 1649 1647.25926 1.740741 41 1672 1647.25926 24.740741 42 1433 1647.25926 -214.259259 43 864 1276.93548 -412.935484 44 1683 1647.25926 35.740741 45 1024 1276.93548 -252.935484 46 1029 1647.25926 -618.259259 47 629 776.18750 -147.187500 48 1679 1647.25926 31.740741 49 1715 1647.25926 67.740741 50 2093 1647.25926 445.740741 51 658 776.18750 -118.187500 52 1234 1276.93548 -42.935484 53 2059 2855.62500 -796.625000 54 1725 1647.25926 77.740741 55 1504 1647.25926 -143.259259 56 1454 1276.93548 177.064516 57 1620 1647.25926 -27.259259 58 733 776.18750 -43.187500 59 894 1276.93548 -382.935484 60 2343 1647.25926 695.740741 61 1503 1647.25926 -144.259259 62 1627 1276.93548 350.064516 63 1119 1276.93548 -157.935484 64 897 999.53846 -102.538462 65 855 1276.93548 -421.935484 66 1229 1276.93548 -47.935484 67 1991 1647.25926 343.740741 68 2393 1647.25926 745.740741 69 820 999.53846 -179.538462 70 340 584.87500 -244.875000 71 2443 2855.62500 -412.625000 72 1030 1276.93548 -246.935484 73 1091 999.53846 91.461538 74 1414 1276.93548 137.064516 75 2192 1647.25926 544.740741 76 1082 776.18750 305.812500 77 1764 1647.25926 116.740741 78 2072 1647.25926 424.740741 79 816 776.18750 39.812500 80 1121 999.53846 121.461538 81 810 776.18750 33.812500 82 1699 2855.62500 -1156.625000 83 751 776.18750 -25.187500 84 1309 1276.93548 32.064516 85 732 776.18750 -44.187500 86 1327 1647.25926 -320.259259 87 2246 1647.25926 598.740741 88 968 999.53846 -31.538462 89 1015 999.53846 15.461538 90 1100 1276.93548 -176.935484 91 1300 1276.93548 23.064516 92 1982 1647.25926 334.740741 93 1091 1647.25926 -556.259259 94 1107 1276.93548 -169.935484 95 666 584.87500 81.125000 96 1903 1647.25926 255.740741 97 1608 1647.25926 -39.259259 98 223 95.78571 127.214286 99 1807 1647.25926 159.740741 100 1466 1276.93548 189.064516 101 552 584.87500 -32.875000 102 708 776.18750 -68.187500 103 1079 1276.93548 -197.935484 104 957 1276.93548 -319.935484 105 585 776.18750 -191.187500 106 596 584.87500 11.125000 107 980 1276.93548 -296.935484 108 585 584.87500 0.125000 109 0 95.78571 -95.785714 110 975 999.53846 -24.538462 111 750 776.18750 -26.187500 112 1071 1276.93548 -205.935484 113 931 999.53846 -68.538462 114 783 776.18750 6.812500 115 78 95.78571 -17.785714 116 0 95.78571 -95.785714 117 874 1647.25926 -773.259259 118 1327 1647.25926 -320.259259 119 1831 1647.25926 183.740741 120 750 999.53846 -249.538462 121 778 584.87500 193.125000 122 1373 1647.25926 -274.259259 123 807 999.53846 -192.538462 124 1562 1276.93548 285.064516 125 685 776.18750 -91.187500 126 285 95.78571 189.214286 127 1336 1276.93548 59.064516 128 954 1276.93548 -322.935484 129 1283 1647.25926 -364.259259 130 256 95.78571 160.214286 131 81 95.78571 -14.785714 132 1214 1647.25926 -433.259259 133 41 95.78571 -54.785714 134 1634 1647.25926 -13.259259 135 42 95.78571 -53.785714 136 528 584.87500 -56.875000 137 0 95.78571 -95.785714 138 890 1276.93548 -386.935484 139 1203 999.53846 203.461538 140 81 95.78571 -14.785714 141 61 95.78571 -34.785714 142 849 776.18750 72.812500 143 1035 1276.93548 -241.935484 144 964 999.53846 -35.538462 > 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/43vhe1323946492.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/561as1323946492.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/6gv841323946492.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/7v3741323946492.tab") + } > > try(system("convert tmp/2m7uo1323946492.ps tmp/2m7uo1323946492.png",intern=TRUE)) character(0) > try(system("convert tmp/3j7lx1323946492.ps tmp/3j7lx1323946492.png",intern=TRUE)) character(0) > try(system("convert tmp/43vhe1323946492.ps tmp/43vhe1323946492.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.234 0.274 3.542