Hi guys,
I've been trying to graph using qqnorm() and qqline() as shown in the code below
p <- 0.25
N <- 100
B <- 10000
samples <- function(p, N){x <- sample(c(1, 0), N, replace = TRUE, prob = c(p, 1-p))
mean(x)}
errors <- replicate(B, p - samples(p, N))
qqnorm(errors) + qqline(errors)
My goal is to be able to graph errors along with a line that shows proximity to a normal distribution but this error pops out:
"Error in qqnorm(errors) + qqline(errors) :
non-numeric argument to binary operator"
As I'm new to R, I not so sure of what I'm doing wrong. Can someone provide some help?
Thank you