Ask: What I want to do sounds simple. I want to plot a normal IQ curve with R with a mean of 100 and a standard deviation of 15. Then, I'd like to be able to overlay a scatter plot of data on top of it. Anybody know how to do this? Answer: Well, it's more like a histogram, since I think you are expecting these to be more like an integer rounded process: If you want the theoretic value of dnorm superimposed, then use one of these: -orx<-round(rnorm(1000, 100, 15))
y<-table(x)
plot(y)
par(new=TRUE)
plot(density(x), yaxt="n", ylab="", xlab="", xaxt="n")lines(sort(x), dnorm(sort(x), 100, 15), col="red")
points(x, dnorm(x, 100, 15))
Saturday, December 18, 2010
Reverse Statistics with R
Labels:
R,
Statistics
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment