Hi,
I've a problem with an exercise of RStudio:
Generate three samples of size n = {10, 1000, 100,000} from the random variable
X ∼ N (PN, 1) and plot the corresponding histograms
I've already done the Gaussian curve:
x <- seq(11,19,0.1)
g <- plot(x, dnorm(x, mean=15, sd=1, log=FALSE), main="f(x)", xlab="x", ylab="g(x)", abline(v=15))
I've also tried to make the histogram, but the problem is that it gives a result without taking care of probabilities of the gaussian curve:
op <- par(mfrow=c(3,1))
hist(sample(x, size=10, replace=TRUE, prob=NULL), xlim=range(11:19), main="Size 10", xlab="x")
hist(sample(x, size=1000, replace=TRUE, prob=NULL), xlim=range(11:19), main="Size 100", xlab="x")
hist(sample(x, size=100000, replace=TRUE, prob=NULL), xlim=range(11:19), main="Size 100000", xlab="x")
Any Idea?