user3347232
user3347232

Reputation: 427

R Beta function - relative y scale

I am having trouble understanding the Beta function in R. I want the y scale to display a relative value in percent (0->1). How do I achive this with the graph having the same form?

x = seq(0,1,0.001)
plot(x,dbeta(x,10,40), type="l", col="red", xlab="time", ylab="frequency")

Upvotes: 2

Views: 2108

Answers (2)

josliber
josliber

Reputation: 44310

It sounds like you're looking for the beta density, normalized so the maximum value is 1. This could be accomplished with:

x = seq(0,1,0.001)
density = dbeta(x, 10, 40)
plot(x, density/max(density), type="l", col="red", xlab="time", ylab="frequency")

enter image description here

Upvotes: 2

llrs
llrs

Reputation: 3397

Well, I am sure you looked the help page at the value page perhaps there is what you are looking for :

dbeta gives the density, pbeta the distribution function, qbeta the quantile function, and rbeta generates random deviates.

I think you want to plot the pbeta

Upvotes: 0

Related Questions