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(101645 + ,63 + ,20 + ,38 + ,17140 + ,28 + ,101011 + ,34 + ,30 + ,39 + ,27570 + ,35 + ,7176 + ,17 + ,0 + ,0 + ,1423 + ,0 + ,96560 + ,76 + ,42 + ,38 + ,22996 + ,47 + ,175824 + ,107 + ,57 + ,77 + ,39992 + ,70 + ,341570 + ,168 + ,94 + ,78 + ,117105 + ,135 + ,103597 + ,43 + ,27 + ,49 + ,23789 + ,26 + ,112611 + ,41 + ,46 + ,73 + ,26706 + ,48 + ,85574 + ,34 + ,37 + ,36 + ,24266 + ,40 + ,220801 + ,75 + ,51 + ,63 + ,44418 + ,66 + ,92661 + ,61 + ,40 + ,41 + ,35232 + ,39 + ,133328 + ,55 + ,56 + ,56 + ,40909 + ,66 + ,61361 + ,77 + ,27 + ,25 + ,13294 + ,27 + ,125930 + ,75 + ,37 + ,65 + ,32387 + ,65 + ,82316 + ,32 + ,27 + ,38 + ,21233 + ,25 + ,102010 + ,53 + ,28 + ,44 + ,44332 + ,26 + ,101523 + ,42 + ,59 + ,87 + ,61056 + ,77 + ,41566 + ,35 + ,0 + ,27 + ,13497 + ,2 + ,99923 + ,66 + ,44 + ,80 + ,32334 + ,36 + ,22648 + ,19 + ,12 + ,28 + ,44339 + ,24 + ,46698 + ,45 + ,14 + ,33 + ,10288 + ,14 + ,131698 + ,65 + ,60 + ,59 + ,65622 + ,78 + ,91735 + ,35 + ,7 + ,49 + ,16563 + ,15 + ,79863 + ,37 + ,29 + ,49 + ,29011 + ,24 + ,108043 + ,62 + ,45 + ,38 + ,34553 + ,40 + ,98866 + ,18 + ,25 + ,39 + ,23517 + ,50 + ,120445 + ,118 + ,36 + ,56 + ,51009 + ,63 + ,116048 + ,64 + ,50 + ,50 + ,33416 + ,63 + ,250047 + ,81 + ,41 + ,61 + ,83305 + ,55 + ,136084 + ,30 + ,27 + ,41 + ,27142 + ,40 + ,92499 + ,32 + ,25 + ,55 + ,21399 + ,21 + ,135781 + ,31 + ,45 + ,44 + ,24874 + ,32 + ,74408 + ,67 + ,29 + ,21 + ,34988 + ,36 + ,81240 + ,66 + ,58 + ,50 + ,45549 + ,13 + ,133368 + ,36 + ,37 + ,57 + ,32755 + ,57 + ,98146 + ,40 + ,15 + ,48 + ,27114 + ,21 + ,79619 + ,43 + ,42 + ,32 + ,20760 + ,43 + ,59194 + ,31 + ,7 + ,68 + ,37636 + ,20 + ,139942 + ,42 + ,54 + ,87 + ,65461 + ,82 + ,118612 + ,46 + ,54 + ,43 + ,30080 + ,90 + ,72880 + ,33 + ,14 + ,67 + ,24094 + ,25 + ,65475 + ,18 + ,16 + ,46 + ,69008 + ,60 + ,99643 + ,55 + ,33 + ,46 + ,54968 + ,61 + ,71965 + ,35 + ,32 + ,56 + ,46090 + ,85 + ,77272 + ,59 + ,21 + ,48 + ,27507 + ,43 + ,49289 + ,19 + ,15 + ,44 + ,10672 + ,25 + ,135131 + ,66 + ,38 + ,60 + ,34029 + ,41 + ,108446 + ,60 + ,22 + ,65 + ,46300 + ,26 + ,89746 + ,36 + ,28 + ,55 + ,24760 + ,38 + ,44296 + ,25 + ,10 + ,38 + ,18779 + ,12 + ,77648 + ,47 + ,31 + ,52 + ,21280 + ,29 + ,181528 + ,54 + ,32 + ,60 + ,40662 + ,49 + ,134019 + ,53 + ,32 + ,54 + ,28987 + ,46 + ,124064 + ,40 + ,43 + ,86 + ,22827 + ,41 + ,92630 + ,40 + ,27 + ,24 + ,18513 + ,31 + ,121848 + ,39 + ,37 + ,52 + ,30594 + ,41 + ,52915 + ,14 + ,20 + ,49 + ,24006 + ,26 + ,81872 + ,45 + ,32 + ,61 + ,27913 + ,23 + ,58981 + ,36 + ,0 + ,61 + ,42744 + ,14 + ,53515 + ,28 + ,5 + ,81 + ,12934 + ,16 + ,60812 + ,44 + ,26 + ,43 + ,22574 + ,25 + ,56375 + ,30 + ,10 + ,40 + ,41385 + ,21 + ,65490 + ,22 + ,27 + ,40 + ,18653 + ,32 + ,80949 + ,17 + ,11 + ,56 + ,18472 + ,9 + ,76302 + ,31 + ,29 + ,68 + ,30976 + ,35 + ,104011 + ,55 + ,25 + ,79 + ,63339 + ,42 + ,98104 + ,54 + ,55 + ,47 + ,25568 + ,68 + ,67989 + ,21 + ,23 + ,57 + ,33747 + ,32 + ,30989 + ,14 + ,5 + ,41 + ,4154 + ,6 + ,135458 + ,81 + ,43 + ,29 + ,19474 + ,68 + ,73504 + ,35 + ,23 + ,3 + ,35130 + ,33 + ,63123 + ,43 + ,34 + ,60 + ,39067 + ,84 + ,61254 + ,46 + ,36 + ,30 + ,13310 + ,46 + ,74914 + ,30 + ,35 + ,79 + ,65892 + ,30 + ,31774 + ,23 + ,0 + ,47 + ,4143 + ,0 + ,81437 + ,38 + ,37 + ,40 + ,28579 + ,36 + ,87186 + ,54 + ,28 + ,48 + ,51776 + ,47 + ,50090 + ,20 + ,16 + ,36 + ,21152 + ,20 + ,65745 + ,53 + ,26 + ,42 + ,38084 + ,50 + ,56653 + ,45 + ,38 + ,49 + ,27717 + ,30 + ,158399 + ,39 + ,23 + ,57 + ,32928 + ,30 + ,46455 + ,20 + ,22 + ,12 + ,11342 + ,34 + ,73624 + ,24 + ,30 + ,40 + ,19499 + ,33 + ,38395 + ,31 + ,16 + ,43 + ,16380 + ,34 + ,91899 + ,35 + ,18 + ,33 + ,36874 + ,37 + ,139526 + ,151 + ,28 + ,77 + ,48259 + ,83 + ,52164 + ,52 + ,32 + ,43 + ,16734 + ,32 + ,51567 + ,30 + ,21 + ,45 + ,28207 + ,30 + ,70551 + ,31 + ,23 + ,47 + ,30143 + ,43 + ,84856 + ,29 + ,29 + ,43 + ,41369 + ,41 + ,102538 + ,57 + ,50 + ,45 + ,45833 + ,51 + ,86678 + ,40 + ,12 + ,50 + ,29156 + ,19 + ,85709 + ,44 + ,21 + ,35 + ,35944 + ,37 + ,34662 + ,25 + ,18 + ,7 + ,36278 + ,33 + ,150580 + ,77 + ,27 + ,71 + ,45588 + ,41 + ,99611 + ,35 + ,41 + ,67 + ,45097 + ,54 + ,19349 + ,11 + ,13 + ,0 + ,3895 + ,14 + ,99373 + ,63 + ,12 + ,62 + ,28394 + ,25 + ,86230 + ,44 + ,21 + ,54 + ,18632 + ,25 + ,30837 + ,19 + ,8 + ,4 + ,2325 + ,8 + ,31706 + ,13 + ,26 + ,25 + ,25139 + ,26 + ,89806 + ,42 + ,27 + ,40 + ,27975 + ,20 + ,62088 + ,38 + ,13 + ,38 + ,14483 + ,11 + ,40151 + ,29 + ,16 + ,19 + ,13127 + ,14 + ,27634 + ,20 + ,2 + ,17 + ,5839 + ,3 + ,76990 + ,27 + ,42 + ,67 + ,24069 + ,40 + ,37460 + ,20 + ,5 + ,14 + ,3738 + ,5 + ,54157 + ,19 + ,37 + ,30 + ,18625 + ,38 + ,49862 + ,37 + ,17 + ,54 + ,36341 + ,32 + ,84337 + ,26 + ,38 + ,35 + ,24548 + ,41 + ,64175 + ,42 + ,37 + ,59 + ,21792 + ,46 + ,59382 + ,49 + ,29 + ,24 + ,26263 + ,47 + ,119308 + ,30 + ,32 + ,58 + ,23686 + ,37 + ,76702 + ,49 + ,35 + ,42 + ,49303 + ,51 + ,103425 + ,67 + ,17 + ,46 + ,25659 + ,49 + ,70344 + ,28 + ,20 + ,61 + ,28904 + ,21 + ,43410 + ,19 + ,7 + ,3 + ,2781 + ,1 + ,104838 + ,49 + ,46 + ,52 + ,29236 + ,44 + ,62215 + ,27 + ,24 + ,25 + ,19546 + ,26 + ,69304 + ,30 + ,40 + ,40 + ,22818 + ,21 + ,53117 + ,22 + ,3 + ,32 + ,32689 + ,4 + ,19764 + ,12 + ,10 + ,4 + ,5752 + ,10 + ,86680 + ,31 + ,37 + ,49 + ,22197 + ,43 + ,84105 + ,20 + ,17 + ,63 + ,20055 + ,34 + ,77945 + ,20 + ,28 + ,67 + ,25272 + ,32 + ,89113 + ,39 + ,19 + ,32 + ,82206 + ,20 + ,91005 + ,29 + ,29 + ,23 + ,32073 + ,34 + ,40248 + ,16 + ,8 + ,7 + ,5444 + ,6 + ,64187 + ,27 + ,10 + ,54 + ,20154 + ,12 + ,50857 + ,21 + ,15 + ,37 + ,36944 + ,24 + ,56613 + ,19 + ,15 + ,35 + ,8019 + ,16 + ,62792 + ,35 + ,28 + ,51 + ,30884 + ,72 + ,72535 + ,14 + ,17 + ,39 + ,19540 + ,27) + ,dim=c(6 + ,133) + ,dimnames=list(c('time_in_rfc' + ,'logins' + ,'blogged_computations' + ,'feedback_messages_p120' + ,'totsize' + ,'tothyperlinks ') + ,1:133)) > y <- array(NA,dim=c(6,133),dimnames=list(c('time_in_rfc','logins','blogged_computations','feedback_messages_p120','totsize','tothyperlinks '),1:133)) > 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] "time_in_rfc" > x[,par1] [1] 101645 101011 7176 96560 175824 341570 103597 112611 85574 220801 [11] 92661 133328 61361 125930 82316 102010 101523 41566 99923 22648 [21] 46698 131698 91735 79863 108043 98866 120445 116048 250047 136084 [31] 92499 135781 74408 81240 133368 98146 79619 59194 139942 118612 [41] 72880 65475 99643 71965 77272 49289 135131 108446 89746 44296 [51] 77648 181528 134019 124064 92630 121848 52915 81872 58981 53515 [61] 60812 56375 65490 80949 76302 104011 98104 67989 30989 135458 [71] 73504 63123 61254 74914 31774 81437 87186 50090 65745 56653 [81] 158399 46455 73624 38395 91899 139526 52164 51567 70551 84856 [91] 102538 86678 85709 34662 150580 99611 19349 99373 86230 30837 [101] 31706 89806 62088 40151 27634 76990 37460 54157 49862 84337 [111] 64175 59382 119308 76702 103425 70344 43410 104838 62215 69304 [121] 53117 19764 86680 84105 77945 89113 91005 40248 64187 50857 [131] 56613 62792 72535 > 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]) 7176 19349 19764 22648 27634 30837 30989 31706 31774 34662 37460 1 1 1 1 1 1 1 1 1 1 1 38395 40151 40248 41566 43410 44296 46455 46698 49289 49862 50090 1 1 1 1 1 1 1 1 1 1 1 50857 51567 52164 52915 53117 53515 54157 56375 56613 56653 58981 1 1 1 1 1 1 1 1 1 1 1 59194 59382 60812 61254 61361 62088 62215 62792 63123 64175 64187 1 1 1 1 1 1 1 1 1 1 1 65475 65490 65745 67989 69304 70344 70551 71965 72535 72880 73504 1 1 1 1 1 1 1 1 1 1 1 73624 74408 74914 76302 76702 76990 77272 77648 77945 79619 79863 1 1 1 1 1 1 1 1 1 1 1 80949 81240 81437 81872 82316 84105 84337 84856 85574 85709 86230 1 1 1 1 1 1 1 1 1 1 1 86678 86680 87186 89113 89746 89806 91005 91735 91899 92499 92630 1 1 1 1 1 1 1 1 1 1 1 92661 96560 98104 98146 98866 99373 99611 99643 99923 101011 101523 1 1 1 1 1 1 1 1 1 1 1 101645 102010 102538 103425 103597 104011 104838 108043 108446 112611 116048 1 1 1 1 1 1 1 1 1 1 1 118612 119308 120445 121848 124064 125930 131698 133328 133368 134019 135131 1 1 1 1 1 1 1 1 1 1 1 135458 135781 136084 139526 139942 150580 158399 175824 181528 220801 250047 1 1 1 1 1 1 1 1 1 1 1 341570 1 > colnames(x) [1] "time_in_rfc" "logins" "blogged_computations" [4] "feedback_messages_p120" "totsize" "tothyperlinks." > colnames(x)[par1] [1] "time_in_rfc" > x[,par1] [1] 101645 101011 7176 96560 175824 341570 103597 112611 85574 220801 [11] 92661 133328 61361 125930 82316 102010 101523 41566 99923 22648 [21] 46698 131698 91735 79863 108043 98866 120445 116048 250047 136084 [31] 92499 135781 74408 81240 133368 98146 79619 59194 139942 118612 [41] 72880 65475 99643 71965 77272 49289 135131 108446 89746 44296 [51] 77648 181528 134019 124064 92630 121848 52915 81872 58981 53515 [61] 60812 56375 65490 80949 76302 104011 98104 67989 30989 135458 [71] 73504 63123 61254 74914 31774 81437 87186 50090 65745 56653 [81] 158399 46455 73624 38395 91899 139526 52164 51567 70551 84856 [91] 102538 86678 85709 34662 150580 99611 19349 99373 86230 30837 [101] 31706 89806 62088 40151 27634 76990 37460 54157 49862 84337 [111] 64175 59382 119308 76702 103425 70344 43410 104838 62215 69304 [121] 53117 19764 86680 84105 77945 89113 91005 40248 64187 50857 [131] 56613 62792 72535 > 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/1wpg11324653957.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: time_in_rfc Inputs: logins, blogged_computations, feedback_messages_p120, totsize, tothyperlinks. Number of observations: 133 1) logins <= 67; criterion = 1, statistic = 66.735 2) blogged_computations <= 16; criterion = 1, statistic = 46.212 3) feedback_messages_p120 <= 47; criterion = 1, statistic = 15.671 4) feedback_messages_p120 <= 28; criterion = 0.989, statistic = 9.32 5)* weights = 11 4) feedback_messages_p120 > 28 6)* weights = 13 3) feedback_messages_p120 > 47 7)* weights = 10 2) blogged_computations > 16 8) feedback_messages_p120 <= 30; criterion = 0.999, statistic = 14.617 9)* weights = 11 8) feedback_messages_p120 > 30 10) blogged_computations <= 42; criterion = 0.992, statistic = 9.896 11)* weights = 62 10) blogged_computations > 42 12)* weights = 15 1) logins > 67 13)* weights = 11 > postscript(file="/var/wessaorg/rcomp/tmp/2e9fw1324653957.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/3ulzr1324653957.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 101645 88013.56 13631.4355 2 101011 88013.56 12997.4355 3 7176 30022.09 -22846.0909 4 96560 165282.00 -68722.0000 5 175824 165282.00 10542.0000 6 341570 165282.00 176288.0000 7 103597 88013.56 15583.4355 8 112611 113886.20 -1275.2000 9 85574 88013.56 -2439.5645 10 220801 165282.00 55519.0000 11 92661 88013.56 4647.4355 12 133328 113886.20 19441.8000 13 61361 165282.00 -103921.0000 14 125930 165282.00 -39352.0000 15 82316 88013.56 -5697.5645 16 102010 88013.56 13996.4355 17 101523 113886.20 -12363.2000 18 41566 30022.09 11543.9091 19 99923 113886.20 -13963.2000 20 22648 30022.09 -7374.0909 21 46698 48927.38 -2229.3846 22 131698 113886.20 17811.8000 23 91735 76563.80 15171.2000 24 79863 88013.56 -8150.5645 25 108043 113886.20 -5843.2000 26 98866 88013.56 10852.4355 27 120445 165282.00 -44837.0000 28 116048 113886.20 2161.8000 29 250047 165282.00 84765.0000 30 136084 88013.56 48070.4355 31 92499 88013.56 4485.4355 32 135781 113886.20 21894.8000 33 74408 61943.45 12464.5455 34 81240 113886.20 -32646.2000 35 133368 88013.56 45354.4355 36 98146 76563.80 21582.2000 37 79619 88013.56 -8394.5645 38 59194 76563.80 -17369.8000 39 139942 113886.20 26055.8000 40 118612 113886.20 4725.8000 41 72880 76563.80 -3683.8000 42 65475 48927.38 16547.6154 43 99643 88013.56 11629.4355 44 71965 88013.56 -16048.5645 45 77272 88013.56 -10741.5645 46 49289 48927.38 361.6154 47 135131 88013.56 47117.4355 48 108446 88013.56 20432.4355 49 89746 88013.56 1732.4355 50 44296 48927.38 -4631.3846 51 77648 88013.56 -10365.5645 52 181528 88013.56 93514.4355 53 134019 88013.56 46005.4355 54 124064 113886.20 10177.8000 55 92630 61943.45 30686.5455 56 121848 88013.56 33834.4355 57 52915 88013.56 -35098.5645 58 81872 88013.56 -6141.5645 59 58981 76563.80 -17582.8000 60 53515 76563.80 -23048.8000 61 60812 88013.56 -27201.5645 62 56375 48927.38 7447.6154 63 65490 88013.56 -22523.5645 64 80949 76563.80 4385.2000 65 76302 88013.56 -11711.5645 66 104011 88013.56 15997.4355 67 98104 113886.20 -15782.2000 68 67989 88013.56 -20024.5645 69 30989 48927.38 -17938.3846 70 135458 165282.00 -29824.0000 71 73504 61943.45 11560.5455 72 63123 88013.56 -24890.5645 73 61254 61943.45 -689.4545 74 74914 88013.56 -13099.5645 75 31774 48927.38 -17153.3846 76 81437 88013.56 -6576.5645 77 87186 88013.56 -827.5645 78 50090 48927.38 1162.6154 79 65745 88013.56 -22268.5645 80 56653 88013.56 -31360.5645 81 158399 88013.56 70385.4355 82 46455 61943.45 -15488.4545 83 73624 88013.56 -14389.5645 84 38395 48927.38 -10532.3846 85 91899 88013.56 3885.4355 86 139526 165282.00 -25756.0000 87 52164 88013.56 -35849.5645 88 51567 88013.56 -36446.5645 89 70551 88013.56 -17462.5645 90 84856 88013.56 -3157.5645 91 102538 113886.20 -11348.2000 92 86678 76563.80 10114.2000 93 85709 88013.56 -2304.5645 94 34662 61943.45 -27281.4545 95 150580 165282.00 -14702.0000 96 99611 88013.56 11597.4355 97 19349 30022.09 -10673.0909 98 99373 76563.80 22809.2000 99 86230 88013.56 -1783.5645 100 30837 30022.09 814.9091 101 31706 61943.45 -30237.4545 102 89806 88013.56 1792.4355 103 62088 48927.38 13160.6154 104 40151 30022.09 10128.9091 105 27634 30022.09 -2388.0909 106 76990 88013.56 -11023.5645 107 37460 30022.09 7437.9091 108 54157 61943.45 -7786.4545 109 49862 88013.56 -38151.5645 110 84337 88013.56 -3676.5645 111 64175 88013.56 -23838.5645 112 59382 61943.45 -2561.4545 113 119308 88013.56 31294.4355 114 76702 88013.56 -11311.5645 115 103425 88013.56 15411.4355 116 70344 88013.56 -17669.5645 117 43410 30022.09 13387.9091 118 104838 113886.20 -9048.2000 119 62215 61943.45 271.5455 120 69304 88013.56 -18709.5645 121 53117 48927.38 4189.6154 122 19764 30022.09 -10258.0909 123 86680 88013.56 -1333.5645 124 84105 88013.56 -3908.5645 125 77945 88013.56 -10068.5645 126 89113 88013.56 1099.4355 127 91005 61943.45 29061.5455 128 40248 30022.09 10225.9091 129 64187 76563.80 -12376.8000 130 50857 48927.38 1929.6154 131 56613 48927.38 7685.6154 132 62792 88013.56 -25221.5645 133 72535 88013.56 -15478.5645 > 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/4zyhb1324653957.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/5iy3h1324653957.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/6y5zk1324653957.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/7a6ra1324653957.tab") + } > > try(system("convert tmp/2e9fw1324653957.ps tmp/2e9fw1324653957.png",intern=TRUE)) character(0) > try(system("convert tmp/3ulzr1324653957.ps tmp/3ulzr1324653957.png",intern=TRUE)) character(0) > try(system("convert tmp/4zyhb1324653957.ps tmp/4zyhb1324653957.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.208 0.357 3.556