Learn R Programming

weibull4 (version 1.0.0)

weibull4.build: weibull 4-parameters distribution building function

Description

Builds data for a 4-parameters Weibull distribution of a given x data

Usage

weibull4.build(x=seq(0,1,length.out=10), shape=2.5, scale=1, loc=0, area=20,
shape2=5, scale2=2, loc2=6, area2=1, modes=1)

Arguments

x

Vector: data range for calculation of the Weibull distribution. If it is NULL, it will be set to seq(0,1,0.1)

shape

Weibull's shape parameter

scale

Weibull's scale parameter

loc

Weibull's location parameter

area

Weibull's area parameter: area under the PDF curve

shape2

second mode Weibull's shape parameter. It works only if modes=2.

scale2

second mode Weibull's scale parameter. It works only if modes=2.

loc2

second mode Weibull's location parameter. It works only if modes=2.

area2

second mode Weibull's area parameter. It works only if modes=2.

modes

Sets whether data may be fit with unimodal or bimodal Weibull distribution. This option was implemented to fit data feom the second wave of infections and deaths for COVID-19. Use modes=1 for unimodal distribution (single peak) and modes=2 for bimodal distribution (two peaks).

Value

Vector: f(x) Weibull distribution's ordinate

Warning

This package is a secondary product of the reffered science paper. Please, note that there is no warrants or professional support on its use

Details

This package was specially built to fit COVID-19 data on the number of daily new cases and deaths in countries. So x must be integer. Alternatively, Date format is allowed

References

MOREAU, V. H. (2021) Using the Weibull distribution to model COVID-19 epidemic data. Modeling Assited Statistics Applications, 2021, in press.

Examples

Run this code
# NOT RUN {
## Build a 4-parameters Weibull distribution with given parameters
weibull4.build(seq(1,100,1), shape=2.5, scale=30, loc=10, area=1000, modes=1)
## Build and plot 4-parameters Weibull distribution with given parameters
plot(seq(1,100,1), weibull4.build(seq(1,100,1), 2, 30, 10, 1), type="l")
## Build and plot 4-parameters Weibull distribution with a time series in the abscissa
Date <- seq(Sys.Date(), as.Date("2022-12-31"),1)
plot(Date, weibull4.build(Date, 1.6, 100, 100, 100), type="l")
## Build and plot a bimodal, 4-parameters Weibull distribution with given parameters
weibull4.build(seq(1,100,1), shape=2.5, scale=30, loc=10, area=1000,
shape2=2.5, scale2=60, loc2=40, area2=1000, modes=2)
# }

Run the code above in your browser using DataLab