0
   

plotting pnorm and pbinom distributions

 
 
Reply Wed 20 May, 2015 12:26 pm
how can I do this in R? Use these "pnorm" and "pbinom" to plot the cumulative distribution function of the standard normal distribution (of parameters 0,1) and of binomial distributions of parameters n=20, 50, 100 and p=0.1, 0.4. Note that the first curve should be smooth. The other ones should be step functions. Produce two or three plots illustrating the approximation of the cumulative distribution function of a centered reduced binomial variable by the normal cumulative distribution function.

This is what I have so far but doesn't seem to work
x=seq(-4,4,length=200)
y=1/sqrt(2*pi)exp(-x^2/2)
plot(x,y,type="l",lwd=2,col="red")
par(new=TRUE)
k <- seq(-4, 4, by = .5)
lot(k,pbinom(k, 100, .1, log = TRUE), type = "s", ylab = "log density", main='pbinom(,log=TRUE)')
plot7
par(new=TRUE)
plot(k,pbinom(k, 100, .4, log = TRUE), type = "s", ylab = "log density", main='pbinom(,log=TRUE)')
par(new=TRUE)
plot(k,pbinom(k, 20, .4, log = TRUE), type = "s", ylab = "log density", main='pbinom(,log=TRUE)')
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 697 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » plotting pnorm and pbinom distributions
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.06 seconds on 11/16/2024 at 04:02:57