[R] Help with uniform distribution

CarlosBala vdkteam at gmail.com
Mon Mar 7 18:48:11 CET 2011


Hi
I have the table data below


Simula.Capital<-data.frame(Week=c(0:52), Production=0) 


Simula.Capital$Production<-round(c(120,rnorm(52, mean = 100, sd = 25)), 0)


weeks=3

i<-1; Sell<-NULL; Maximo<-NULL
for(i in seq(along= Simula.Capital$Production)){
Maximo<-Simula.Capital[2,"Production"]

Sell<-c(Sell,(round(runif(weeks, min=0, max=Maximo), 0)))
i=i+1
}
Vendas.final<-matrix(Sell, ncol=weeks)

cbind(Simula.Capital,Vendas.final)
I want the production sell in n weeks. I use 3 weeks by example. And the
selling follows a uniform distribution.


1. How can i split the production in n weeks. Please be aware that the sum
of 3 weeks selling must be equal to the production. I always sell all
production. 
2. At the end of 52 weeks I don´t have stock.
3. I need a column that sum the selling by week. 

Thanks a lot
Bala

--
View this message in context: http://r.789695.n4.nabble.com/Help-with-uniform-distribution-tp3339560p3339560.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list