n_100 x_rnorm(n) x_sort(x) # x y_c(rep(seq(0,1,1/length(x)),c(rep(2,length(x)+1)))) # y x_c(x,x-0.0001) x_c(x,min(x)-0.1,max(x)+0.1) x_sort(x) # x plot(x,y,type="l",ylab="Empirical density") x_seq(min(x),max(x),(max(x)-min(x))/100) # x lines(x,pnorm(x),lty=2) lines(x,pnorm(x),type="h") x_seq(-10,15,0.05) plot(x,x*dnorm(x,1,1),type="l") x_seq(-3,5,0.05) plot(x,x*dnorm(x,1,1),type="l") lines(x,rep(0,length(x)),type="l") x_seq(0,6,0.05) plot(x,x*dexp(x,1),type="l") x_seq(0,10,0.05) plot(x,x*dexp(x,1),type="l") lines(x,rep(0,length(x)),type="l") lines(x,dgamma(x,2,1),lty=3)