I hope this example could help you best vito> x<-seq(-3.5,3.5,0.1) > x[1] -3.5 -3.4 -3.3 -3.2 -3.1 -3.0 -2.9 -2.8 -2.7 -2.6 -2.5 -2.4 -2.3 -2.2 -2.1 [16] -2.0 -1.9 -1.8 -1.7 -1.6 -1.5 -1.4 -1.3 -1.2 -1.1 -1.0 -0.9 -0.8 -0.7 -0.6 [31] -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 [46] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 [61] 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5>d<- dnorm(x,0,1)> plot(d),type="l")you wrote: Dear support, I want to draw a probability density plot in R. For example, I provide the mean and variance of a normal distribution, then R can provide me the probability density plot. Now I always generate random numbers of normal distribution and calculate their dnorm(mu, var), finally plot them. I am eager to know some directly operation. Thank you for your attention. I am looking forward to hearing from you soon. Best regards, Long Yu ====Diventare costruttori di soluzioni Became solutions' constructors "The business of the statistician is to catalyze the scientific learning process." George E. P. Box Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml
I believe this is better and that you want! x<-rnorm(1000,10,1) plot( function(y) dnorm(y, mean(x), sd(x)), from=min(x), to=max(x)) best vito You wrote: Dear support, I want to draw a probability density plot in R. For example, I provide the mean and variance of a normal distribution, then R can provide me the probability density plot. Now I always generate random numbers of normal distribution and calculate their dnorm(mu, var), finally plot them. I am eager to know some directly operation. Thank you for your attention. I am looking forward to hearing from you soon. Best regards, Long Yu ====Diventare costruttori di soluzioni Became solutions' constructors "The business of the statistician is to catalyze the scientific learning process." George E. P. Box Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml