R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. Natural language support but running in an English locale 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(15561600 + ,15.73 + ,3.56 + ,142.86 + ,14917500 + ,16.17 + ,1.33 + ,380.71 + ,14805920 + ,12.00 + ,0.00 + ,460.00 + ,16958000 + ,12.86 + ,0.69 + ,361.43 + ,17605000 + ,10.30 + ,10.05 + ,140.00 + ,17131200 + ,12.97 + ,0.51 + ,275.00 + ,18474600 + ,12.06 + ,0.91 + ,274.29 + ,17286700 + ,10.49 + ,2.67 + ,212.86 + ,18574400 + ,5.97 + ,1.39 + ,172.86 + ,18056000 + ,9.26 + ,1.24 + ,186.43 + ,19701600 + ,9.74 + ,2.79 + ,77.14 + ,19061700 + ,5.46 + ,3.37 + ,17.86 + ,19681900 + ,2.71 + ,1.60 + ,37.14 + ,34521200 + ,3.90 + ,4.73 + ,42.86 + ,19922700 + ,1.51 + ,0.79 + ,85.00 + ,20177900 + ,5.01 + ,0.67 + ,45.00 + ,19759900 + ,2.96 + ,0.00 + ,206.43 + ,23076700 + ,-1.97 + ,0.60 + ,178.57 + ,22532000 + ,-4.61 + ,0.40 + ,285.71 + ,22029400 + ,4.27 + ,2.24 + ,58.57 + ,22587000 + ,4.01 + ,5.74 + ,88.57 + ,23256600 + ,0.04 + ,0.06 + ,309.29 + ,22680300 + ,3.04 + ,0.87 + ,58.57 + ,21916400 + ,2.29 + ,4.91 + ,132.14 + ,19640200 + ,4.37 + ,1.93 + ,3.57 + ,18813100 + ,6.39 + ,0.41 + ,102.86 + ,18730000 + ,5.74 + ,1.21 + ,185.71 + ,18154700 + ,7.64 + ,2.01 + ,177.14 + ,17848800 + ,7.07 + ,0.00 + ,530.00 + ,18077500 + ,6.23 + ,6.49 + ,162.86 + ,17133100 + ,10.20 + ,0.00 + ,553.57 + ,16602600 + ,14.07 + ,0.31 + ,258.57 + ,15878900 + ,12.83 + ,4.87 + ,326.43 + ,15789100 + ,12.04 + ,1.37 + ,580.00 + ,15422000 + ,11.97 + ,0.19 + ,286.43 + ,14661400 + ,12.63 + ,0.34 + ,310.71 + ,15879200 + ,13.56 + ,3.60 + ,148.57 + ,14339300 + ,15.66 + ,0.10 + ,627.14 + ,13169600 + ,16.34 + ,2.10 + ,477.86 + ,14528900 + ,14.09 + ,0.10 + ,385.71 + ,13375800 + ,15.03 + ,7.27 + ,327.86 + ,12309900 + ,16.09 + ,0.76 + ,402.14 + ,11933900 + ,19.27 + ,1.09 + ,567.86 + ,10061900 + ,22.50 + ,0.34 + ,678.57 + ,12609600 + ,16.07 + ,4.13 + ,253.57 + ,11156500 + ,19.11 + ,1.89 + ,459.29 + ,12187200 + ,18.66 + ,3.80 + ,331.43 + ,11284300 + ,18.29 + ,2.47 + ,421.43 + ,10177000 + ,20.26 + ,0.00 + ,595.00 + ,10970720 + ,19.20 + ,1.01 + ,425.71 + ,10820680 + ,20.10 + ,1.21 + ,603.57 + ,11492390 + ,17.93 + ,0.54 + ,420.00 + ,14573750 + ,16.11 + ,2.86 + ,308.57 + ,13992820 + ,16.90 + ,0.04 + ,325.00 + ,14727070 + ,16.14 + ,1.03 + ,319.29 + ,15685360 + ,15.04 + ,0.23 + ,452.86 + ,16736210 + ,13.41 + ,0.20 + ,83.57 + ,17950180 + ,14.14 + ,13.87 + ,99.43 + ,17002730 + ,9.59 + ,0.36 + ,312.71 + ,17415160 + ,10.74 + ,0.56 + ,128.00 + ,17929810 + ,11.67 + ,1.98 + ,152.67 + ,17865790 + ,8.09 + ,3.83 + ,135.00 + ,19202360 + ,10.07 + ,1.46 + ,57.71 + ,19085000 + ,11.80 + ,2.00 + ,190.43 + ,18188880 + ,12.01 + ,4.96 + ,12.86 + ,18466410 + ,6.61 + ,2.76 + ,32.43 + ,18520400 + ,6.47 + ,2.10 + ,38.29 + ,20025500 + ,-3.11 + ,2.09 + ,210.14 + ,20636100 + ,1.94 + ,2.21 + ,109.14 + ,20672000 + ,1.10 + ,2.90 + ,71.43 + ,22589100 + ,-3.40 + ,0.57 + ,102.29 + ,21864800 + ,1.64 + ,1.79 + ,48.43 + ,22750100 + ,3.11 + ,0.80 + ,70.43 + ,22548746 + ,-0.16 + ,2.66 + ,139.86 + ,21325495 + ,3.80 + ,1.70 + ,83.14 + ,21556563 + ,-2.39 + ,0.79 + ,27.71 + ,21415269 + ,1.51 + ,0.30 + ,96.14 + ,20401054 + ,7.24 + ,8.09 + ,40.57 + ,19062253 + ,2.00 + ,0.97 + ,364.71 + ,19085706 + ,2.11 + ,0.07 + ,207.43 + ,19279967 + ,10.54 + ,1.47 + ,156.29 + ,18552045 + ,11.10 + ,2.74 + ,229.00 + ,17800733 + ,7.34 + ,3.14 + ,160.43 + ,17142490 + ,9.53 + ,0.96 + ,357.43 + ,17593173 + ,9.71 + ,0.00 + ,542.00 + ,17633859 + ,10.14 + ,0.00 + ,578.43 + ,17336613 + ,13.93 + ,2.80 + ,427.43 + ,17008347 + ,8.33 + ,0.23 + ,130.29 + ,17951965 + ,8.31 + ,2.69 + ,174.29 + ,14520929 + ,13.83 + ,0.23 + ,679.14 + ,16941217 + ,14.50 + ,3.60 + ,389.43 + ,15436824 + ,16.71 + ,0.93 + ,532.57 + ,14744261 + ,16.49 + ,2.56 + ,253.71 + ,14248004 + ,14.57 + ,0.74 + ,414.14 + ,11540953 + ,19.04 + ,0.07 + ,719.71 + ,12881661 + ,22.84 + ,0.76 + ,639.86 + ,15185757 + ,22.23 + ,2.73 + ,619.71 + ,13554339 + ,19.56 + ,4.30 + ,507.14 + ,13575106 + ,19.76 + ,0.19 + ,463.86 + ,12238400 + ,18.36 + ,1.19 + ,254.14 + ,13303614 + ,16.99 + ,1.43 + ,226.29 + ,14151478 + ,16.87 + ,9.63 + ,299.57 + ,14172009 + ,18.50 + ,10.44 + ,274.00 + ,14022320 + ,16.51 + ,4.36 + ,253.29) + ,dim=c(4 + ,104) + ,dimnames=list(c('Kijkcijfers' + ,'Temperatuur' + ,'Neerslag' + ,'Zonneschijnduur') + ,1:104)) > y <- array(NA,dim=c(4,104),dimnames=list(c('Kijkcijfers','Temperatuur','Neerslag','Zonneschijnduur'),1:104)) > 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 Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric 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] "Kijkcijfers" > x[,par1] [1] 15561600 14917500 14805920 16958000 17605000 17131200 18474600 17286700 [9] 18574400 18056000 19701600 19061700 19681900 34521200 19922700 20177900 [17] 19759900 23076700 22532000 22029400 22587000 23256600 22680300 21916400 [25] 19640200 18813100 18730000 18154700 17848800 18077500 17133100 16602600 [33] 15878900 15789100 15422000 14661400 15879200 14339300 13169600 14528900 [41] 13375800 12309900 11933900 10061900 12609600 11156500 12187200 11284300 [49] 10177000 10970720 10820680 11492390 14573750 13992820 14727070 15685360 [57] 16736210 17950180 17002730 17415160 17929810 17865790 19202360 19085000 [65] 18188880 18466410 18520400 20025500 20636100 20672000 22589100 21864800 [73] 22750100 22548746 21325495 21556563 21415269 20401054 19062253 19085706 [81] 19279967 18552045 17800733 17142490 17593173 17633859 17336613 17008347 [89] 17951965 14520929 16941217 15436824 14744261 14248004 11540953 12881661 [97] 15185757 13554339 13575106 12238400 13303614 14151478 14172009 14022320 > 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]) 10061900 10177000 10820680 10970720 11156500 11284300 11492390 11540953 1 1 1 1 1 1 1 1 11933900 12187200 12238400 12309900 12609600 12881661 13169600 13303614 1 1 1 1 1 1 1 1 13375800 13554339 13575106 13992820 14022320 14151478 14172009 14248004 1 1 1 1 1 1 1 1 14339300 14520929 14528900 14573750 14661400 14727070 14744261 14805920 1 1 1 1 1 1 1 1 14917500 15185757 15422000 15436824 15561600 15685360 15789100 15878900 1 1 1 1 1 1 1 1 15879200 16602600 16736210 16941217 16958000 17002730 17008347 17131200 1 1 1 1 1 1 1 1 17133100 17142490 17286700 17336613 17415160 17593173 17605000 17633859 1 1 1 1 1 1 1 1 17800733 17848800 17865790 17929810 17950180 17951965 18056000 18077500 1 1 1 1 1 1 1 1 18154700 18188880 18466410 18474600 18520400 18552045 18574400 18730000 1 1 1 1 1 1 1 1 18813100 19061700 19062253 19085000 19085706 19202360 19279967 19640200 1 1 1 1 1 1 1 1 19681900 19701600 19759900 19922700 20025500 20177900 20401054 20636100 1 1 1 1 1 1 1 1 20672000 21325495 21415269 21556563 21864800 21916400 22029400 22532000 1 1 1 1 1 1 1 1 22548746 22587000 22589100 22680300 22750100 23076700 23256600 34521200 1 1 1 1 1 1 1 1 > colnames(x) [1] "Kijkcijfers" "Temperatuur" "Neerslag" "Zonneschijnduur" > colnames(x)[par1] [1] "Kijkcijfers" > x[,par1] [1] 15561600 14917500 14805920 16958000 17605000 17131200 18474600 17286700 [9] 18574400 18056000 19701600 19061700 19681900 34521200 19922700 20177900 [17] 19759900 23076700 22532000 22029400 22587000 23256600 22680300 21916400 [25] 19640200 18813100 18730000 18154700 17848800 18077500 17133100 16602600 [33] 15878900 15789100 15422000 14661400 15879200 14339300 13169600 14528900 [41] 13375800 12309900 11933900 10061900 12609600 11156500 12187200 11284300 [49] 10177000 10970720 10820680 11492390 14573750 13992820 14727070 15685360 [57] 16736210 17950180 17002730 17415160 17929810 17865790 19202360 19085000 [65] 18188880 18466410 18520400 20025500 20636100 20672000 22589100 21864800 [73] 22750100 22548746 21325495 21556563 21415269 20401054 19062253 19085706 [81] 19279967 18552045 17800733 17142490 17593173 17633859 17336613 17008347 [89] 17951965 14520929 16941217 15436824 14744261 14248004 11540953 12881661 [97] 15185757 13554339 13575106 12238400 13303614 14151478 14172009 14022320 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/www/html/freestat/rcomp/tmp/118va1292953966.tab") + } + } > m Conditional inference tree with 6 terminal nodes Response: Kijkcijfers Inputs: Temperatuur, Neerslag, Zonneschijnduur Number of observations: 104 1) Temperatuur <= 11.8; criterion = 1, statistic = 75.073 2) Temperatuur <= 4.27; criterion = 1, statistic = 16.782 3)* weights = 23 2) Temperatuur > 4.27 4) Zonneschijnduur <= 102.86; criterion = 0.996, statistic = 10.215 5)* weights = 9 4) Zonneschijnduur > 102.86 6)* weights = 22 1) Temperatuur > 11.8 7) Temperatuur <= 15.73; criterion = 1, statistic = 27.732 8) Zonneschijnduur <= 275; criterion = 0.953, statistic = 5.803 9)* weights = 8 8) Zonneschijnduur > 275 10)* weights = 14 7) Temperatuur > 15.73 11)* weights = 28 > postscript(file="/var/www/html/freestat/rcomp/tmp/218va1292953966.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/www/html/freestat/rcomp/tmp/3tiud1292953966.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 15561600 17065559 -1503958.75 2 14917500 12899698 2017801.71 3 14805920 15320817 -514897.36 4 16958000 15320817 1637182.64 5 17605000 17896694 -291694.05 6 17131200 17065559 65641.25 7 18474600 17065559 1409041.25 8 17286700 17896694 -609994.05 9 18574400 17896694 677705.95 10 18056000 17896694 159305.95 11 19701600 19331636 369964.00 12 19061700 19331636 -269936.00 13 19681900 21978075 -2296175.30 14 34521200 21978075 12543124.70 15 19922700 21978075 -2055375.30 16 20177900 19331636 846264.00 17 19759900 21978075 -2218175.30 18 23076700 21978075 1098624.70 19 22532000 21978075 553924.70 20 22029400 21978075 51324.70 21 22587000 21978075 608924.70 22 23256600 21978075 1278524.70 23 22680300 21978075 702224.70 24 21916400 21978075 -61675.30 25 19640200 19331636 308564.00 26 18813100 19331636 -518536.00 27 18730000 17896694 833305.95 28 18154700 17896694 258005.95 29 17848800 17896694 -47894.05 30 18077500 17896694 180805.95 31 17133100 17896694 -763594.05 32 16602600 17065559 -462958.75 33 15878900 15320817 558082.64 34 15789100 15320817 468282.64 35 15422000 15320817 101182.64 36 14661400 15320817 -659417.36 37 15879200 17065559 -1186358.75 38 14339300 15320817 -981517.36 39 13169600 12899698 269901.71 40 14528900 15320817 -791917.36 41 13375800 15320817 -1945017.36 42 12309900 12899698 -589798.29 43 11933900 12899698 -965798.29 44 10061900 12899698 -2837798.29 45 12609600 12899698 -290098.29 46 11156500 12899698 -1743198.29 47 12187200 12899698 -712498.29 48 11284300 12899698 -1615398.29 49 10177000 12899698 -2722698.29 50 10970720 12899698 -1928978.29 51 10820680 12899698 -2079018.29 52 11492390 12899698 -1407308.29 53 14573750 12899698 1674051.71 54 13992820 12899698 1093121.71 55 14727070 12899698 1827371.71 56 15685360 15320817 364542.64 57 16736210 17065559 -329348.75 58 17950180 17065559 884621.25 59 17002730 17896694 -893964.05 60 17415160 17896694 -481534.05 61 17929810 17896694 33115.95 62 17865790 17896694 -30904.05 63 19202360 19331636 -129276.00 64 19085000 17896694 1188305.95 65 18188880 17065559 1123321.25 66 18466410 19331636 -865226.00 67 18520400 19331636 -811236.00 68 20025500 21978075 -1952575.30 69 20636100 21978075 -1341975.30 70 20672000 21978075 -1306075.30 71 22589100 21978075 611024.70 72 21864800 21978075 -113275.30 73 22750100 21978075 772024.70 74 22548746 21978075 570670.70 75 21325495 21978075 -652580.30 76 21556563 21978075 -421512.30 77 21415269 21978075 -562806.30 78 20401054 19331636 1069418.00 79 19062253 21978075 -2915822.30 80 19085706 21978075 -2892369.30 81 19279967 17896694 1383272.95 82 18552045 17896694 655350.95 83 17800733 17896694 -95961.05 84 17142490 17896694 -754204.05 85 17593173 17896694 -303521.05 86 17633859 17896694 -262835.05 87 17336613 15320817 2015795.64 88 17008347 17896694 -888347.05 89 17951965 17896694 55270.95 90 14520929 15320817 -799888.36 91 16941217 15320817 1620399.64 92 15436824 12899698 2537125.71 93 14744261 12899698 1844562.71 94 14248004 15320817 -1072813.36 95 11540953 12899698 -1358745.29 96 12881661 12899698 -18037.29 97 15185757 12899698 2286058.71 98 13554339 12899698 654640.71 99 13575106 12899698 675407.71 100 12238400 12899698 -661298.29 101 13303614 12899698 403915.71 102 14151478 12899698 1251779.71 103 14172009 12899698 1272310.71 104 14022320 12899698 1122621.71 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/4mrcg1292953966.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/www/html/freestat/rcomp/tmp/57ram1292953966.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/www/html/freestat/rcomp/tmp/6ta9a1292953966.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/www/html/freestat/rcomp/tmp/7428d1292953966.tab") + } > > try(system("convert tmp/218va1292953966.ps tmp/218va1292953966.png",intern=TRUE)) character(0) > try(system("convert tmp/3tiud1292953966.ps tmp/3tiud1292953966.png",intern=TRUE)) character(0) > try(system("convert tmp/4mrcg1292953966.ps tmp/4mrcg1292953966.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.168 0.807 4.565