R version 2.9.0 (2009-04-17) Copyright (C) 2009 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. 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. > par11 = '0' > par10 = '0' > par9 = 'Demand Simulation ZIP' > par8 = '200' > par7 = '' > par6 = '' > par5 = '' > par4 = '0.5' > par3 = '2.1' > par2 = '150' > par1 = 'Zero-Inflated Poisson (mu; sigma)' > par11 <- '0' > par10 <- '0' > par9 <- 'Demand Simulation ZIP' > par8 <- '200' > par7 <- '' > par6 <- '' > par5 <- '' > par4 <- '0.5' > par3 <- '2.1' > par2 <- '150' > par1 <- 'Zero-Inflated Poisson (mu; sigma)' > #'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(MASS) > library(gamlss.dist) > par2 <- as.numeric(par2) #length > par8 <- as.numeric(par8) #instances > par10 <- as.numeric(par10) #d > par11 <- as.numeric(par11) #D > xarr <- array(NA,dim=c(par2,par8)) > if (par1 == 'Poisson (lambda)') { + if (par3=='') par3 <- '0.3' + par3 <- as.numeric(par3) + for(i in 1:par8) { + xarr[,i] <- rpois(par2, lambda=par3) + } + x <- xarr[,1] + } > if (par1 == 'Normal (mu; sigma)') { + if (par3=='') par3 <- '0' + if (par4=='') par4 <- '1' + par3 <- as.numeric(par3) + par4 <- as.numeric(par4) + for(i in 1:par8) { + xarr[,i] <- rnorm(par2, mean=par3, sd=par4) + } + for (j in 1:par8) { + for (i in 1:par10) { + xarr[,j] <- cumsum(xarr[,j]) + } + } + x <- xarr[,1] + } > if (par1 == 'Lognormal (mu; sigma)') { + if (par3=='') par3 <- '0' + if (par4=='') par4 <- '1' + par3 <- as.numeric(par3) + par4 <- as.numeric(par4) + for(i in 1:par8) { + xarr[,i] <- rlnorm(par2, mean=par3, sd=par4) + } + for (j in 1:par8) { + for (i in 1:par10) { + xarr[,j] <- cumsum(xarr[,j]) + } + } + x <- xarr[,1] + } > if (par1 == 'Negative Binomial (mu; theta)') { + if (par3=='') par3 <- '1' + if (par4=='') par4 <- '4' + par3 <- as.numeric(par3) + par4 <- as.numeric(par4) + for(i in 1:par8) { + xarr[,i] <- rnegbin(par2, mu=par3, theta=par4) + } + x <- xarr[,1] + } > if (par1 == 'Zero-Inflated Poisson (mu; sigma)') { + if (par3=='') par3 <- '5' + if (par4=='') par4 <- '0.1' + par3 <- as.numeric(par3) + par4 <- as.numeric(par4) + for(i in 1:par8) { + xarr[,i] <- rZIP(par2, mu=par3, sigma=par4) + } + x <- xarr[,1] + } > if (par1 == 'Sichel - Generalized Inverse Gaussian (mu; sigma; nu)') { + if (par3=='') par3 <- '0.5' + if (par4=='') par4 <- '0.02' + if (par5=='') par5 <- '-0.5' + par3 <- as.numeric(par3) + par4 <- as.numeric(par4) + par5 <- as.numeric(par5) + for(i in 1:par8) { + xarr[,i] <- rSI(par2, mu=par3, sigma=par4, nu=par5) + } + x <- xarr[,1] + } > if (par1 == 'Sichel2 - Generalized Inverse Gaussian (mu; sigma; nu; max.value)') { + if (par3=='') par3 <- '0.5' + if (par4=='') par4 <- '0.02' + if (par5=='') par5 <- '-0.5' + if (par6=='') par6 <- '10000' + par3 <- as.numeric(par3) + par4 <- as.numeric(par4) + par5 <- as.numeric(par5) + par6 <- as.numeric(par6) + for(i in 1:par8) { + xarr[,i] <- rSICHEL(par2, mu=par3, sigma=par4, nu=par5, max.value=par6) + } + x <- xarr[,1] + } > x [1] 0 0 4 0 3 0 3 0 2 2 0 5 0 6 0 0 3 2 0 0 1 1 3 4 0 2 0 0 0 0 2 1 0 0 1 4 3 [38] 0 0 0 0 0 0 0 4 3 0 0 1 0 2 0 2 2 1 0 0 0 3 0 2 3 0 0 0 0 0 0 1 2 0 3 1 0 [75] 0 1 0 3 0 0 0 0 0 0 3 0 0 0 0 0 2 2 0 1 0 0 1 2 0 0 0 0 3 0 1 1 0 2 0 1 4 [112] 2 0 3 0 0 0 0 0 0 2 0 3 1 0 4 0 6 2 0 1 5 1 2 1 1 2 0 2 0 0 2 4 4 0 0 0 0 [149] 3 0 > write.csv(xarr,file=paste('tmp/',par9,'.csv',sep='')) > postscript(file="/var/www/html/rcomp/tmp/16jk41275334966.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,type='b') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/26jk41275334966.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > myhist<-hist(x,col=2) > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'What is next?',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/Patrick.Wessa/rwasp_demand_forecasting_simulate.wasp',sep=''),'Simulate Time Series','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/Patrick.Wessa/rwasp_demand_forecasting_croston.wasp',sep=''),'Generate Forecasts','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/Patrick.Wessa/rwasp_demand_forecasting_analysis.wasp',sep=''),'Forecast Analysis','',target='')) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3ya171275334966.tab") > try(system("convert tmp/16jk41275334966.ps tmp/16jk41275334966.png",intern=TRUE)) character(0) > try(system("convert tmp/26jk41275334966.ps tmp/26jk41275334966.png",intern=TRUE)) character(0) > > #-SERVER-wessa.org > > > > proc.time() user system elapsed 0.701 0.325 0.830