Hi all, I have the following code in RMarkdown
mu1 = 5
mu2 = -2.7
sigma1sq = 0.8
sigma2sq = 0.23
y = seq(-2, 6, by = 0.001)
N = length(y)
dY = rep(-99, N)
for(i in 1:N){
X2.samp = rnorm(N, mu2, sqrt(sigma2sq))
dY[i] = mean(dnorm(y[i]-X2.samp, mu1, sqrt(sigma1sq)))
}
lines(y, dY, col = "blue", lty = 5)
And it gives me the error
Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet
Could anyone give me some hints? Thank you in advance!