R -helpers
 
i have been trying to do this problem without must success,i managed to do a graph for x, but it is not what i want to define. I have also been able to do simple rendom sample. If possible can someone help here is the code for the graph pleae help
 
data.frame(ID=c(1,2,3),mu=c(10000,34000,50000),sigma=c(2000,3000,5000))
curve(dnorm(x,mean=parms$mu[1],sd=parms$sigma[1]),from=2000,
to=80000, ylab="density", col="red")
curve(dnorm(x,mean=parms$mu[2],sd=parms$sigma[2]),from=1000,
to=80000, ylab="density", col="blue", add=TRUE)
curve(dnorm(x,mean=parms$mu[3],sd=parms$sigma[3]),from=1000,
to=80000, ylab="density", col="forestgreen", add=TRUE)
###



--- On Wed, 23/9/09, KABELI MEFANE <kabelimefane@yahoo.co.uk> wrote:


From: KABELI MEFANE <kabelimefane@yahoo.co.uk>
Subject: [R] Simulating and Plotting
To: R-help@r-project.org
Date: Wednesday, 23 September, 2009, 10:32 PM


R-helpers
 
I have been learning a little bit of R. I am simulating and i want to draw a normal curve for all my variables so that i will see the overlaps and reduce them, after that i want to draw a gragh of all the values that are in the data frame to see if it follows a normal distribution also. Lastly i will try to sample from this data. Please help and make suggestions.
 
My codes
#code for dataframe
Hypermarket <- matrix(rnorm(100, mean=50000, sd=5000))
Supermarket <- matrix(rnorm(400, mean=34000, sd=3000))
Minimarket  <- matrix(rnorm(1000, mean=10000,sd=2000))
Cornershop  <- matrix(rnorm(1500, mean=2500, sd=500))
Spazashop   <- matrix(rnorm(2000, mean=1000, sd=250))
dat=data.frame(type=c(rep("Hypermarket",100), rep("Supermarket",400),
rep("Minimarket",1000),rep("Cornershop",1500), rep("Spazashop",2000)),
value=c(Hypermarket, Supermarket, Minimarket, Cornershop,Spazashop))
dat
#code for histogram of Hypermarket(Please suggest something simple )
hist(Hypermarket, breaks=seq(30000, 65000, 1000), freq=F)
x<- seq(30000, 65000, 500)
lines(x, dnorm(x, 50000, 5000))





    [[alternative HTML version deleted]]


-----Inline Attachment Follows-----


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



      
	[[alternative HTML version deleted]]


