正态分布图中出错

时间:2017-09-27 18:50:18

标签: r

#Draw a normal distrubution graph 

mean = 0
sd = 1

#upper and lower value
ub = 0.5
lb = -0.5

x <- seq(-4,4,length = 100)*sd + mean
hx <- dnorm(x,0,1)

plot(x, hx, xlab = "Z-score", ylab = "Probability", 
     main = "normal distribution", axes = False)

i <- x >= lb & x <= ub
lines(x,hx)
polygon(c(0.5,x[i],0.5), c(0,hx[i],0), col ="red")

area = pnorm( 0.5,0,1) - pnorm(0.5,0,1)
axis(1, at=seq(40, 160, 20), pos=0)

我正在尝试绘制正态分布图。但是,我收到以下错误消息:

  

plot.new()出错:数字边距太大??

我使用R语言

0 个答案:

没有答案