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 + ,18158 + ,130358 + ,38 + ,17 + ,50 + ,30461 + ,7215 + ,0 + ,0 + ,0 + ,1423 + ,112861 + ,49 + ,22 + ,51 + ,25629 + ,210171 + ,74 + ,30 + ,112 + ,48758 + ,393802 + ,104 + ,31 + ,118 + ,129230 + ,117604 + ,37 + ,19 + ,59 + ,27376 + ,126029 + ,53 + ,25 + ,90 + ,26706 + ,99729 + ,42 + ,30 + ,50 + ,26505 + ,256310 + ,62 + ,26 + ,79 + ,49801 + ,113066 + ,50 + ,20 + ,49 + ,46580 + ,156212 + ,65 + ,25 + ,74 + ,48352 + ,69952 + ,28 + ,15 + ,32 + ,13899 + ,152673 + ,48 + ,22 + ,82 + ,39342 + ,125841 + ,42 + ,12 + ,43 + ,27465 + ,125769 + ,47 + ,19 + ,65 + ,55211 + ,123467 + ,71 + ,28 + ,111 + ,74098 + ,56232 + ,0 + ,12 + ,36 + ,13497 + ,108244 + ,50 + ,28 + ,89 + ,38338 + ,22762 + ,12 + ,13 + ,28 + ,52505 + ,48554 + ,16 + ,14 + ,35 + ,10663 + ,178697 + ,76 + ,27 + ,78 + ,74484 + ,140857 + ,29 + ,25 + ,67 + ,28895 + ,93773 + ,38 + ,30 + ,61 + ,32827 + ,133398 + ,50 + ,21 + ,58 + ,36188 + ,113933 + ,33 + ,17 + ,49 + ,28173 + ,144781 + ,45 + ,22 + ,77 + ,54926 + ,140711 + ,59 + ,28 + ,71 + ,38900 + ,283337 + ,49 + ,25 + ,82 + ,88530 + ,158146 + ,40 + ,16 + ,53 + ,35482 + ,123344 + ,40 + ,23 + ,71 + ,26730 + ,157640 + ,51 + ,20 + ,58 + ,29806 + ,91279 + ,41 + ,11 + ,25 + ,41799 + ,189374 + ,73 + ,20 + ,59 + ,54289 + ,167915 + ,43 + ,21 + ,77 + ,36805 + ,0 + ,0 + ,0 + ,0 + ,0 + ,175403 + ,46 + ,27 + ,75 + ,33146 + ,92342 + ,44 + ,14 + ,39 + ,23333 + ,100023 + ,31 + ,29 + ,83 + ,47686 + ,178277 + ,71 + ,31 + ,123 + ,77783 + ,145062 + ,61 + ,19 + ,67 + ,36042 + ,110980 + ,28 + ,30 + ,105 + ,34541 + ,86039 + ,21 + ,23 + ,76 + ,75620 + ,120821 + ,42 + ,20 + ,54 + ,60610 + ,95535 + ,44 + ,22 + ,82 + ,55041 + ,109894 + ,34 + ,19 + ,57 + ,32087 + ,61554 + ,15 + ,32 + ,57 + ,16356 + ,156520 + ,46 + ,18 + ,72 + ,40161 + ,159121 + ,43 + ,26 + ,94 + ,55459 + ,129362 + ,47 + ,25 + ,72 + ,36679 + ,48188 + ,12 + ,22 + ,39 + ,22346 + ,95461 + ,46 + ,19 + ,60 + ,27377 + ,229864 + ,56 + ,24 + ,84 + ,50273 + ,180317 + ,41 + ,26 + ,69 + ,32104 + ,150640 + ,48 + ,27 + ,102 + ,27016 + ,104416 + ,30 + ,10 + ,28 + ,19715 + ,165098 + ,44 + ,26 + ,65 + ,33629 + ,63205 + ,25 + ,23 + ,67 + ,27084 + ,100056 + ,42 + ,21 + ,80 + ,32352 + ,137214 + ,28 + ,34 + ,79 + ,51845 + ,99630 + ,33 + ,29 + ,107 + ,26591 + ,84557 + ,32 + ,18 + ,57 + ,29677 + ,91199 + ,28 + ,16 + ,44 + ,54237 + ,83419 + ,31 + ,23 + ,59 + ,20284 + ,101723 + ,13 + ,22 + ,80 + ,22741 + ,94982 + ,38 + ,29 + ,89 + ,34178 + ,129700 + ,39 + ,31 + ,115 + ,69551 + ,110708 + ,68 + ,21 + ,59 + ,29653 + ,81518 + ,32 + ,21 + ,66 + ,38071 + ,31970 + ,5 + ,21 + ,42 + ,4157 + ,192268 + ,53 + ,15 + ,35 + ,28321 + ,87611 + ,33 + ,9 + ,3 + ,40195 + ,77890 + ,48 + ,21 + ,68 + ,48158 + ,83261 + ,36 + ,18 + ,38 + ,13310 + ,116290 + ,52 + ,31 + ,107 + ,78474 + ,56544 + ,0 + ,25 + ,73 + ,6386 + ,116173 + ,52 + ,24 + ,80 + ,31588 + ,111488 + ,45 + ,22 + ,69 + ,61254 + ,60138 + ,16 + ,21 + ,46 + ,21152 + ,73422 + ,33 + ,26 + ,52 + ,41272 + ,67751 + ,48 + ,22 + ,58 + ,34165 + ,213351 + ,33 + ,26 + ,85 + ,37054 + ,51185 + ,24 + ,20 + ,13 + ,12368 + ,97181 + ,37 + ,25 + ,61 + ,23168 + ,45100 + ,17 + ,19 + ,49 + ,16380 + ,115801 + ,32 + ,22 + ,47 + ,41242 + ,185664 + ,55 + ,25 + ,93 + ,48450 + ,71960 + ,39 + ,22 + ,65 + ,20790 + ,76441 + ,29 + ,21 + ,64 + ,34585 + ,103613 + ,26 + ,20 + ,64 + ,35672 + ,98707 + ,37 + ,23 + ,57 + ,52168 + ,126527 + ,58 + ,22 + ,61 + ,53933 + ,136781 + ,35 + ,21 + ,71 + ,34474 + ,105863 + ,24 + ,12 + ,43 + ,43753 + ,38775 + ,18 + ,9 + ,18 + ,36456 + ,179984 + ,37 + ,32 + ,103 + ,51183 + ,164808 + ,86 + ,24 + ,76 + ,52742 + ,19349 + ,13 + ,1 + ,0 + ,3895 + ,146824 + ,20 + ,24 + ,83 + ,37076 + ,108660 + ,32 + ,22 + ,70 + ,24079 + ,43803 + ,8 + ,4 + ,4 + ,2325 + ,47062 + ,38 + ,15 + ,41 + ,29354 + ,110845 + ,45 + ,21 + ,57 + ,30341 + ,92517 + ,24 + ,23 + ,52 + ,18992 + ,58660 + ,23 + ,12 + ,24 + ,15292 + ,27676 + ,2 + ,16 + ,17 + ,5842 + ,98550 + ,52 + ,24 + ,89 + ,28918 + ,43284 + ,5 + ,9 + ,20 + ,3738 + ,0 + ,0 + ,0 + ,0 + ,0 + ,66016 + ,43 + ,22 + ,45 + ,95352 + ,57359 + ,18 + ,17 + ,63 + ,37478 + ,96933 + ,41 + ,18 + ,48 + ,26839 + ,70369 + ,45 + ,21 + ,70 + ,26783 + ,65494 + ,29 + ,17 + ,32 + ,33392 + ,3616 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,143931 + ,32 + ,20 + ,72 + ,25446 + ,109894 + ,58 + ,26 + ,56 + ,59847 + ,122973 + ,17 + ,26 + ,64 + ,28162 + ,84336 + ,24 + ,20 + ,77 + ,33298 + ,43410 + ,7 + ,1 + ,3 + ,2781 + ,136250 + ,62 + ,24 + ,73 + ,37121 + ,79015 + ,30 + ,14 + ,37 + ,22698 + ,92937 + ,49 + ,26 + ,54 + ,27615 + ,57586 + ,3 + ,12 + ,32 + ,32689 + ,19764 + ,10 + ,2 + ,4 + ,5752 + ,105757 + ,42 + ,16 + ,55 + ,23164 + ,97213 + ,18 + ,22 + ,81 + ,20304 + ,113402 + ,40 + ,28 + ,90 + ,34409 + ,11796 + ,1 + ,2 + ,1 + ,0 + ,7627 + ,0 + ,0 + ,0 + ,0 + ,121085 + ,29 + ,17 + ,38 + ,92538 + ,6836 + ,0 + ,1 + ,0 + ,0 + ,139563 + ,46 + ,17 + ,36 + ,46037 + ,5118 + ,5 + ,0 + ,0 + ,0 + ,40248 + ,8 + ,4 + ,7 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,0 + ,95079 + ,21 + ,25 + ,75 + ,23924 + ,80750 + ,21 + ,26 + ,52 + ,52230 + ,7131 + ,0 + ,0 + ,0 + ,0 + ,4194 + ,0 + ,0 + ,0 + ,0 + ,60378 + ,15 + ,15 + ,45 + ,8019 + ,96971 + ,40 + ,18 + ,60 + ,34542 + ,83484 + ,17 + ,19 + ,48 + ,21157) + ,dim=c(5 + ,144) + ,dimnames=list(c('Time' + ,'Bloggings' + ,'Reviews' + ,'Feedbackm' + ,'Characters') + ,1:144)) > y <- array(NA,dim=c(5,144),dimnames=list(c('Time','Bloggings','Reviews','Feedbackm','Characters'),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 = '' > 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" > 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 140857 93773 133398 113933 144781 140711 283337 158146 [31] 123344 157640 91279 189374 167915 0 175403 92342 100023 178277 [41] 145062 110980 86039 120821 95535 109894 61554 156520 159121 129362 [51] 48188 95461 229864 180317 150640 104416 165098 63205 100056 137214 [61] 99630 84557 91199 83419 101723 94982 129700 110708 81518 31970 [71] 192268 87611 77890 83261 116290 56544 116173 111488 60138 73422 [81] 67751 213351 51185 97181 45100 115801 185664 71960 76441 103613 [91] 98707 126527 136781 105863 38775 179984 164808 19349 146824 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 97213 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 43284 43410 43803 45100 47062 48188 1 1 1 1 1 1 1 1 1 1 1 48554 51185 56232 56544 57359 57586 58660 60138 60378 61554 63205 1 1 1 1 1 1 1 1 1 1 1 65494 66016 67751 69952 70369 71960 73422 76441 77890 79015 80750 1 1 1 1 1 1 1 1 1 1 1 81518 83261 83419 83484 84336 84557 86039 87611 91199 91279 92342 1 1 1 1 1 1 1 1 1 1 1 92517 92937 93773 94982 95079 95461 95535 96933 96971 97181 97213 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 120821 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 139563 1 1 1 1 1 1 1 1 1 1 1 140711 140857 143931 144781 145062 146824 150640 152673 156212 156520 157640 1 1 1 1 1 1 1 1 1 1 1 158146 159121 164808 165098 167915 175403 178277 178697 179984 180317 185664 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] "Time" "Bloggings" "Reviews" "Feedbackm" "Characters" > colnames(x)[par1] [1] "Time" > 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 140857 93773 133398 113933 144781 140711 283337 158146 [31] 123344 157640 91279 189374 167915 0 175403 92342 100023 178277 [41] 145062 110980 86039 120821 95535 109894 61554 156520 159121 129362 [51] 48188 95461 229864 180317 150640 104416 165098 63205 100056 137214 [61] 99630 84557 91199 83419 101723 94982 129700 110708 81518 31970 [71] 192268 87611 77890 83261 116290 56544 116173 111488 60138 73422 [81] 67751 213351 51185 97181 45100 115801 185664 71960 76441 103613 [91] 98707 126527 136781 105863 38775 179984 164808 19349 146824 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 97213 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/1q8q91323875417.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: Time Inputs: Bloggings, Reviews, Feedbackm, Characters Number of observations: 144 1) Bloggings <= 18; criterion = 1, statistic = 89.038 2) Feedbackm <= 28; criterion = 1, statistic = 26.486 3) Bloggings <= 1; criterion = 0.991, statistic = 9.299 4)* weights = 11 3) Bloggings > 1 5)* weights = 10 2) Feedbackm > 28 6)* weights = 15 1) Bloggings > 18 7) Bloggings <= 52; criterion = 1, statistic = 39.19 8) Feedbackm <= 68; criterion = 1, statistic = 15.474 9) Bloggings <= 39; criterion = 0.954, statistic = 6.364 10)* weights = 32 9) Bloggings > 39 11)* weights = 22 8) Feedbackm > 68 12)* weights = 35 7) Bloggings > 52 13)* weights = 19 > postscript(file="/var/wessaorg/rcomp/tmp/21rl21323875417.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/3qsr31323875417.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 91305.906 36170.0938 2 130358 91305.906 39052.0938 3 7215 4401.364 2813.6364 4 112861 111187.000 1674.0000 5 210171 176531.316 33639.6842 6 393802 176531.316 217270.6842 7 117604 91305.906 26298.0938 8 126029 176531.316 -50502.3158 9 99729 111187.000 -11458.0000 10 256310 176531.316 79778.6842 11 113066 111187.000 1879.0000 12 156212 176531.316 -20319.3158 13 69952 91305.906 -21353.9062 14 152673 132029.543 20643.4571 15 125841 111187.000 14654.0000 16 125769 111187.000 14582.0000 17 123467 176531.316 -53064.3158 18 56232 65933.067 -9701.0667 19 108244 132029.543 -23785.5429 20 22762 30418.900 -7656.9000 21 48554 65933.067 -17379.0667 22 178697 176531.316 2165.6842 23 140857 91305.906 49551.0938 24 93773 91305.906 2467.0938 25 133398 111187.000 22211.0000 26 113933 91305.906 22627.0938 27 144781 132029.543 12751.4571 28 140711 176531.316 -35820.3158 29 283337 132029.543 151307.4571 30 158146 111187.000 46959.0000 31 123344 132029.543 -8685.5429 32 157640 111187.000 46453.0000 33 91279 111187.000 -19908.0000 34 189374 176531.316 12842.6842 35 167915 132029.543 35885.4571 36 0 4401.364 -4401.3636 37 175403 132029.543 43373.4571 38 92342 111187.000 -18845.0000 39 100023 132029.543 -32006.5429 40 178277 176531.316 1745.6842 41 145062 176531.316 -31469.3158 42 110980 132029.543 -21049.5429 43 86039 132029.543 -45990.5429 44 120821 111187.000 9634.0000 45 95535 132029.543 -36494.5429 46 109894 91305.906 18588.0938 47 61554 65933.067 -4379.0667 48 156520 132029.543 24490.4571 49 159121 132029.543 27091.4571 50 129362 132029.543 -2667.5429 51 48188 65933.067 -17745.0667 52 95461 111187.000 -15726.0000 53 229864 176531.316 53332.6842 54 180317 132029.543 48287.4571 55 150640 132029.543 18610.4571 56 104416 91305.906 13110.0938 57 165098 111187.000 53911.0000 58 63205 91305.906 -28100.9062 59 100056 132029.543 -31973.5429 60 137214 132029.543 5184.4571 61 99630 132029.543 -32399.5429 62 84557 91305.906 -6748.9062 63 91199 91305.906 -106.9062 64 83419 91305.906 -7886.9062 65 101723 65933.067 35789.9333 66 94982 132029.543 -37047.5429 67 129700 132029.543 -2329.5429 68 110708 176531.316 -65823.3158 69 81518 91305.906 -9787.9062 70 31970 65933.067 -33963.0667 71 192268 176531.316 15736.6842 72 87611 91305.906 -3694.9062 73 77890 111187.000 -33297.0000 74 83261 91305.906 -8044.9062 75 116290 132029.543 -15739.5429 76 56544 65933.067 -9389.0667 77 116173 132029.543 -15856.5429 78 111488 132029.543 -20541.5429 79 60138 65933.067 -5795.0667 80 73422 91305.906 -17883.9062 81 67751 111187.000 -43436.0000 82 213351 132029.543 81321.4571 83 51185 91305.906 -40120.9062 84 97181 91305.906 5875.0938 85 45100 65933.067 -20833.0667 86 115801 91305.906 24495.0938 87 185664 176531.316 9132.6842 88 71960 91305.906 -19345.9062 89 76441 91305.906 -14864.9062 90 103613 91305.906 12307.0938 91 98707 91305.906 7401.0938 92 126527 176531.316 -50004.3158 93 136781 132029.543 4751.4571 94 105863 91305.906 14557.0938 95 38775 30418.900 8356.1000 96 179984 132029.543 47954.4571 97 164808 176531.316 -11723.3158 98 19349 30418.900 -11069.9000 99 146824 132029.543 14794.4571 100 108660 132029.543 -23369.5429 101 43803 30418.900 13384.1000 102 47062 91305.906 -44243.9062 103 110845 111187.000 -342.0000 104 92517 91305.906 1211.0938 105 58660 91305.906 -32645.9062 106 27676 30418.900 -2742.9000 107 98550 132029.543 -33479.5429 108 43284 30418.900 12865.1000 109 0 4401.364 -4401.3636 110 66016 111187.000 -45171.0000 111 57359 65933.067 -8574.0667 112 96933 111187.000 -14254.0000 113 70369 132029.543 -61660.5429 114 65494 91305.906 -25811.9062 115 3616 4401.364 -785.3636 116 0 4401.364 -4401.3636 117 143931 132029.543 11901.4571 118 109894 176531.316 -66637.3158 119 122973 65933.067 57039.9333 120 84336 132029.543 -47693.5429 121 43410 30418.900 12991.1000 122 136250 176531.316 -40281.3158 123 79015 91305.906 -12290.9062 124 92937 111187.000 -18250.0000 125 57586 65933.067 -8347.0667 126 19764 30418.900 -10654.9000 127 105757 111187.000 -5430.0000 128 97213 65933.067 31279.9333 129 113402 132029.543 -18627.5429 130 11796 4401.364 7394.6364 131 7627 4401.364 3225.6364 132 121085 91305.906 29779.0938 133 6836 4401.364 2434.6364 134 139563 111187.000 28376.0000 135 5118 30418.900 -25300.9000 136 40248 30418.900 9829.1000 137 0 4401.364 -4401.3636 138 95079 132029.543 -36950.5429 139 80750 91305.906 -10555.9062 140 7131 4401.364 2729.6364 141 4194 4401.364 -207.3636 142 60378 65933.067 -5555.0667 143 96971 111187.000 -14216.0000 144 83484 65933.067 17550.9333 > 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/48dv41323875417.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/5lsjn1323875417.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/6t2jy1323875417.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/7v3271323875417.tab") + } > > try(system("convert tmp/21rl21323875417.ps tmp/21rl21323875417.png",intern=TRUE)) character(0) > try(system("convert tmp/3qsr31323875417.ps tmp/3qsr31323875417.png",intern=TRUE)) character(0) > try(system("convert tmp/48dv41323875417.ps tmp/48dv41323875417.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.497 0.291 3.785