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(1801 + ,159261 + ,91 + ,48 + ,19 + ,1717 + ,189672 + ,59 + ,53 + ,20 + ,192 + ,7215 + ,18 + ,0 + ,0 + ,2295 + ,129098 + ,95 + ,51 + ,27 + ,3450 + ,230632 + ,136 + ,76 + ,31 + ,6861 + ,515038 + ,263 + ,136 + ,36 + ,1795 + ,180745 + ,56 + ,62 + ,23 + ,1681 + ,185559 + ,59 + ,83 + ,30 + ,1897 + ,154581 + ,44 + ,55 + ,30 + ,2974 + ,298001 + ,96 + ,67 + ,26 + ,1946 + ,121844 + ,75 + ,50 + ,24 + ,2330 + ,200907 + ,70 + ,87 + ,30 + ,1839 + ,101647 + ,100 + ,46 + ,22 + ,3183 + ,220269 + ,119 + ,79 + ,28 + ,1486 + ,170952 + ,61 + ,56 + ,18 + ,1567 + ,154647 + ,88 + ,54 + ,22 + ,1756 + ,142018 + ,57 + ,81 + ,33 + ,1247 + ,79030 + ,61 + ,6 + ,15 + ,2779 + ,167047 + ,87 + ,74 + ,34 + ,726 + ,27997 + ,24 + ,13 + ,18 + ,1048 + ,73019 + ,59 + ,22 + ,15 + ,2805 + ,241082 + ,100 + ,99 + ,30 + ,1760 + ,195820 + ,72 + ,38 + ,25 + ,2266 + ,142001 + ,54 + ,59 + ,34 + ,1848 + ,145433 + ,86 + ,50 + ,21 + ,1665 + ,183744 + ,32 + ,50 + ,21 + ,2114 + ,206521 + ,164 + ,63 + ,25 + ,1448 + ,201385 + ,94 + ,90 + ,31 + ,2741 + ,354924 + ,118 + ,60 + ,31 + ,2112 + ,192399 + ,44 + ,52 + ,20 + ,1684 + ,182286 + ,44 + ,61 + ,28 + ,1616 + ,181590 + ,45 + ,60 + ,22 + ,2227 + ,133801 + ,105 + ,53 + ,17 + ,3088 + ,233686 + ,123 + ,76 + ,25 + ,2389 + ,219428 + ,53 + ,63 + ,24 + ,1 + ,0 + ,1 + ,0 + ,0 + ,2099 + ,223044 + ,63 + ,54 + ,28 + ,1669 + ,100129 + ,51 + ,44 + ,14 + ,2137 + ,145864 + ,49 + ,42 + ,35 + ,2153 + ,249965 + ,64 + ,83 + ,34 + ,2390 + ,242379 + ,71 + ,105 + ,22 + ,1701 + ,145794 + ,59 + ,37 + ,34 + ,1049 + ,103623 + ,33 + ,25 + ,23 + ,2161 + ,195891 + ,78 + ,64 + ,24 + ,1276 + ,117156 + ,50 + ,55 + ,26 + ,1190 + ,157787 + ,95 + ,41 + ,22 + ,745 + ,81293 + ,32 + ,23 + ,35 + ,2374 + ,243273 + ,103 + ,77 + ,24 + ,2289 + ,233155 + ,89 + ,59 + ,31 + ,2639 + ,160344 + ,59 + ,68 + ,26 + ,658 + ,48188 + ,28 + ,12 + ,22 + ,1917 + ,161922 + ,69 + ,99 + ,21 + ,2557 + ,307432 + ,74 + ,78 + ,27 + ,2026 + ,235223 + ,79 + ,56 + ,30 + ,1911 + ,195583 + ,59 + ,67 + ,33 + ,1716 + ,146061 + ,56 + ,40 + ,11 + ,1852 + ,208834 + ,67 + ,53 + ,26 + ,981 + ,93764 + ,24 + ,26 + ,26 + ,1177 + ,151985 + ,66 + ,67 + ,23 + ,2849 + ,195506 + ,97 + ,36 + ,38 + ,1688 + ,148922 + ,60 + ,50 + ,31 + ,2162 + ,142670 + ,81 + ,51 + ,20 + ,1331 + ,129561 + ,61 + ,46 + ,22 + ,1307 + ,122204 + ,38 + ,57 + ,26 + ,1256 + ,160930 + ,35 + ,27 + ,26 + ,1294 + ,99184 + ,41 + ,38 + ,33 + ,2311 + ,192811 + ,71 + ,72 + ,36 + ,2897 + ,138708 + ,65 + ,93 + ,25 + ,1103 + ,114408 + ,38 + ,59 + ,24 + ,340 + ,31970 + ,15 + ,5 + ,21 + ,2791 + ,225558 + ,112 + ,53 + ,19 + ,1338 + ,139220 + ,72 + ,40 + ,12 + ,1441 + ,113612 + ,68 + ,72 + ,30 + ,1681 + ,119537 + ,72 + ,53 + ,21 + ,2650 + ,162203 + ,67 + ,81 + ,34 + ,1499 + ,100098 + ,44 + ,27 + ,32 + ,2302 + ,174768 + ,60 + ,94 + ,28 + ,2540 + ,158459 + ,97 + ,71 + ,28 + ,1000 + ,80934 + ,30 + ,20 + ,21 + ,1234 + ,84971 + ,71 + ,34 + ,31 + ,927 + ,80545 + ,68 + ,54 + ,26 + ,2176 + ,287191 + ,64 + ,49 + ,29 + ,957 + ,62974 + ,28 + ,26 + ,23 + ,1551 + ,134091 + ,40 + ,48 + ,25 + ,1014 + ,75555 + ,46 + ,35 + ,22 + ,1772 + ,162154 + ,55 + ,32 + ,26 + ,2630 + ,227638 + ,229 + ,55 + ,33 + ,1205 + ,115367 + ,112 + ,58 + ,24 + ,1392 + ,115603 + ,63 + ,44 + ,24 + ,1524 + ,155537 + ,52 + ,45 + ,21 + ,1829 + ,153133 + ,41 + ,49 + ,28 + ,2229 + ,165618 + ,78 + ,72 + ,27 + ,1233 + ,151517 + ,57 + ,39 + ,25 + ,1365 + ,133686 + ,58 + ,28 + ,15 + ,950 + ,61342 + ,40 + ,24 + ,13 + ,2319 + ,245196 + ,117 + ,52 + ,36 + ,1857 + ,195576 + ,70 + ,96 + ,24 + ,223 + ,19349 + ,12 + ,13 + ,1 + ,2390 + ,225371 + ,105 + ,38 + ,24 + ,1985 + ,153213 + ,78 + ,41 + ,31 + ,700 + ,59117 + ,29 + ,24 + ,4 + ,1062 + ,91762 + ,24 + ,54 + ,21 + ,1311 + ,136769 + ,54 + ,68 + ,23 + ,1157 + ,114798 + ,61 + ,28 + ,23 + ,823 + ,85338 + ,40 + ,36 + ,12 + ,596 + ,27676 + ,22 + ,2 + ,16 + ,1545 + ,153535 + ,48 + ,91 + ,29 + ,1130 + ,122417 + ,37 + ,29 + ,26 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1082 + ,91529 + ,32 + ,46 + ,25 + ,1135 + ,107205 + ,67 + ,25 + ,21 + ,1367 + ,144664 + ,45 + ,51 + ,23 + ,1506 + ,146445 + ,63 + ,60 + ,21 + ,870 + ,76656 + ,60 + ,36 + ,21 + ,78 + ,3616 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1130 + ,183088 + ,44 + ,40 + ,23 + ,1582 + ,144677 + ,84 + ,68 + ,33 + ,2034 + ,159104 + ,98 + ,28 + ,30 + ,970 + ,128944 + ,39 + ,41 + ,23 + ,778 + ,43410 + ,19 + ,7 + ,1 + ,1752 + ,175774 + ,73 + ,70 + ,29 + ,957 + ,95401 + ,42 + ,30 + ,18 + ,2098 + ,134837 + ,55 + ,69 + ,33 + ,731 + ,60493 + ,40 + ,3 + ,12 + ,285 + ,19764 + ,12 + ,10 + ,2 + ,1834 + ,164062 + ,56 + ,46 + ,21 + ,1148 + ,132696 + ,33 + ,34 + ,28 + ,1646 + ,155367 + ,54 + ,54 + ,29 + ,256 + ,11796 + ,9 + ,1 + ,2 + ,98 + ,10674 + ,9 + ,0 + ,0 + ,1404 + ,142261 + ,57 + ,39 + ,18 + ,41 + ,6836 + ,3 + ,0 + ,1 + ,1824 + ,162563 + ,63 + ,48 + ,21 + ,42 + ,5118 + ,3 + ,5 + ,0 + ,528 + ,40248 + ,16 + ,8 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1073 + ,122641 + ,47 + ,38 + ,25 + ,1305 + ,88837 + ,38 + ,21 + ,26 + ,81 + ,7131 + ,4 + ,0 + ,0 + ,261 + ,9056 + ,14 + ,0 + ,4 + ,934 + ,76611 + ,24 + ,15 + ,17 + ,1180 + ,132697 + ,51 + ,50 + ,21 + ,1148 + ,100681 + ,20 + ,17 + ,22) + ,dim=c(5 + ,144) + ,dimnames=list(c('Pageviews' + ,'Time_in_RFC' + ,'Logins' + ,'blogged_computations' + ,'reviewed_compendiums') + ,1:144)) > y <- array(NA,dim=c(5,144),dimnames=list(c('Pageviews','Time_in_RFC','Logins','blogged_computations','reviewed_compendiums'),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 = '5' > #'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] "reviewed_compendiums" > x[,par1] [1] 19 20 0 27 31 36 23 30 30 26 24 30 22 28 18 22 33 15 34 18 15 30 25 34 21 [26] 21 25 31 31 20 28 22 17 25 24 0 28 14 35 34 22 34 23 24 26 22 35 24 31 26 [51] 22 21 27 30 33 11 26 26 23 38 31 20 22 26 26 33 36 25 24 21 19 12 30 21 34 [76] 32 28 28 21 31 26 29 23 25 22 26 33 24 24 21 28 27 25 15 13 36 24 1 24 31 [101] 4 21 23 23 12 16 29 26 0 25 21 23 21 21 0 0 23 33 30 23 1 29 18 33 12 [126] 2 21 28 29 2 0 18 1 21 0 4 0 25 26 0 4 17 21 22 > 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 2 4 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 9 3 2 3 1 3 1 1 3 1 2 4 2 3 14 9 9 9 8 11 3 7 4 7 7 1 33 34 35 36 38 6 5 2 3 1 > colnames(x) [1] "Pageviews" "Time_in_RFC" "Logins" [4] "blogged_computations" "reviewed_compendiums" > colnames(x)[par1] [1] "reviewed_compendiums" > x[,par1] [1] 19 20 0 27 31 36 23 30 30 26 24 30 22 28 18 22 33 15 34 18 15 30 25 34 21 [26] 21 25 31 31 20 28 22 17 25 24 0 28 14 35 34 22 34 23 24 26 22 35 24 31 26 [51] 22 21 27 30 33 11 26 26 23 38 31 20 22 26 26 33 36 25 24 21 19 12 30 21 34 [76] 32 28 28 21 31 26 29 23 25 22 26 33 24 24 21 28 27 25 15 13 36 24 1 24 31 [101] 4 21 23 23 12 16 29 26 0 25 21 23 21 21 0 0 23 33 30 23 1 29 18 33 12 [126] 2 21 28 29 2 0 18 1 21 0 4 0 25 26 0 4 17 21 22 > 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/1pweb1324588455.tab") + } + } > m Conditional inference tree with 5 terminal nodes Response: reviewed_compendiums Inputs: Pageviews, Time_in_RFC, Logins, blogged_computations Number of observations: 144 1) Time_in_RFC <= 61342; criterion = 1, statistic = 65.916 2) Logins <= 14; criterion = 0.993, statistic = 9.707 3)* weights = 13 2) Logins > 14 4)* weights = 10 1) Time_in_RFC > 61342 5) Pageviews <= 1857; criterion = 1, statistic = 19.489 6) blogged_computations <= 67; criterion = 0.974, statistic = 7.402 7)* weights = 67 6) blogged_computations > 67 8)* weights = 9 5) Pageviews > 1857 9)* weights = 45 > postscript(file="/var/wessaorg/rcomp/tmp/2m7kv1324588455.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/34lsv1324588455.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 19 22.8955224 -3.8955224 2 20 22.8955224 -2.8955224 3 0 11.1000000 -11.1000000 4 27 28.4000000 -1.4000000 5 31 28.4000000 2.6000000 6 36 28.4000000 7.6000000 7 23 22.8955224 0.1044776 8 30 29.1111111 0.8888889 9 30 28.4000000 1.6000000 10 26 28.4000000 -2.4000000 11 24 28.4000000 -4.4000000 12 30 28.4000000 1.6000000 13 22 22.8955224 -0.8955224 14 28 28.4000000 -0.4000000 15 18 22.8955224 -4.8955224 16 22 22.8955224 -0.8955224 17 33 29.1111111 3.8888889 18 15 22.8955224 -7.8955224 19 34 28.4000000 5.6000000 20 18 11.1000000 6.9000000 21 15 22.8955224 -7.8955224 22 30 28.4000000 1.6000000 23 25 22.8955224 2.1044776 24 34 28.4000000 5.6000000 25 21 22.8955224 -1.8955224 26 21 22.8955224 -1.8955224 27 25 28.4000000 -3.4000000 28 31 29.1111111 1.8888889 29 31 28.4000000 2.6000000 30 20 28.4000000 -8.4000000 31 28 22.8955224 5.1044776 32 22 22.8955224 -0.8955224 33 17 28.4000000 -11.4000000 34 25 28.4000000 -3.4000000 35 24 28.4000000 -4.4000000 36 0 0.7692308 -0.7692308 37 28 28.4000000 -0.4000000 38 14 22.8955224 -8.8955224 39 35 28.4000000 6.6000000 40 34 28.4000000 5.6000000 41 22 28.4000000 -6.4000000 42 34 22.8955224 11.1044776 43 23 22.8955224 0.1044776 44 24 28.4000000 -4.4000000 45 26 22.8955224 3.1044776 46 22 22.8955224 -0.8955224 47 35 22.8955224 12.1044776 48 24 28.4000000 -4.4000000 49 31 28.4000000 2.6000000 50 26 28.4000000 -2.4000000 51 22 11.1000000 10.9000000 52 21 28.4000000 -7.4000000 53 27 28.4000000 -1.4000000 54 30 28.4000000 1.6000000 55 33 28.4000000 4.6000000 56 11 22.8955224 -11.8955224 57 26 22.8955224 3.1044776 58 26 22.8955224 3.1044776 59 23 22.8955224 0.1044776 60 38 28.4000000 9.6000000 61 31 22.8955224 8.1044776 62 20 28.4000000 -8.4000000 63 22 22.8955224 -0.8955224 64 26 22.8955224 3.1044776 65 26 22.8955224 3.1044776 66 33 22.8955224 10.1044776 67 36 28.4000000 7.6000000 68 25 28.4000000 -3.4000000 69 24 22.8955224 1.1044776 70 21 11.1000000 9.9000000 71 19 28.4000000 -9.4000000 72 12 22.8955224 -10.8955224 73 30 29.1111111 0.8888889 74 21 22.8955224 -1.8955224 75 34 28.4000000 5.6000000 76 32 22.8955224 9.1044776 77 28 28.4000000 -0.4000000 78 28 28.4000000 -0.4000000 79 21 22.8955224 -1.8955224 80 31 22.8955224 8.1044776 81 26 22.8955224 3.1044776 82 29 28.4000000 0.6000000 83 23 22.8955224 0.1044776 84 25 22.8955224 2.1044776 85 22 22.8955224 -0.8955224 86 26 22.8955224 3.1044776 87 33 28.4000000 4.6000000 88 24 22.8955224 1.1044776 89 24 22.8955224 1.1044776 90 21 22.8955224 -1.8955224 91 28 22.8955224 5.1044776 92 27 28.4000000 -1.4000000 93 25 22.8955224 2.1044776 94 15 22.8955224 -7.8955224 95 13 11.1000000 1.9000000 96 36 28.4000000 7.6000000 97 24 29.1111111 -5.1111111 98 1 0.7692308 0.2307692 99 24 28.4000000 -4.4000000 100 31 28.4000000 2.6000000 101 4 11.1000000 -7.1000000 102 21 22.8955224 -1.8955224 103 23 29.1111111 -6.1111111 104 23 22.8955224 0.1044776 105 12 22.8955224 -10.8955224 106 16 11.1000000 4.9000000 107 29 29.1111111 -0.1111111 108 26 22.8955224 3.1044776 109 0 0.7692308 -0.7692308 110 25 22.8955224 2.1044776 111 21 22.8955224 -1.8955224 112 23 22.8955224 0.1044776 113 21 22.8955224 -1.8955224 114 21 22.8955224 -1.8955224 115 0 0.7692308 -0.7692308 116 0 0.7692308 -0.7692308 117 23 22.8955224 0.1044776 118 33 29.1111111 3.8888889 119 30 28.4000000 1.6000000 120 23 22.8955224 0.1044776 121 1 11.1000000 -10.1000000 122 29 29.1111111 -0.1111111 123 18 22.8955224 -4.8955224 124 33 28.4000000 4.6000000 125 12 11.1000000 0.9000000 126 2 0.7692308 1.2307692 127 21 22.8955224 -1.8955224 128 28 22.8955224 5.1044776 129 29 22.8955224 6.1044776 130 2 0.7692308 1.2307692 131 0 0.7692308 -0.7692308 132 18 22.8955224 -4.8955224 133 1 0.7692308 0.2307692 134 21 22.8955224 -1.8955224 135 0 0.7692308 -0.7692308 136 4 11.1000000 -7.1000000 137 0 0.7692308 -0.7692308 138 25 22.8955224 2.1044776 139 26 22.8955224 3.1044776 140 0 0.7692308 -0.7692308 141 4 0.7692308 3.2307692 142 17 22.8955224 -5.8955224 143 21 22.8955224 -1.8955224 144 22 22.8955224 -0.8955224 > 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/44h7f1324588455.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/5rwgb1324588455.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/6nfi41324588455.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/7mpe91324588455.tab") + } > > try(system("convert tmp/2m7kv1324588455.ps tmp/2m7kv1324588455.png",intern=TRUE)) character(0) > try(system("convert tmp/34lsv1324588455.ps tmp/34lsv1324588455.png",intern=TRUE)) character(0) > try(system("convert tmp/44h7f1324588455.ps tmp/44h7f1324588455.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.267 0.384 3.647