How to implement the Weibull Distribution in R?

Description

To implement the weibull distribution using R programming.

Four main functions in weibull
distribution:

dweibull(x, shape = , scale =) 

  • Gives density

pweibull(x, shape = , scale =)

  • Gives distribution function

qweibull(p, shape = , scale =)

  • Gives quantile fumction

rweibull(n, shape = , scale =)

  • Used to generate random deviates
  • x — vector of quantiles
  • Scale — Scale Parameter
  • Shape — Shape Parameter

#Weibull Distribution

#dweibull
x<-seq(0,100,by=1)
y<-dweibull(x,shape = 3,scale=8)
plot(x,y,main=”dweibull plot”,col=”blue”)

#pweibull
y<-pweibull(x,shape=3,scale=10)
plot(x,y,main=”pweibull”,col=”red”)

#qweibull
y<-qweibull(p=0.4,shape = 2,scale = 2)
print(y)

#rweibull
x<-rweibull(n =20,shape = 4,scale = 4)
hist(x,col=275)

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit