I am using the following code to create a standard normal distribution in R:
x <- seq(-4, 4, length=200) y <- dnorm(x, mean=0, sd=1) plot(x, y, type=\"
In general case, for example: Normal(2, 1)
f <- function(x) dnorm(x, 2, 1) plot(f, -1, 5)
This is a very general, f can be defined freely, with any given parameters, for example:
f <- function(x) dbeta(x, 0.1, 0.1) plot(f, 0, 1)