Silentvenom7
Silentvenom7

Reputation: 113

R plot Probability Density Function

I need to create a plot of the various different types of pdf (normal, beta, weibull, etc) for given parameters. I am very new to R, and every other resource I have been able to find shows how to fit these distributions to data; I can't find any on how to plot the distributions independently. How do I do that?

Upvotes: 1

Views: 4535

Answers (1)

Josh Morel
Josh Morel

Reputation: 1251

## Normal PDF
x <- seq(-4,4,.001)
y <- dnorm(x)
plot(x,y)

## Beta PDF 

x <- seq(0,1,.001)
y <- dbeta(x,2,5)
plot(x,y)


# Can also do with line instead of points
x <- seq(0,1,.001)
y <- dbeta(x,2,5)
plot(x,y,type='n')
lines(x,y)

Upvotes: 3

Related Questions