0

I would like to add to my plot of normal distribution value:

qnorm(.8, 100, 15)

to a line:

abline(v=qnorm(.8, 100, 15), lty=4 )

on x-axis .

My whole code looks like this:

sr <- 100; odch <- 15
x <- seq(-4, 4,length=1000) * odch + sr
p <- dnorm(x, sr, odch)
plot(x,p, type="l", lwd=2)
pnorm(80, 100, 15) 
abline(v=80, lty=2)
plot(x,p, type="l", lwd=2)
qnorm(.8, 100, 15)
abline(v=qnorm(.8, 100, 15), lty=4)
text(x=95, y=.01, labels="80%", cex=1.5)
  • 3
    Your code is not reproducible: trying it right away raises an error. And it is not clear what is your problem... Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and rephrase your question :) – Jealie Apr 08 '14 at 23:14
  • please tell us in the question what x and p are like. or give us some similar data. – Seth Apr 08 '14 at 23:22
  • I've just added the rest of code that I missed, sorry for that :(. – user3491736 Apr 09 '14 at 19:01

2 Answers2

0

It is not clear what the problem is. I had a guess at what you are trying to do and it seems to work ok:

x <- 0:200
p <- dnorm(x, 100, 15)
plot(x,p, type="l", lwd=2, xaxs="i", yaxs="i", bty="l")
abline(v=qnorm(.80, 100, 15), lty=4)
text(x=95, y=.01, labels="80%", cex=1.5)
Adrian
  • 684
  • 3
  • 20
0

Ok, I finally got this:

v=qnorm(.8, 100, 15)
axis(1,at=v,v)